Skip to content

Commit

Permalink
helm: Add pod affinity for cilium-envoy
Browse files Browse the repository at this point in the history
This commit is to avoid cilium-envoy running on the node without cilium
agent. Two main changes are:

- podAffinity with requiredDuringSchedulingIgnoredDuringExecution to
  cilium agent
- tolerations with same values as the agent itself, this is to cater
  node without cilium cases

Relates: cilium#25081, cilium#30034
Fixes: cilium#31149
Signed-off-by: Tam Mach <tam.mach@cilium.io>
  • Loading branch information
sayboras committed Mar 12, 2024
1 parent e6576ec commit 0954ccb
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Documentation/helm-values.rst

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions install/kubernetes/cilium/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.envoy.tolerations }}
tolerations:
{{- with .Values.envoy.tolerations }}
{{- toYaml . | trim | nindent 8 }}
{{- end }}
volumes:
Expand Down
32 changes: 27 additions & 5 deletions install/kubernetes/cilium/values.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 27 additions & 5 deletions install/kubernetes/cilium/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1936,17 +1936,39 @@ envoy:
labelSelector:
matchLabels:
k8s-app: cilium-envoy
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
k8s-app: cilium
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: cilium.io/no-schedule
operator: NotIn
values:
- true
# -- Node selector for cilium-envoy.
nodeSelector:
kubernetes.io/os: linux
# -- Node tolerations for envoy scheduling to nodes with taints
# By default it follows the same tolerations as the agent itself
# to allow the Cilium agent on this node to connect to cilium-envoy pod.
# ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
tolerations:
- operator: Exists
# - key: "key"
# operator: "Equal|Exists"
# value: "value"
# effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)"
- key: node.kubernetes.io/not-ready
effect: NoSchedule
- key: node-role.kubernetes.io/master
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
- key: node.cloudprovider.kubernetes.io/uninitialized
effect: NoSchedule
value: "true"
- key: CriticalAddonsOnly
operator: "Exists"
# -- The priority class to use for cilium-envoy.
priorityClassName: ~
# -- DNS policy for Cilium envoy pods.
Expand Down

0 comments on commit 0954ccb

Please sign in to comment.