mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #47346 from luxas/kubeadm_fix_tolerations
Automatic merge from submit-queue kubeadm: Start using Tolerations in yaml code again and unit-test **What this PR does / why we need it**: - Earlier there was a problem with decoding Tolerations from yaml. Seems to be fixed now. - Added an unit test to catch such a failure if that regression ever happens again **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**: Targets v1.8 **Release note**: ```release-note NONE ``` @kubernetes/sig-cluster-lifecycle-pr-reviews @timothysc
This commit is contained in:
commit
38fa62052d
@ -110,7 +110,6 @@ func CreateKubeProxyAddon(configMapBytes, daemonSetbytes []byte, client *clients
|
|||||||
if err := kuberuntime.DecodeInto(api.Codecs.UniversalDecoder(), daemonSetbytes, kubeproxyDaemonSet); err != nil {
|
if err := kuberuntime.DecodeInto(api.Codecs.UniversalDecoder(), daemonSetbytes, kubeproxyDaemonSet); err != nil {
|
||||||
return fmt.Errorf("unable to decode kube-proxy daemonset %v", err)
|
return fmt.Errorf("unable to decode kube-proxy daemonset %v", err)
|
||||||
}
|
}
|
||||||
kubeproxyDaemonSet.Spec.Template.Spec.Tolerations = []v1.Toleration{kubeadmconstants.MasterToleration}
|
|
||||||
|
|
||||||
if _, err := client.ExtensionsV1beta1().DaemonSets(metav1.NamespaceSystem).Create(kubeproxyDaemonSet); err != nil {
|
if _, err := client.ExtensionsV1beta1().DaemonSets(metav1.NamespaceSystem).Create(kubeproxyDaemonSet); err != nil {
|
||||||
if !apierrors.IsAlreadyExists(err) {
|
if !apierrors.IsAlreadyExists(err) {
|
||||||
@ -129,13 +128,6 @@ func CreateKubeDNSAddon(deploymentBytes, serviceBytes []byte, client *clientset.
|
|||||||
if err := kuberuntime.DecodeInto(api.Codecs.UniversalDecoder(), deploymentBytes, kubednsDeployment); err != nil {
|
if err := kuberuntime.DecodeInto(api.Codecs.UniversalDecoder(), deploymentBytes, kubednsDeployment); err != nil {
|
||||||
return fmt.Errorf("unable to decode kube-dns deployment %v", err)
|
return fmt.Errorf("unable to decode kube-dns deployment %v", err)
|
||||||
}
|
}
|
||||||
kubednsDeployment.Spec.Template.Spec.Tolerations = []v1.Toleration{
|
|
||||||
kubeadmconstants.MasterToleration,
|
|
||||||
{
|
|
||||||
Key: "CriticalAddonsOnly",
|
|
||||||
Operator: "Exists",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := client.ExtensionsV1beta1().Deployments(metav1.NamespaceSystem).Create(kubednsDeployment); err != nil {
|
if _, err := client.ExtensionsV1beta1().Deployments(metav1.NamespaceSystem).Create(kubednsDeployment); err != nil {
|
||||||
if !apierrors.IsAlreadyExists(err) {
|
if !apierrors.IsAlreadyExists(err) {
|
||||||
|
@ -85,10 +85,9 @@ spec:
|
|||||||
readOnly: false
|
readOnly: false
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
serviceAccountName: kube-proxy
|
serviceAccountName: kube-proxy
|
||||||
# TODO: Why doesn't the Decoder recognize this new field and decode it properly? Right now it's ignored
|
tolerations:
|
||||||
# tolerations:
|
- key: {{ .MasterTaintKey }}
|
||||||
# - key: {{ .MasterTaintKey }}
|
effect: NoSchedule
|
||||||
# effect: NoSchedule
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: kube-proxy
|
- name: kube-proxy
|
||||||
configMap:
|
configMap:
|
||||||
@ -101,7 +100,6 @@ spec:
|
|||||||
KubeDNSVersion = "1.14.4"
|
KubeDNSVersion = "1.14.4"
|
||||||
|
|
||||||
KubeDNSDeployment = `
|
KubeDNSDeployment = `
|
||||||
|
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: extensions/v1beta1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@ -125,8 +123,6 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
k8s-app: kube-dns
|
k8s-app: kube-dns
|
||||||
annotations:
|
|
||||||
scheduler.alpha.kubernetes.io/critical-pod: ''
|
|
||||||
spec:
|
spec:
|
||||||
volumes:
|
volumes:
|
||||||
- name: kube-dns-config
|
- name: kube-dns-config
|
||||||
@ -252,12 +248,11 @@ spec:
|
|||||||
cpu: 10m
|
cpu: 10m
|
||||||
dnsPolicy: Default # Don't use cluster DNS.
|
dnsPolicy: Default # Don't use cluster DNS.
|
||||||
serviceAccountName: kube-dns
|
serviceAccountName: kube-dns
|
||||||
# TODO: Why doesn't the Decoder recognize this new field and decode it properly? Right now it's ignored
|
tolerations:
|
||||||
# tolerations:
|
- key: CriticalAddonsOnly
|
||||||
# - key: CriticalAddonsOnly
|
operator: Exists
|
||||||
# operator: Exists
|
- key: {{ .MasterTaintKey }}
|
||||||
# - key: {{ .MasterTaintKey }}
|
effect: NoSchedule
|
||||||
# effect: NoSchedule
|
|
||||||
# TODO: Remove this affinity field as soon as we are using manifest lists
|
# TODO: Remove this affinity field as soon as we are using manifest lists
|
||||||
affinity:
|
affinity:
|
||||||
nodeAffinity:
|
nodeAffinity:
|
||||||
|
Loading…
Reference in New Issue
Block a user