Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adopt Kubernetes's API tooling to automatically generate #36

Merged
merged 3 commits into from
Oct 8, 2018

Conversation

Lion-Wei
Copy link

xref: #21

@k8s-ci-robot
Copy link
Contributor

Welcome @Lion-Wei! It looks like this is your first PR to kubernetes-sigs/kind 🎉

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 26, 2018
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 26, 2018
@Lion-Wei Lion-Wei changed the title adopt Kubernetes's API tooling to automatically generate [wip]adopt Kubernetes's API tooling to automatically generate Sep 26, 2018
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 26, 2018
@Lion-Wei
Copy link
Author

/retest

@Lion-Wei Lion-Wei force-pushed the generator branch 2 times, most recently from 4dec070 to 89bdfed Compare September 26, 2018 09:27
@Lion-Wei Lion-Wei changed the title [wip]adopt Kubernetes's API tooling to automatically generate adopt Kubernetes's API tooling to automatically generate Sep 26, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 26, 2018
@Lion-Wei
Copy link
Author

Hi, @BenTheElder , PTAL. And I have something not sure:

  1. Should we keep Any after we adopt API tool?
  2. Should we move v1alpha1 Config to pkg/cluster/config/v1alpha1, and generate the conversion.

Not very familiar with those tools, if there are anything misconduct or mistake please let me know. : )

@BenTheElder
Copy link
Member

Thanks for working on this!

Should we keep Any after we adopt API tool?

I think we may need some variant on Any to still mange the serialization

Should we move v1alpha1 Config to pkg/cluster/config/v1alpha1, and generate the conversion.

Yes! That sounds great to me. Imho we should have a v1alpha1 api package, and we should always maintain a pkg/cluster/config with the current api version. (perhaps by just aliasing the types?)

@BenTheElder BenTheElder mentioned this pull request Sep 26, 2018
@BenTheElder
Copy link
Member

Maybe we should break up the PRs, the first one can handle deepcopy with commits something like like:

  • update gopkg.toml to vendor the tools
  • run hack/update-deps.sh to actually vendor
  • update hack/update-generated.sh to use the deepcopy generator
  • actually replace the hand-rolled deepcopy
  • update any tests as necessary

Then we can follow up with adopting the other portions of the API tooling? I think it will probably be easier to sort out the interfaces etc if we break it up.

@BenTheElder
Copy link
Member

actually re-reading this, its already pretty easy to review :-)

@BenTheElder
Copy link
Member

I'll work on a PR to make it possible to ignore golint for the generated API code

@Lion-Wei
Copy link
Author

Yeah, I was pretty concerned about the commit organize during this work. 😌
But if we want add v1alpha1 package, then the code should be reorganized, do you mind I open another pr to add v1alpha1 package?

@BenTheElder
Copy link
Member

I'm super happy with this PR as a starting point, we just need to sort out the golint failure. I got pulled off looking into #43 :/

@Lion-Wei
Copy link
Author

Wow, you are working in midnight...Please take your time... 😅

@munnerz
Copy link
Member

munnerz commented Sep 27, 2018 via email

@BenTheElder
Copy link
Member

Deferring to @munnerz on this who has vastly more experience with this tooling and building APIs like this :-)

@BenTheElder
Copy link
Member

the gopkg.lock / gopkg.toml conflict now. I'm working on the verify updates

@BenTheElder
Copy link
Member

BenTheElder commented Sep 29, 2018

filed #48 which should unblock this once the deps update is rebased / fixed up

@BenTheElder
Copy link
Member

BenTheElder commented Oct 7, 2018 via email

@BenTheElder
Copy link
Member

BenTheElder commented Oct 7, 2018 via email

Copy link
Member

@munnerz munnerz left a comment

Choose a reason for hiding this comment

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

This looks good to me, barring a few comments.

I think we will next need to look at:

  1. Re-arranging packages to follow standard k8s conventions
  2. Moving encoding/decoding over to use the constructed Scheme, that has these new types registered
  3. Defining an 'internal' API version, to be used as a base for conversion
  4. Ensuring the version conversion works (after switching to the new scheme)

We can then begin to consider actually implementing API changes as new versions, as a test 😄

@@ -42,7 +47,11 @@ required = [
name = "github.com/spf13/cobra"
version = "0.0.3"


[[constraint]]
branch = "master"
name = "k8s.io/apimachinery"
Copy link
Member

Choose a reason for hiding this comment

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

We should be using matching versions of code-generator and apimachinery... perhaps best to switch code-generator to master for now too, if we require master of apimachinery? /cc @BenTheElder

@@ -16,4 +16,8 @@ limitations under the License.

// Package config implements the current apiVersion of the `kind` Config
// along with some common abstractions

// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=sigs.k8s.io/kind/pkg/cluster/config
Copy link
Member

Choose a reason for hiding this comment

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

afaict, we don't use conversion-gen right now, so this can be removed?

@@ -92,7 +92,7 @@ func Unmarshal(raw []byte) (config.Any, error) {
// load version
var cfg config.Any
switch version {
case config.APIVersion:
case config.SchemeGroupVersion.String():
Copy link
Member

Choose a reason for hiding this comment

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

👍 so for the time being, we use the current conversion interface/logic. SGTM.


var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
Copy link
Member

Choose a reason for hiding this comment

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

Given we are using the kube-generators, I think it makes sense to move to a kube-style package layout too, i.e. pkg/apis/kind/v1alpha1.

Probably best to do that as a separate PR for now though, to reduce the blast radius for this PR! 😄

Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 8, 2018
@BenTheElder
Copy link
Member

discussed with munnerz, let's get this in and follow up with improving our full migration to the tooling next. I'll send some more sweeping changes today to fix up kind ref #59

@munnerz
Copy link
Member

munnerz commented Oct 8, 2018

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Lion-Wei, munnerz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 8, 2018
@k8s-ci-robot k8s-ci-robot merged commit 7ec9f52 into kubernetes-sigs:master Oct 8, 2018
stg-0 pushed a commit to stg-0/kind that referenced this pull request Feb 15, 2023
…0927_Create-kind-without-apply-manifest

[EOS-10927] Feature/eos 10927 create kind without apply manifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants