mirror of https://github.com/k3s-io/k3s
Merge pull request #1275 from louiznk/feat/toleration/control_plane
feat: add NoSchedule toleration on key node-role.kubernetes.io/masterpull/1585/head
commit
ceb6bfbbf3
|
@ -99,6 +99,9 @@ spec:
|
|||
tolerations:
|
||||
- key: "CriticalAddonsOnly"
|
||||
operator: "Exists"
|
||||
- key: "node-role.kubernetes.io/master"
|
||||
operator: "Exists"
|
||||
effect: "NoSchedule"
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/os: linux
|
||||
containers:
|
||||
|
|
|
@ -51,6 +51,12 @@ spec:
|
|||
app: local-path-provisioner
|
||||
spec:
|
||||
serviceAccountName: local-path-provisioner-service-account
|
||||
tolerations:
|
||||
- key: "CriticalAddonsOnly"
|
||||
operator: "Exists"
|
||||
- key: "node-role.kubernetes.io/master"
|
||||
operator: "Exists"
|
||||
effect: "NoSchedule"
|
||||
containers:
|
||||
- name: local-path-provisioner
|
||||
image: rancher/local-path-provisioner:v0.0.11
|
||||
|
|
|
@ -23,6 +23,12 @@ spec:
|
|||
k8s-app: metrics-server
|
||||
spec:
|
||||
serviceAccountName: metrics-server
|
||||
tolerations:
|
||||
- key: "CriticalAddonsOnly"
|
||||
operator: "Exists"
|
||||
- key: "node-role.kubernetes.io/master"
|
||||
operator: "Exists"
|
||||
effect: "NoSchedule"
|
||||
volumes:
|
||||
# mount in tmp so we can safely use from-scratch images and/or read-only containers
|
||||
- name: tmp-dir
|
||||
|
|
|
@ -5,9 +5,21 @@ metadata:
|
|||
namespace: kube-system
|
||||
spec:
|
||||
chart: https://%{KUBERNETES_API}%/static/charts/traefik-1.81.0.tgz
|
||||
set:
|
||||
rbac.enabled: "true"
|
||||
ssl.enabled: "true"
|
||||
metrics.prometheus.enabled: "true"
|
||||
kubernetes.ingressEndpoint.useDefaultPublishedService: "true"
|
||||
valuesContent: |-
|
||||
rbac:
|
||||
enabled: true
|
||||
ssl:
|
||||
enabled: true
|
||||
metrics:
|
||||
prometheus:
|
||||
enabled: true
|
||||
kubernetes:
|
||||
ingressEndpoint:
|
||||
useDefaultPublishedService: true
|
||||
image: "rancher/library-traefik"
|
||||
tolerations:
|
||||
- key: "CriticalAddonsOnly"
|
||||
operator: "Exists"
|
||||
- key: "node-role.kubernetes.io/master"
|
||||
operator: "Exists"
|
||||
effect: "NoSchedule"
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -356,6 +356,22 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
|
|||
|
||||
ds.Spec.Template.Spec.Containers = append(ds.Spec.Template.Spec.Containers, container)
|
||||
}
|
||||
|
||||
// Add toleration to noderole.kubernetes.io/master=*:NoSchedule
|
||||
noScheduleToleration := core.Toleration{
|
||||
Key: "noderole.kubernetes.io/master",
|
||||
Operator: "Exists",
|
||||
Effect: "NoSchedule",
|
||||
}
|
||||
ds.Spec.Template.Spec.Tolerations = append(ds.Spec.Template.Spec.Tolerations, noScheduleToleration)
|
||||
|
||||
// Add toleration to CriticalAddonsOnly
|
||||
criticalAddonsOnlyToleration := core.Toleration{
|
||||
Key: "CriticalAddonsOnly",
|
||||
Operator: "Exists",
|
||||
}
|
||||
ds.Spec.Template.Spec.Tolerations = append(ds.Spec.Template.Spec.Tolerations, criticalAddonsOnlyToleration)
|
||||
|
||||
// Add node selector only if label "svccontroller.k3s.cattle.io/enablelb" exists on the nodes
|
||||
selector, err := labels.Parse(daemonsetNodeLabel)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue