Skip to content

Commit

Permalink
Extra helm chart labels (kubeflow#1669)
Browse files Browse the repository at this point in the history
* Added support for setting extra commonLabels

* Added support for podLabels on cleanup and init job

* Fixed templating errors

* Added documentation

Signed-off-by: Peter McClonski <[email protected]>
  • Loading branch information
kvanzuijlen authored and peter-mcclonski committed Apr 16, 2024
1 parent bd2eda2 commit 142e3c2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/spark-operator-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ All charts linted successfully
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity for pod assignment |
| batchScheduler.enable | bool | `false` | Enable batch scheduler for spark jobs scheduling. If enabled, users can specify batch scheduler name in spark application |
| commonLabels | object | `{}` | Common labels to add to the resources |
| controllerThreads | int | `10` | Operator concurrency, higher values might increase memory usage |
| fullnameOverride | string | `""` | String to override release name |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
Expand Down Expand Up @@ -126,8 +127,10 @@ All charts linted successfully
| tolerations | list | `[]` | List of node taints to tolerate |
| uiService.enable | bool | `true` | Enable UI service creation for Spark application |
| webhook.cleanupAnnotations | object | `{"helm.sh/hook":"pre-delete, pre-upgrade","helm.sh/hook-delete-policy":"hook-succeeded"}` | The annotations applied to the cleanup job, required for helm lifecycle hooks |
| webhook.cleanupPodLabels | object | `{}` | The podLabels applied to the pod of the cleanup job |
| webhook.enable | bool | `false` | Enable webhook server |
| webhook.initAnnotations | object | `{"helm.sh/hook":"pre-install, pre-upgrade","helm.sh/hook-weight":"50"}` | The annotations applied to init job, required to restore certs deleted by the cleanup job during upgrade |
| webhook.initPodLabels | object | `{}` | The podLabels applied to the pod of the init job |
| webhook.namespaceSelector | string | `""` | The webhook server will only operate on namespaces with this label, specified in the form key1=value1,key2=value2. Empty string (default) will operate on all namespaces |
| webhook.port | int | `8080` | Webhook service port |
| webhook.timeout | int | `30` | |
Expand Down
3 changes: 3 additions & 0 deletions charts/spark-operator-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Common labels
{{- define "spark-operator.labels" -}}
helm.sh/chart: {{ include "spark-operator.chart" . }}
{{ include "spark-operator.selectorLabels" . }}
{{- if .Values.commonLabels }}
{{ toYaml .Values.commonLabels }}
{{- end }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
annotations:
"sidecar.istio.io/inject": "false"
{{- end }}
{{- if .Values.webhook.cleanupPodLabels }}
labels:
{{- toYaml .Values.webhook.cleanupPodLabels | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "spark-operator.serviceAccountName" . }}
restartPolicy: OnFailure
Expand Down
4 changes: 4 additions & 0 deletions charts/spark-operator-chart/templates/webhook-init-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
annotations:
"sidecar.istio.io/inject": "false"
{{- end }}
{{- if .Values.webhook.initPodLabels }}
labels:
{{- toYaml .Values.webhook.initPodLabels | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "spark-operator.serviceAccountName" . }}
restartPolicy: OnFailure
Expand Down
7 changes: 7 additions & 0 deletions charts/spark-operator-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

# -- Common labels to add to the resources
commonLabels: {}

# replicaCount -- Desired number of pods, leaderElection will be enabled
# if this is greater than 1
replicaCount: 1
Expand Down Expand Up @@ -92,11 +95,15 @@ webhook:
initAnnotations:
"helm.sh/hook": pre-install, pre-upgrade
"helm.sh/hook-weight": "50"
# -- The podLabels applied to the pod of the init job
initPodLabels: {}
# -- The annotations applied to the cleanup job, required for helm lifecycle hooks
cleanupAnnotations:
"helm.sh/hook": pre-delete, pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
# -- Webhook Timeout in seconds
# -- The podLabels applied to the pod of the cleanup job
cleanupPodLabels: {}
timeout: 30

metrics:
Expand Down

0 comments on commit 142e3c2

Please sign in to comment.