Skip to content

Commit

Permalink
feat(kuma-cp) add affinity to CP and Ingress pods (#3036)
Browse files Browse the repository at this point in the history
* add affinity configuration to CP and Ingress pods
* add default affinity rules

Signed-off-by: cloudwiz <andrey.dubnik@maersk.com>
  • Loading branch information
andrey-dubnik authored Nov 24, 2021
1 parent c065e29 commit cdff385
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,18 @@ spec:
app.kubernetes.io/instance: kuma
app: kuma-control-plane
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-control-plane
topologyKey: kubernetes.io/hostname
serviceAccountName: kuma-control-plane
nodeSelector:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,18 @@ spec:
app.kubernetes.io/instance: kuma
app: kuma-control-plane
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-control-plane
topologyKey: kubernetes.io/hostname
serviceAccountName: kuma-control-plane
nodeSelector:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,18 @@ spec:
app.kubernetes.io/instance: kuma
app: kuma-control-plane
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-control-plane
topologyKey: kubernetes.io/hostname
serviceAccountName: kuma-control-plane
nodeSelector:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,18 @@ spec:
app.kubernetes.io/instance: kuma
app: kuma-control-plane
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-control-plane
topologyKey: kubernetes.io/hostname
serviceAccountName: kuma-control-plane
nodeSelector:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,18 @@ spec:
app.kubernetes.io/instance: kuma
app: kuma-control-plane
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-control-plane
topologyKey: kubernetes.io/hostname
serviceAccountName: kuma-control-plane
nodeSelector:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,18 @@ spec:
app.kubernetes.io/instance: kuma
app: kuma-control-plane
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-control-plane
topologyKey: kubernetes.io/hostname
serviceAccountName: kuma-control-plane
nodeSelector:

Expand Down Expand Up @@ -1057,6 +1069,18 @@ spec:
app.kubernetes.io/instance: kuma
app: kuma-ingress
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-ingress
topologyKey: kubernetes.io/hostname
serviceAccountName: kuma-ingress
nodeSelector:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,18 @@ spec:
app.kubernetes.io/instance: kuma
app: kuma-control-plane
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-control-plane
topologyKey: kubernetes.io/hostname
serviceAccountName: kuma-control-plane
nodeSelector:

Expand Down
2 changes: 2 additions & 0 deletions deployments/charts/kuma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ A Helm chart for the Kuma Control Plane
| controlPlane.autoscaling.targetCPUUtilizationPercentage | int | `80` | For clusters that don't support autoscaling/v2beta, autoscaling/v1 is used |
| controlPlane.autoscaling.metrics | list | `[{"resource":{"name":"cpu","target":{"averageUtilization":80,"type":"Utilization"}},"type":"Resource"}]` | For clusters that do support autoscaling/v2beta, use metrics |
| controlPlane.nodeSelector | object | `{"kubernetes.io/arch":"amd64","kubernetes.io/os":"linux"}` | Node selector for the Kuma Control Plane pods |
| controlPlane.affinity | object | `{}` | Affinity placement rule for the Kuma Control Plane pods |
| controlPlane.injectorFailurePolicy | string | `"Ignore"` | Failure policy of the mutating webhook implemented by the Kuma Injector component |
| controlPlane.service.name | string | `nil` | Optionally override of the Kuma Control Plane Service's name |
| controlPlane.service.type | string | `"ClusterIP"` | Service type of the Kuma Control Plane |
Expand Down Expand Up @@ -70,6 +71,7 @@ A Helm chart for the Kuma Control Plane
| ingress.service.port | int | `10001` | Port on which Ingress is exposed |
| ingress.annotations | object | `{}` | Additional deployment annotation |
| ingress.nodeSelector | object | `{"kubernetes.io/arch":"amd64","kubernetes.io/os":"linux"}` | Node Selector for the Ingress pods |
| ingress.affinity | object | `{}` | Affinity placement rule for the Kuma Ingress pods |
| kumactl.image.repository | string | `"kumactl"` | The kumactl image repository |
| kubectl.image.registry | string | `"bitnami"` | The kubectl image registry |
| kubectl.image.repository | string | `"kubectl"` | The kubectl image repository |
Expand Down
17 changes: 17 additions & 0 deletions deployments/charts/kuma/templates/cp-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ spec:
{{- include "kuma.selectorLabels" . | nindent 8 }}
app: {{ include "kuma.name" . }}-control-plane
spec:
{{- with .Values.controlPlane.affinity }}
affinity:
{{ toYaml . | nindent 8 }}
{{- else }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- {{ include "kuma.name" . }}-control-plane
topologyKey: kubernetes.io/hostname
{{- end }}
serviceAccountName: {{ include "kuma.name" . }}-control-plane
{{- with .Values.controlPlane.nodeSelector }}
nodeSelector:
Expand Down
17 changes: 17 additions & 0 deletions deployments/charts/kuma/templates/ingress-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ spec:
{{- include "kuma.selectorLabels" . | nindent 8 }}
app: kuma-ingress
spec:
{{- with .Values.ingress.affinity }}
affinity:
{{ toYaml . | nindent 8 }}
{{- else }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- kuma-ingress
topologyKey: kubernetes.io/hostname
{{- end }}
serviceAccountName: {{ include "kuma.name" . }}-ingress
{{- with .Values.ingress.nodeSelector }}
nodeSelector:
Expand Down
6 changes: 6 additions & 0 deletions deployments/charts/kuma/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ controlPlane:
kubernetes.io/os: linux
kubernetes.io/arch: amd64

# -- Affinity placement rule for the Kuma Control Plane pods
affinity: {}

# -- Failure policy of the mutating webhook implemented by the Kuma Injector component
injectorFailurePolicy: Ignore

Expand Down Expand Up @@ -192,6 +195,9 @@ ingress:
nodeSelector:
kubernetes.io/os: linux
kubernetes.io/arch: amd64

# -- Affinity placement rule for the Kuma Ingress pods
affinity: {}

kumactl:
image:
Expand Down

0 comments on commit cdff385

Please sign in to comment.