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

Update kubeadm api version from v1beta1 to v1beta2 #6150

Merged
merged 21 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0ce6a03
add v1beta2 template
ruben-baez-seagull-com Dec 22, 2019
3bedd60
add v1beta2 condition
ruben-baez-seagull-com Dec 22, 2019
716abbb
refactor template && change validation
ruben-baez-seagull-com Jan 9, 2020
c7ded84
resolving conflicts
ruben-baez-seagull-com Jan 10, 2020
805f117
fix imports
ruben-baez-seagull-com Jan 10, 2020
ebecf33
add podSubnet & certSANs from v1beta1
ruben-baez-seagull-com Jan 11, 2020
5fd6bea
Merge branch 'master' of https://github.com/kubernetes/minikube into …
ruben-baez-seagull-com Jan 11, 2020
453fb9f
fix code format
ruben-baez-seagull-com Jan 12, 2020
f1557f2
add more versions for testing
ruben-baez-seagull-com Jan 12, 2020
e2c254f
change template name to 1.17 test files
ruben-baez-seagull-com Jan 12, 2020
eef0e52
add more test files to 1.18 & 1.19 versions
ruben-baez-seagull-com Jan 12, 2020
c3bb380
Merge branch 'master' of https://github.com/kubernetes/minikube into …
ruben-baez-seagull-com Jan 14, 2020
076d855
Merge branch 'master' of https://github.com/kubernetes/minikube into …
ruben-baez-seagull-com Jan 17, 2020
31fd6d9
remove kubelet conf label
ruben-baez-seagull-com Jan 17, 2020
e8e3a6f
delete an empty line
ruben-baez-seagull-com Jan 26, 2020
aaff160
Merge branch 'master' of https://github.com/kubernetes/minikube into …
ruben-baez-seagull-com Jan 26, 2020
b365692
get master changes
ruben-baez-seagull-com Jan 26, 2020
975f720
Merge branch 'master' of https://github.com/kubernetes/minikube into …
ruben-baez-seagull-com Jan 28, 2020
34bb09c
add beta2 files
ruben-baez-seagull-com Jan 30, 2020
7f17203
fix unittest
ruben-baez-seagull-com Jan 30, 2020
7e22609
Merge branch 'master' of https://github.com/kubernetes/minikube into …
ruben-baez-seagull-com Feb 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/minikube/bootstrapper/bsutil/kubeadm.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ func GenerateKubeadmYAML(k8s config.KubernetesConfig, r cruntime.Manager) ([]byt
if version.GTE(semver.MustParse("1.14.0-alpha.0")) {
configTmpl = template.KubeAdmConfigTmplV1Beta1
}
// v1beta2 isn't required until v1.18.
if version.GTE(semver.MustParse("1.18.0-alpha.0")) {

Choose a reason for hiding this comment

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

The comment for this PR and the comments in the linked issue say that v1beta2 should be used for v1.17 and higher, so this should parse 1.17.0 instead of 1.18.0-alpha.0

Copy link
Author

Choose a reason for hiding this comment

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

@priyawadhwa I made the change, thank you.

configTmpl = template.KubeAdmConfigTmplV1Beta2
}
if err := configTmpl.Execute(&b, opts); err != nil {
return nil, err
}
Expand Down
50 changes: 50 additions & 0 deletions pkg/minikube/bootstrapper/bsutil/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,56 @@ evictionHard:
imagefs.available: "0%"
`))

// KubeAdmConfigTmplV1Beta2 is for Kubernetes v1.17+
var KubeAdmConfigTmplV1Beta2 = template.Must(template.New("configTmpl-v1beta2").Funcs(template.FuncMap{
"printMapInOrder": printMapInOrder,
}).Parse(`apiVersion: kubeadm.k8s.io/v1beta2
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
ttl: 24h0m0s
usages:
- signing
- authentication
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: {{.AdvertiseAddress}}
bindPort: {{.APIServerPort}}
nodeRegistration:
criSocket: {{if .CRISocket}}{{.CRISocket}}{{else}}/var/run/dockershim.sock{{end}}
name: {{.NodeName}}
taints: []
---
{{ if .ImageRepository}}imageRepository: {{.ImageRepository}}
{{end}}{{range .ExtraArgs}}{{.Component}}:
extraArgs:
{{- range $i, $val := printMapInOrder .Options ": " }}
{{$val}}
{{- end}}
{{end -}}
{{if .FeatureArgs}}featureGates:
{{range $i, $val := .FeatureArgs}}{{$i}}: {{$val}}
{{end -}}{{end -}}
timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta2
certificatesDir: {{.CertDir}}
clusterName: kubernetes
controlPlaneEndpoint: localhost:{{.APIServerPort}}
controllerManager: {}
dns:
type: CoreDNS
etcd:
local:
dataDir: {{.EtcdDataDir}}
imageRepository: k8s.gcr.io
kind: ClusterConfiguration
kubernetesVersion: {{.KubernetesVersion}}
networking:
dnsDomain: {{if .DNSDomain}}{{.DNSDomain}}{{else}}cluster.local{{end}}
serviceSubnet: {{.ServiceCIDR}}
scheduler: {}
`))

Copy link
Contributor

Choose a reason for hiding this comment

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

kind: KubeletConfiguration doesn't exist here.
Is it OK?
Or kind: KubeletConfiguration isn't needed in Kubernetes v1.17+ ?

Copy link
Author

Choose a reason for hiding this comment

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

@atoato88 the new config file v1beta2.yaml does not have kind: KubeletConfiguration, you can check the new file here

Copy link
Author

Choose a reason for hiding this comment

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

@atoato88 I was reviewing a little more detail and found that kind: KubeletConfiguration is necessary, so I wrote it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@RubenBaez
Thank you to response 👍

// printMapInOrder sorts the keys and prints the map in order, combining key
// value pairs with the separator character
//
Expand Down