Skip to content

Commit

Permalink
Enable custom pod labels for helm chart (#326)
Browse files Browse the repository at this point in the history
* Update template to include podLabels

* Include podLabels annotation in values file

* Bump chart version

* Include helm templating for pod labels

* Requested Feedback
  • Loading branch information
MarkDPierce authored Nov 8, 2023
1 parent 76d7d5d commit 696fead
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/k6-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.0.11"
description: A Helm chart to install the k6-operator
name: k6-operator
version: 1.2.0
version: 2.0.0
kubeVersion: ">=1.16.0-0"
home: https://k6.io
sources:
Expand Down
4 changes: 4 additions & 0 deletions charts/k6-operator/samples/customAnnotationsAndLabels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ customAnnotations:
customLabels:
"customized-labels": "k6-operator"

podLabels:
environment: production
owner: development

certManager:
enabled: true

Expand Down
8 changes: 8 additions & 0 deletions charts/k6-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ Create the name of the service account to use
{{- end }}
{{- end -}}

{{- define "k6-operator.podLabels" -}}
{{- if .Values.podLabels }}
{{- with .Values.podLabels }}
{{- toYaml . }}
{{- end }}
{{- end }}
{{- end -}}

{{- define "k6-operator.customAnnotations" -}}
{{- if .Values.customAnnotations }}
{{- with .Values.customAnnotations }}
Expand Down
1 change: 1 addition & 0 deletions charts/k6-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ spec:
metadata:
labels:
{{- include "k6-operator.selectorLabels" . | nindent 8 }}
{{- include "k6-operator.podLabels" . | nindent 8 }}
spec:
containers:
{{- if .Values.authProxy.enabled }}
Expand Down
3 changes: 3 additions & 0 deletions charts/k6-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ customAnnotations: {}
# customLabels -- Custom Label to be applied on all resources
customLabels: {}

# podLabels -- Custom Label to be applied on all pods
podLabels: {}

# nodeSelector -- Node Selector to be applied on all containers
nodeSelector: {}

Expand Down

0 comments on commit 696fead

Please sign in to comment.