forked from kubernetes/release
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use different copies of 10-kubeadm.conf depending on version.
For kubeadm 1.8, we changed the flags we want to start kubelet with. This change breaks 10-kubeadm.conf into two files (pre- and post-1.8) and selects which one to use at build time, based on the target version. I've also included unit tests for the new functionality which aren't run by default ("go test" manually), but are meant to demonstrate the versioning edge cases I tested. A similar change still needs to happen for our rpm build scripts. kubernetes/kubeadm#442
- Loading branch information
Showing
12 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestGetKubeadmConfig(t *testing.T) { | ||
testcases := []struct { | ||
version string | ||
expectConfig string | ||
expectErr bool | ||
}{ | ||
{ | ||
"1.6.10", | ||
"pre-1.8/10-kubeadm.conf", | ||
false, | ||
}, | ||
{ | ||
"1.7.10", | ||
"pre-1.8/10-kubeadm.conf", | ||
false, | ||
}, | ||
{ | ||
"1.7.0-beta.5", | ||
"pre-1.8/10-kubeadm.conf", | ||
false, | ||
}, | ||
{ | ||
"1.8.0", | ||
"post-1.8/10-kubeadm.conf", | ||
false, | ||
}, | ||
{ | ||
"1.8.0-alpha.0", | ||
"post-1.8/10-kubeadm.conf", | ||
false, | ||
}, | ||
{ | ||
"1.8.0-beta.2", | ||
"post-1.8/10-kubeadm.conf", | ||
false, | ||
}, | ||
{ | ||
"1.9.0", | ||
"post-1.8/10-kubeadm.conf", | ||
false, | ||
}, | ||
{ | ||
"not-a-real-version", | ||
"", | ||
true, | ||
}, | ||
} | ||
|
||
for _, tc := range testcases { | ||
v := version{ | ||
Version: tc.version, | ||
} | ||
kubeadmConfig, err := getKubeadmConfig(v) | ||
|
||
if err != nil { | ||
if !tc.expectErr { | ||
t.Errorf("getKubeadmConfig(%s) returned unwanted error: %v", tc.version, err) | ||
} | ||
} else { | ||
if kubeadmConfig != tc.expectConfig { | ||
t.Errorf("getKubeadmConfig(%s) got %q, wanted %q", tc.version, kubeadmConfig, tc.expectConfig) | ||
} | ||
} | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
debian/xenial/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...ial/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../../../stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf |
1 change: 1 addition & 0 deletions
1
...nial/kubeadm/channel/nightly/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../../../stable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf |
10 changes: 10 additions & 0 deletions
10
...nial/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Service] | ||
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf" | ||
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true" | ||
Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin" | ||
Environment="KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 --cluster-domain=cluster.local" | ||
Environment="KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt" | ||
Environment="KUBELET_CADVISOR_ARGS=--cadvisor-port=0" | ||
Environment="KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true" | ||
ExecStart= | ||
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS |
File renamed without changes.
1 change: 0 additions & 1 deletion
1
debian/xenial/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...al/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../../../stable/etc/systemd/system/kubelet.service.d/post-1.8/10-kubeadm.conf |
1 change: 1 addition & 0 deletions
1
...ial/kubeadm/channel/unstable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../../../stable/etc/systemd/system/kubelet.service.d/pre-1.8/10-kubeadm.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
usr/bin/kubeadm usr/bin/ | ||
channel/{{ .Channel }}/etc/systemd/system/kubelet.service.d/10-kubeadm.conf etc/systemd/system/kubelet.service.d/ | ||
channel/{{ .Channel }}/etc/systemd/system/kubelet.service.d/{{ .KubeadmKubeletConfigFile }} etc/systemd/system/kubelet.service.d/ |