Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support per-component tolerations (+ manager) #154

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions charts/amazon-cloudwatch-observability/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "amazon-cloudwatch-observability.common.tolerations" -}}
{{- $tolerations := .context.Values.tolerations }}
{{- if .component }}
{{- $replaceTolerations := get .component "tolerationsReplaced" }}
{{- $componentTolerations := get .component "tolerations" }}
{{- if $componentTolerations }}
{{- if or $replaceTolerations (empty $tolerations) }}
{{- $tolerations = $componentTolerations }}
{{- else }}
{{- $tolerations = concat $tolerations $componentTolerations }}
{{- end }}
{{- end }}
{{- end }}
{{- with $tolerations }}
tolerations:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}

{{/*
Helper function to modify cloudwatch-agent config
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- with $.Values.tolerations }}
tolerations: {{- toYaml . | nindent 2}}
{{- end }}
{{- dict "component" $agent "context" . | include "amazon-cloudwatch-observability.common.tolerations" | nindent 2 }}
---
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,4 @@ spec:
tls_server_config:
cert_file: /etc/amazon-cloudwatch-observability-dcgm-cert/server.crt
key_file: /etc/amazon-cloudwatch-observability-dcgm-cert/server.key
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 2}}
{{- end }}
{{- dict "component" .Values.dcgmExporter "context" . | include "amazon-cloudwatch-observability.common.tolerations" | nindent 2 }}
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,5 @@ spec:
- fargate
nodeSelector:
kubernetes.io/os: linux
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 6}}
{{- end }}
{{- dict "component" .Values.containerLogs.fluentBit "context" . | include "amazon-cloudwatch-observability.common.tolerations" | nindent 6 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,4 @@ spec:
}
]
}
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 2}}
{{- end }}
{{- dict "component" .Values.neuronMonitor "context" . | include "amazon-cloudwatch-observability.common.tolerations" | nindent 2 }}
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ spec:
secretName: {{ template "amazon-cloudwatch-observability.certificateSecretName" . }}
nodeSelector:
kubernetes.io/os: linux
{{- dict "component" .Values.manager "context" . | include "amazon-cloudwatch-observability.common.tolerations" | nindent 6 }}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,5 @@ spec:
value: "True"
- name: RUN_AS_HOST_PROCESS_CONTAINER
value: "True"
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 2}}
{{- end }}
{{- dict "component" .Values.agent "context" . | include "amazon-cloudwatch-observability.common.tolerations" | nindent 2 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,5 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 2}}
{{- end }}
{{- dict "component" .Values.agent "context" . | include "amazon-cloudwatch-observability.common.tolerations" | nindent 2 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,5 @@ spec:
terminationGracePeriodSeconds: 10
dnsPolicy: ClusterFirstWithHostNet
serviceAccountName: {{ template "cloudwatch-agent.serviceAccountName" . }}
{{- with .Values.tolerations }}
tolerations: {{- toYaml . | nindent 6}}
{{- end }}
{{- dict "component" Values.containerLogs.fluentBit "context" . | include "amazon-cloudwatch-observability.common.tolerations" | nindent 6 }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/amazon-cloudwatch-observability/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,9 @@ manager:
podLabels: {}
service:
name:
# When true, root tolerations aren't added to this one.
tolerationsReplaced: false
tolerations:
## Admission webhooks make sure only requests with correctly formatted rules will get into the Operator.
admissionWebhooks:
create: true
Expand Down