-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
[WIP] RFC: Add kubeadm Beta API with conversions #49959
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: luxas Associated issue: 117 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@luxas: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Per conversations yesterday we do not have consensus on this one. Might want to mark as [WIP] in the title. |
@luxas PR needs rebase |
@timothysc Indeed. Any feedback here from you, @mikedanese, @jbeda, @roberthbailey or similar would be helpful though, want to move this forward and start the discussion at least (although this doesn't make v1.8) |
@ncdc This is one of the api-promotion PRs.. |
I would prefer if we spun off a v1alpha2 rather then jumping to a v1beta1 considering this API hasn't been thoroughly used. There's a lot of type refactoring going on here that I don't think should really happen in a promotion. With this change, we're saying "here's something totally different than what we had but we are comited to supporting it to our beta standards". |
@mikedanese would you be ok seeing this API in v1.8 as v1alpha2 with backwards-compat to v1alpha1? |
Yes that sounds appropriate and useful |
// PodSubnet specifies which subnet to use for Pods in the cluster. Setting this is optional. | ||
// Setting this is enables the controller-manager's built-in subnet allocator that will set Node.Spec.PodCIDR, | ||
// which is required information for some third-party CNI network plugins | ||
PodSubnet string `json:"podSubnet"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omitempty because it's optional?
// Image specifies which container image to use for running the scheduler. If empty, automatically populated by kubeadm using the ImageRepository and KubernetesVersion | ||
Image string `json:"image"` | ||
// ExtraArgs lets the user customize and/or override the arguments that are given to the scheduler | ||
ExtraArgs map[string]string `json:"extraArgs"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omitempty? also the other maps and slices.
// Image specifies which container image to use for running the controller manager. If empty, automatically populated by kubeadm using the ImageRepository and KubernetesVersion | ||
Image string `json:"image"` | ||
// ExtraArgs lets the user customize and/or override the arguments that are given to the controller manager | ||
ExtraArgs map[string]string `json:"extraArgs"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we avoid maps in the api as the order is undefined. Not sure whether this still causes trouble.
metav1.TypeMeta `json:",inline"` | ||
|
||
// APIServer specifies how the api server component is set up and configured | ||
APIServer APIServer `json:"apiServer"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are purely internal types, aren't they? No need for any json tags here then.
type HostPathVolume struct { | ||
// Name specifies the name of the Volume and VolumeMount | ||
Name string `json:"name"` | ||
// HostPath specifies the path on the host (can be a file or a directory) that should be mounted into the container |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because these comments might end up in documentation we avoid repeating the field name in the comment.
// ServiceSubnet specifies which subnet to use for virtual Service IPs | ||
ServiceSubnet string `json:"serviceSubnet"` | ||
// PodSubnet specifies which subnet to use for Pods in the cluster. Setting this is optional. | ||
// Setting this is enables the controller-manager's built-in subnet allocator that will set Node.Spec.PodCIDR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting this enables
// Token specifies which Node Bootstrap Token in the "<6 chars>.<16 chars>" format to automatically add to the cluster | ||
Token string `json:"token"` | ||
// TokenTTL specifies how long the automatically generated Node Bootstrap Token should be valid for | ||
TokenTTL time.Duration `json:"tokenTTL"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be metav1.Duration, shouldn't it? A raw duration will not marshal correctly.
DataDir string | ||
ExtraArgs map[string]string | ||
// Local describes a kubeadm-managed etcd cluster running locally on the master node(s) | ||
Local *LocalEtcd `json:"local"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omitempty?
// Local describes a kubeadm-managed etcd cluster running locally on the master node(s) | ||
Local *LocalEtcd `json:"local"` | ||
// External describes an etcd cluster running externally to the kubeadm-managed Kubernetes cluster | ||
External *ExternalEtcd `json:"external"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omitempty?
@@ -24,68 +24,149 @@ import ( | |||
|
|||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |||
|
|||
// MasterConfiguration contains all necessary information for kubeadm to bootstrap a cluster | |||
type MasterConfiguration struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a roundtrip_test.go? If not, it should be added. It's just to easy to break stuff.
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} | ||
|
||
var ( | ||
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about the TODO. Shouldn't we try to separate kubeadm from core kube? This sounds like the opposite.
// kubeadm defaults to deploying a local/single-node etcd cluster | ||
type Etcd struct { | ||
// Local describes a kubeadm-managed etcd cluster running locally on the master node(s) | ||
Local *LocalEtcd `json:"local"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the omitempty comments apply here too of course.
type DiscoveryFile struct { | ||
Path string `json:"path"` | ||
// TODO: Make it possible to inline the discovery file in this API? | ||
// FileBytes []byte `json:"fileBytes"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the discovery file json? Compare e.g. https://github.com/kube-node/nodeset/blob/master/pkg/nodeset/v1alpha1/types.go#L143.
// We only register manually written functions here. The registration of the | ||
// generated functions takes place in the generated files. The separation | ||
// makes the code compile even when the generated files are missing. | ||
localSchemeBuilder.Register(addKnownTypes, addDefaultingFuncs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addConversionFuncs ?
Automatic merge from submit-queue kubeadm: Add omitempty tags to nullable values and use metav1.Duration **What this PR does / why we need it**: From @sttts review of #49959; we found some shortcomings of the current JSON tags in the kubeadm config file. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: Note that #49959 will not be merged for v1.8, but this at least improves the state in v1.8 without changing anything really. **Release note**: ```release-note NONE ``` @kubernetes/sig-api-machinery-pr-reviews
This PR hasn't been active in 90 days. Closing this PR. Please reopen if you would like to work towards merging this change, if/when the PR is ready for the next round of review. cc @jbeda @luxas @mikedanese @timothysc You can add 'keep-open' label to prevent this from happening again, or add a comment to keep it open another 90 days |
What this PR does / why we need it:
Defines a configuration API we can say we'll support on a real beta level.
Required for being future-proof when upgrading. A newer kubeadm CLI version have to support an older version of the Configuration API, otherwise the user have to somehow translate things themselves, which must not happen.
Defining a Beta API is also a huge step forward towards GA.
We haven't discussed whether this will fit into v1.8 yet, but here is an RFC and WIP PR.
This was fairly straightforward to write-up, actually moving over is much harder as it changes virtually all of the source code, so therefore I haven't done that before we have a conclusion.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Fixes: kubernetes/kubeadm#117
Special notes for your reviewer:
Design discussed in https://docs.google.com/document/d/1LNaGKzjyLtPnLbRbW4QUfwVEJS3XcyQy_JmWyV-bVbU/edit#, still WIP
All manual conversations aren't written yet
The kubeadm source code have to adopt to the new v1beta1 API group, which is a bit of work
Release note:
cc @kubernetes/sig-cluster-lifecycle-pr-reviews @sttts