Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
charts(osm-*): add pod and node affinities to control plane pods (#4527)
Browse files Browse the repository at this point in the history
* Adds pod anti-affinities to osm-controller, osm-bootstrap,
osm-injector to ensure better resilience for pod distribution
across nodes
* Replaces NodeSelectors with NodeAffinities for consistency

Signed-off-by: Sanya Kochhar <[email protected]>
  • Loading branch information
SanyaKochhar authored Feb 16, 2022
1 parent 774eb83 commit 9b268d0
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 9 deletions.
27 changes: 24 additions & 3 deletions charts/osm/templates/osm-bootstrap-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,35 @@ spec:
prometheus.io/scrape: 'true'
prometheus.io/port: '9091'
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
- key: kubernetes.io/arch
operator: In
values:
- amd64
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- osm-bootstrap
topologyKey: kubernetes.io/hostname
weight: 100
priorityClassName: system-node-critical
serviceAccountName: {{ .Release.Name }}
{{- if not (.Capabilities.APIVersions.Has "security.openshift.io/v1") }}
{{- include "restricted.securityContext" . | nindent 6 }}
{{- end }}
nodeSelector:
kubernetes.io/arch: amd64
kubernetes.io/os: linux
initContainers:
- name: init-osm-bootstrap
image: "{{ include "osmCRDs.image" . }}"
Expand Down
27 changes: 24 additions & 3 deletions charts/osm/templates/osm-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,35 @@ spec:
prometheus.io/scrape: 'true'
prometheus.io/port: '9091'
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
- key: kubernetes.io/arch
operator: In
values:
- amd64
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- osm-controller
topologyKey: kubernetes.io/hostname
weight: 100
priorityClassName: system-node-critical
serviceAccountName: {{ .Release.Name }}
{{- if not (.Capabilities.APIVersions.Has "security.openshift.io/v1") }}
{{- include "restricted.securityContext" . | nindent 6 }}
{{- end }}
nodeSelector:
kubernetes.io/arch: amd64
kubernetes.io/os: linux
initContainers:
- name: init-osm-controller
image: {{ .Values.osm.curlImage }}
Expand Down
27 changes: 24 additions & 3 deletions charts/osm/templates/osm-injector-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,35 @@ spec:
prometheus.io/scrape: 'true'
prometheus.io/port: '9091'
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
- key: kubernetes.io/arch
operator: In
values:
- amd64
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- osm-injector
topologyKey: kubernetes.io/hostname
weight: 100
priorityClassName: system-node-critical
serviceAccountName: {{ .Release.Name }}
{{- if not (.Capabilities.APIVersions.Has "security.openshift.io/v1") }}
{{- include "restricted.securityContext" . | nindent 6 }}
{{- end }}
nodeSelector:
kubernetes.io/arch: amd64
kubernetes.io/os: linux
initContainers:
- name: init-osm-injector
image: {{ .Values.osm.curlImage }}
Expand Down

0 comments on commit 9b268d0

Please sign in to comment.