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

[WIP] RFC: Add kubeadm Beta API with conversions #49959

Closed
wants to merge 1 commit into from

Conversation

luxas
Copy link
Member

@luxas luxas commented Aug 1, 2017

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:

kubeadm: Add v1beta1 API group for configuring kubeadm functionality

cc @kubernetes/sig-cluster-lifecycle-pr-reviews @sttts

@k8s-ci-robot k8s-ci-robot added sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 1, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Aug 1, 2017
@k8s-ci-robot
Copy link
Contributor

@luxas: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-federation-e2e-gce 3ffba6b link /test pull-kubernetes-federation-e2e-gce
pull-kubernetes-unit 3ffba6b link /test pull-kubernetes-unit
pull-kubernetes-kubemark-e2e-gce 3ffba6b link /test pull-kubernetes-kubemark-e2e-gce
pull-kubernetes-bazel 3ffba6b link /test pull-kubernetes-bazel
pull-kubernetes-e2e-kops-aws 3ffba6b link /test pull-kubernetes-e2e-kops-aws
pull-kubernetes-e2e-gce-etcd3 3ffba6b link /test pull-kubernetes-e2e-gce-etcd3
pull-kubernetes-verify 3ffba6b link /test pull-kubernetes-verify

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.

@timothysc timothysc added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Aug 2, 2017
@timothysc
Copy link
Member

Per conversations yesterday we do not have consensus on this one. Might want to mark as [WIP] in the title.

@k8s-github-robot
Copy link

@luxas PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 3, 2017
@luxas luxas changed the title RFC: Add kubeadm Beta API with conversions [WIP] RFC: Add kubeadm Beta API with conversions Aug 3, 2017
@luxas
Copy link
Member Author

luxas commented Aug 3, 2017

@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)

@timothysc
Copy link
Member

@ncdc This is one of the api-promotion PRs..

@mikedanese
Copy link
Member

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".

@luxas
Copy link
Member Author

luxas commented Aug 15, 2017

@mikedanese would you be ok seeing this API in v1.8 as v1alpha2 with backwards-compat to v1alpha1?
In prep for beta eventually...

@mikedanese
Copy link
Member

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"`
Copy link
Contributor

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"`
Copy link
Contributor

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"`
Copy link
Contributor

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"`
Copy link
Contributor

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
Copy link
Contributor

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,
Copy link
Contributor

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"`
Copy link
Contributor

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"`
Copy link
Contributor

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"`
Copy link
Contributor

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 {
Copy link
Contributor

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.
Copy link
Contributor

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"`
Copy link
Contributor

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"`
Copy link
Contributor

Choose a reason for hiding this comment

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

// 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)
Copy link
Contributor

Choose a reason for hiding this comment

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

addConversionFuncs ?

@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 23, 2017
k8s-github-robot pushed a commit that referenced this pull request Sep 3, 2017
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
@k8s-github-robot
Copy link

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

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. do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Completely redesign the API configuration group
7 participants