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

Split internal/current config from v1alpha1 and start using k8s.Scheme #137

Merged

Conversation

fabriziopandini
Copy link
Member

This PR sets the ground for addressing #130

Preparation works include the refactor of the current kind config by splitting internal/current from v1alpha1 API versions and switching to k8s.Scheme for managing encoding, conversions, and defaulting.

Note for reviewers

  1. Sorry for the size of the PR, but API changes are difficult to break down into separated PRs.
  2. I'm still learning kind codebase, so might be I didn't catch some internals of the current config; please let me know 😅

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 26, 2018
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 26, 2018
cfg = &layout.Config
rawCfg = layout
}
err = yaml.UnmarshalStrict(raw, rawCfg)
Copy link
Member

Choose a reason for hiding this comment

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

this does unfortunately mean we lose strict unmarshalling (See the config issue for dicussion) but it is currently par for the course in kubernetes tooling.

Copy link
Member

Choose a reason for hiding this comment

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

strict unmarshal warnings (or errors?) would be pretty easy to add after this PR is merged as a pre-step before Decode.

Copy link
Member

Choose a reason for hiding this comment

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

had a look at how to create a custom decoder too. seems doable in the near future.

Copy link
Member Author

Choose a reason for hiding this comment

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

@BenTheElder, considering above comments it seems to me that this can be acceptable for now right?

Copy link
Member

Choose a reason for hiding this comment

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

this can be acceptable for now right

yes,
it's just that i recommend that we enable strict unmarshal with the first kind release.

since we cannot merge a strict decoded in api-machinery in this release, we should probably go for the way kubeadm is doing it. calling yaml.UnmarshalStrict before Decode.

Copy link
Member

Choose a reason for hiding this comment

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

yes, sorry, I wanted to call out that we had this functionality change, but it makes sense.

we can sort out strict unmarshal again later, I'm ok with that not being in the first "release" since the first release will be very alpha grade and not stable. I'm going to make this clear with the versioning of the APIs and kind itself.

we should get strict unmarshal before we make compatibility guarantees between versions so it isn't a breaking change later.

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.

Awesome to see this done! I added a few comments. Mostly based on having looked at other Kubernetes controller/software. We may not want to adopt all the same patterns - I'm not sure exactly why all these things are the case, but they do seem to be applied consistently 😄

// Package v1alpha1 implements the v1alpha1 apiVersion of the `kind` Config
//
// +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.

(not necessarily for this PR): perhaps we should move this to sigs.k8s.io/kind/pkg/apis/kind[/v1alpha1] for consistency with other k8s api packages?

Copy link
Member

Choose a reason for hiding this comment

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

would sigs.k8s.io/kind/pkg/apis/kind[/v1alpha1] imply conversion-gen-external-types?

e.g. how it's done for the kubelet:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/apis/config/v1beta1/doc.go#L18-L19

Copy link
Member Author

Choose a reason for hiding this comment

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

@munnerz you are right, this is not necessary now, but this will be used as soon as v1alpha2 will be added, so if you don't mind I will leave it

Copy link
Member

Choose a reason for hiding this comment

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

+1, let's do this in a follow up.

I put it under pkg/cluster/config in an attempt to signal the scope of the config object, let's consider that as we improve the config / API structure, I'd like to leave room to grow in new and unexpected ways ... other container runtimes, possibly CLI tools ... :-)

pkg/cluster/config/default.go Show resolved Hide resolved
pkg/cluster/config/encoding/scheme.go Outdated Show resolved Hide resolved
Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

👍

pkg/cluster/config/encoding/scheme_test.go Outdated Show resolved Hide resolved
pkg/cluster/config/encoding/scheme_test.go Show resolved Hide resolved
@fabriziopandini
Copy link
Member Author

Rebase + squash commits
Almost all the comments are addressed, few last comments waiting for feedback

@BenTheElder
Copy link
Member

/lgtm
/approve
We can bikeshed further (like rearraging the API packages) in follow-ups, thanks for working on this!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 28, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, fabriziopandini

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 Nov 28, 2018
@k8s-ci-robot k8s-ci-robot merged commit 4d125c5 into kubernetes-sigs:master Nov 28, 2018
@fabriziopandini fabriziopandini mentioned this pull request Dec 4, 2018
@fabriziopandini fabriziopandini deleted the internal-config-version branch December 15, 2018 08:44
stg-0 pushed a commit to stg-0/kind that referenced this pull request Jun 20, 2023
…s_cidr_elegible

[EOS-11199][GCP][AZURE(VM)] Parametrizar ipPool
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.

5 participants