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

feat: allow for overriding job annotations and adding init containers #315

Merged
merged 3 commits into from
Jun 26, 2023
Merged
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
2 changes: 1 addition & 1 deletion charts/datahub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Helm chart for LinkedIn DataHub
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.2.175
version: 0.2.176
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.10.4
Expand Down
4 changes: 4 additions & 0 deletions charts/datahub/templates/datahub-auth-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ $secretRef }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- if .autoGenerate }}
Expand Down
4 changes: 4 additions & 0 deletions charts/datahub/templates/datahub-encryption-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ $secretRef }}
{{- with .annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- if .autoGenerate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ metadata:
name: {{ .Release.Name }}-nocode-migration-job
labels:
{{- include "datahub.labels" . | nindent 4 }}
{{- with .Values.datahubUpgrade.annotations }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "-2"
"helm.sh/hook-delete-policy": before-hook-creation
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
template:
{{- if or .Values.global.podLabels .Values.datahubUpgrade.podAnnotations}}
Expand Down Expand Up @@ -51,9 +49,9 @@ spec:
restartPolicy: Never
securityContext:
{{- toYaml .Values.datahubUpgrade.podSecurityContext | nindent 8 }}
initContainers:
{{- with .Values.datahubUpgrade.extraInitContainers }}
{{- toYaml . | nindent 12 }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: datahub-upgrade-job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ metadata:
name: {{ .Release.Name }}-datahub-system-update-job
labels:
{{- include "datahub.labels" . | nindent 4 }}
{{- with .Values.datahubSystemUpdate.annotations }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-4"
"helm.sh/hook-delete-policy": before-hook-creation
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
template:
{{- if or .Values.global.podLabels .Values.datahubSystemUpdate.podAnnotations}}
Expand Down Expand Up @@ -51,9 +49,9 @@ spec:
restartPolicy: Never
securityContext:
{{- toYaml .Values.datahubSystemUpdate.podSecurityContext | nindent 8 }}
initContainers:
{{- with .Values.datahubSystemUpdate.extraInitContainers }}
{{- toYaml . | nindent 12 }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: datahub-system-update-job
Expand Down
12 changes: 7 additions & 5 deletions charts/datahub/templates/elasticsearch-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ metadata:
name: {{ .Release.Name }}-elasticsearch-setup-job
labels:
{{- include "datahub.labels" . | nindent 4 }}
{{- with .Values.elasticsearchSetupJob.annotations }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
template:
{{- if or .Values.global.podLabels .Values.elasticsearchSetupJob.podAnnotations }}
Expand Down Expand Up @@ -45,6 +43,10 @@ spec:
restartPolicy: Never
securityContext:
{{- toYaml .Values.elasticsearchSetupJob.podSecurityContext | nindent 8 }}
{{- with .Values.elasticsearchSetupJob.extraInitContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: elasticsearch-setup-job
image: "{{ .Values.elasticsearchSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.elasticsearchSetupJob.image.tag | default .Values.global.datahub.version) }}"
Expand Down
12 changes: 7 additions & 5 deletions charts/datahub/templates/kafka-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ metadata:
name: {{ .Release.Name }}-kafka-setup-job
labels:
{{- include "datahub.labels" . | nindent 4 }}
{{- with .Values.kafkaSetupJob.annotations }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
template:
{{- if or .Values.global.podLabels .Values.kafkaSetupJob.podAnnotations }}
Expand Down Expand Up @@ -51,6 +49,10 @@ spec:
{{- with .Values.kafkaSetupJob.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.kafkaSetupJob.extraInitContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: kafka-setup-job
image: "{{ .Values.kafkaSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.kafkaSetupJob.image.tag | default .Values.global.datahub.version) }}"
Expand Down
12 changes: 7 additions & 5 deletions charts/datahub/templates/mysql-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ metadata:
name: {{ .Release.Name }}-mysql-setup-job
labels:
{{- include "datahub.labels" . | nindent 4 }}
{{- with .Values.mysqlSetupJob.annotations }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
template:
{{- if or .Values.global.podLabels .Values.mysqlSetupJob.podAnnotations }}
Expand Down Expand Up @@ -45,6 +43,10 @@ spec:
restartPolicy: Never
securityContext:
{{- toYaml .Values.mysqlSetupJob.podSecurityContext | nindent 8 }}
{{- with .Values.mysqlSetupJob.extraInitContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: mysql-setup-job
image: "{{ .Values.mysqlSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.mysqlSetupJob.image.tag | default .Values.global.datahub.version) }}"
Expand Down
12 changes: 7 additions & 5 deletions charts/datahub/templates/postgresql-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ metadata:
name: {{ .Release.Name }}-postgresql-setup-job
labels:
{{- include "datahub.labels" . | nindent 4 }}
{{- with .Values.postgresqlSetupJob.annotations }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
template:
{{- if or .Values.global.podLabels .Values.postgresqlSetupJob.podAnnotations }}
Expand Down Expand Up @@ -45,6 +43,10 @@ spec:
restartPolicy: Never
securityContext:
{{- toYaml .Values.postgresqlSetupJob.podSecurityContext | nindent 8 }}
{{- with .Values.postgresqlSetupJob.extraInitContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: postgresql-setup-job
image: "{{ .Values.postgresqlSetupJob.image.repository }}:{{ required "Global or specific tag is required" (.Values.postgresqlSetupJob.image.tag | default .Values.global.datahub.version) }}"
Expand Down
44 changes: 44 additions & 0 deletions charts/datahub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,17 @@ elasticsearchSetupJob:
requests:
cpu: 300m
memory: 256Mi
extraInitContainers: []
podSecurityContext:
fsGroup: 1000
securityContext:
runAsUser: 1000
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-weight: "-5"
helm.sh/hook-delete-policy: before-hook-creation
podAnnotations: {}
# Add extra sidecar containers to job pod
extraSidecars: []
Expand All @@ -119,10 +126,17 @@ kafkaSetupJob:
requests:
cpu: 300m
memory: 768Mi
extraInitContainers: []
podSecurityContext:
fsGroup: 1000
securityContext:
runAsUser: 1000
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-weight: "-5"
helm.sh/hook-delete-policy: before-hook-creation
podAnnotations: {}
# Add extra sidecar containers to job pod
extraSidecars: []
Expand All @@ -142,10 +156,17 @@ mysqlSetupJob:
requests:
cpu: 300m
memory: 256Mi
extraInitContainers: []
podSecurityContext:
fsGroup: 1000
securityContext:
runAsUser: 1000
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-weight: "-5"
helm.sh/hook-delete-policy: before-hook-creation
podAnnotations: {}
# Optionally set a set-up job specific login (defaults to global login)
# username: "mysqlSetupJob-login"
Expand All @@ -170,10 +191,17 @@ postgresqlSetupJob:
requests:
cpu: 300m
memory: 256Mi
extraInitContainers: []
podSecurityContext:
fsGroup: 1000
securityContext:
runAsUser: 1000
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-weight: "-5"
helm.sh/hook-delete-policy: before-hook-creation
podAnnotations: {}
# Optionally set a set-up job specific login (defaults to global login)
# username: "postgresqlSetupJob-login"
Expand Down Expand Up @@ -205,6 +233,12 @@ datahubUpgrade:
# fsGroup: 1000
securityContext: {}
# runAsUser: 1000
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
helm.sh/hook-delete-policy: before-hook-creation
podAnnotations: {}
# Add extra sidecar containers to job pod
extraSidecars: []
Expand Down Expand Up @@ -241,6 +275,7 @@ datahubUpgrade:
# extraEnvs:
# - name: "DATAHUB_DB_NAME"
# value: "dh"
extraInitContainers: []

## Runs system update processes
## Includes: Elasticsearch Indices Creation/Reindex (See global.elasticsearch.index for additional configuration)
Expand All @@ -252,6 +287,12 @@ datahubSystemUpdate:
# fsGroup: 1000
securityContext: {}
# runAsUser: 1000
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-weight: "-4"
helm.sh/hook-delete-policy: before-hook-creation
podAnnotations: {}
resources:
limits:
Expand All @@ -265,6 +306,7 @@ datahubSystemUpdate:
# - name: my-image-name
# image: my-image
# imagePullPolicy: Always
extraInitContainers: []

global:
strict_mode: true
Expand Down Expand Up @@ -537,6 +579,7 @@ global:
provisionSecret:
enabled: true
autoGenerate: true
annotations: {}
# Only specify if autoGenerate set to false
# secretValues:
# encryptionKey: <encryption key value>
Expand All @@ -562,6 +605,7 @@ global:
provisionSecrets:
enabled: true
autoGenerate: true
annotations: {}
# Only specify if autoGenerate set to false
# secretValues:
# secret: <secret value>
Expand Down