Skip to content

Commit

Permalink
feat: Add labels to setup Pods for easy logs collection (#3817)
Browse files Browse the repository at this point in the history
* Add labels to setup Pods for easy logs collection

* Addressing comments

* remove unwanted line

* Addressing reviews and fixing bugs

* Fixing name and indent

* Fix test

* Removing the extra space

* Changed events to setup
  • Loading branch information
harshshahsumo authored Aug 7, 2024
1 parent b6c474c commit 17df7b4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deploy/helm/sumologic/templates/_helpers/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- template "sumologic.labels.app" . }}
{{- end -}}

{{- define "sumologic.labels.app.setup.pods" -}}
sumologic.com/app: setup
{{- end -}}

{{- define "sumologic.labels.app.setup.job" -}}
{{- template "sumologic.labels.app.setup" . }}
{{- end -}}
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/sumologic/templates/setup/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ metadata:
labels:
app: {{ template "sumologic.labels.app.setup.job" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
{{- include "sumologic.labels.app.setup.pods" . | nindent 4 }}
spec:
ttlSecondsAfterFinished: {{ .Values.sumologic.setup.job.ttlSecondsAfterFinished }}
template:
Expand All @@ -27,6 +28,7 @@ spec:
{{ toYaml .Values.sumologic.setup.job.podAnnotations | indent 8 }}
{{- end }}
labels:
{{- include "sumologic.labels.app.setup.pods" . | nindent 8 }}
{{- if .Values.sumologic.podLabels }}
{{ toYaml .Values.sumologic.podLabels | indent 8 }}
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions tests/helm/testdata/goldenfile/setup/basic.output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ metadata:
chart: "sumologic-%CURRENT_CHART_VERSION%"
release: "RELEASE-NAME"
heritage: "Helm"
sumologic.com/app: "setup"
spec:
ttlSecondsAfterFinished: 120
template:
metadata:
annotations:
labels:
sumologic.com/app: "setup"
spec:
restartPolicy: OnFailure
serviceAccountName: RELEASE-NAME-sumologic-setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ metadata:
chart: "sumologic-%CURRENT_CHART_VERSION%"
release: "RELEASE-NAME"
heritage: "Helm"
sumologic.com/app: "setup"
spec:
ttlSecondsAfterFinished: 120
template:
metadata:
annotations:
labels:
sumologic.com/app: "setup"
spec:
restartPolicy: OnFailure
serviceAccountName: RELEASE-NAME-sumologic-setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ metadata:
chart: "sumologic-%CURRENT_CHART_VERSION%"
release: "RELEASE-NAME"
heritage: "Helm"
sumologic.com/app: "setup"
spec:
ttlSecondsAfterFinished: 120
template:
metadata:
annotations:
labels:
sumologic.com/app: "setup"
spec:
restartPolicy: OnFailure
serviceAccountName: RELEASE-NAME-sumologic-setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ metadata:
chart: "sumologic-%CURRENT_CHART_VERSION%"
release: "RELEASE-NAME"
heritage: "Helm"
sumologic.com/app: "setup"
spec:
ttlSecondsAfterFinished: 120
template:
metadata:
annotations:
labels:
sumologic.com/app: "setup"
spec:
restartPolicy: OnFailure
serviceAccountName: RELEASE-NAME-sumologic-setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ metadata:
chart: "sumologic-%CURRENT_CHART_VERSION%"
release: "RELEASE-NAME"
heritage: "Helm"
sumologic.com/app: "setup"
spec:
ttlSecondsAfterFinished: 120
template:
metadata:
annotations:
labels:
sumologic.com/app: "setup"
spec:
restartPolicy: OnFailure
serviceAccountName: RELEASE-NAME-sumologic-setup
Expand Down

0 comments on commit 17df7b4

Please sign in to comment.