Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

caesarxuchao
Copy link
Contributor

update PodSpec.Host to PodSpec.NodeName in /pkg/api/types.go and /pkg/api/v1/types.go

fix #6895

@bgrant0607 @krousey

@bgrant0607 bgrant0607 added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 27, 2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the description tag, also: node requested for this pod.

@bgrant0607 bgrant0607 self-assigned this May 27, 2015
@bgrant0607
Copy link
Member

Fails gofmt

@bgrant0607
Copy link
Member

Ref #7018

@caesarxuchao
Copy link
Contributor Author

Updated. PTAL. Thanks.

@bgrant0607
Copy link
Member

Doesn't build. Regenerate pkg/api/deep_copy_generated.go

@caesarxuchao
Copy link
Contributor Author

Yeah, I have the problem when I work on #6797 today. It's strange this problem didn't occur yesterday. I will get back to this PR after fixing #6797.

@bgrant0607
Copy link
Member

@wojtek-t We're having trouble with the generated conversions. Is it obvious what we're doing wrong?

@caesarxuchao
Copy link
Contributor Author

Hi @wojtek-t, no big deals, I just want to know what's the best practice when one tried to update the api, e.g., update PodSpec.Host to PodSpec.Nodename.

here are the steps that I want to take, but these don't work:

  1. change a field name (e.g. Host->NodeName) in api/types.go and api/v1/types.go
  2. add functions in v1beta3/conversion.go to convert "Host" in v1beta3 to "NodeName" in internal version
  3. run hack/update-generated-conversion.sh and hack/update-generated-deep-copies.sh.
    This doesn't work because in step 3, the scripts complain that the v1beta3/conversion-generated.go and deep-copies_generated.go contain undeclared field name "Host"

So I have to manually update various -generated.go, and then these update- scripts are happy. However, at this point, I have already made all the changes manually, there is no work left for these update-* scripts. Please let me know if there is a better way. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is something wrong with the goimports. I will fix it. Thanks.

@bgrant0607
Copy link
Member

Building the generator should not build the previously generated code. That seems wrong.

@caesarxuchao
Copy link
Contributor Author

In cmd/genconversion/conversion.go:

     "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
     _ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1"
     _ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
     _ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta2"
     _ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"

So to build the generator, it requires the conversion_generated.go files in these packages to be correct.

@bgrant0607
Copy link
Member

I understand that's the way it is. I was saying it shouldn't be that way. :-)

The generated code just needs to build, though, right? It doesn't need to work? If you commented out the lines it complained about, would the generator build and then regenerate the conversions?

@caesarxuchao
Copy link
Contributor Author

Yeah, that should work. That seems to be the best option.

@wojtek-t
Copy link
Member

@caesarxuchao - yes, unfortunately this is the easiest way to do it. Basically, what you can do is to remove the whole code from */conversions_generated.go files, and running:
hack/update-generated-conversions.sh will regenerate them.
I agree it's not convenient and shouldn't work like this but it's not trivial to fix it.

@bgrant0607
Copy link
Member

@wojtek-t
Copy link
Member

@bgrant0607 - I thought about it and I know how to fix the problem. Will fix the real issue instead of updating documentation :)

@caesarxuchao
Copy link
Contributor Author

"remove the whole code from */conversions_generated.go" won't work, because some functions in conversion.go depend on code in conversions_generated.go

@wojtek-t, I'm looking forward to your fix : )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/host/node/ in error message

@wojtek-t
Copy link
Member

@caesarxuchao unfortunately my fix doesn't work because what you wrote. Updated instructions are in #8921

@bgrant0607
Copy link
Member

Tests failing:

_output/local/go/src/github.com/GoogleCloudPlatform/kubernetes/pkg/api/deep_copy_generated.go:1377: out.Host undefined (type *PodSpec has no field or method Host)

@caesarxuchao caesarxuchao force-pushed the HostToNodeName branch 2 times, most recently from 241087d to 89cd3ab Compare May 28, 2015 17:35
@caesarxuchao
Copy link
Contributor Author

@bgrant0607 Updated and rebased. Let's wait for the Shippable results. Thanks.

@bgrant0607
Copy link
Member

Shippable failed already:

 github.com/GoogleCloudPlatform/kubernetes/test/soak/serve_hostnames
test/soak/serve_hostnames/serve_hostnames.go:188: unknown "github.com/GoogleCloudPlatform/kubernetes/pkg/api".PodSpec field 'Host' in struct literal

@caesarxuchao
Copy link
Contributor Author

There is something wrong in field.selector. I'm taking a look.

@caesarxuchao
Copy link
Contributor Author

@bgrant0607 Shippable is green

@bgrant0607
Copy link
Member

Please squash the commits.

@bgrant0607
Copy link
Member

LGTM once squashed.

@bgrant0607 bgrant0607 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2015
@caesarxuchao
Copy link
Contributor Author

Squashed. Thanks.

thockin added a commit that referenced this pull request May 28, 2015
update PodSpec.Host to PodSpec.NodeName
@thockin thockin merged commit 081ab3a into kubernetes:master May 28, 2015
@caesarxuchao caesarxuchao deleted the HostToNodeName branch May 12, 2020 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename PodSpec.Host to PodSpec.NodeName
5 participants