Skip to content

Commit

Permalink
feat(k8s): Add k8s hook in datahub helm chart for setting up elastics…
Browse files Browse the repository at this point in the history
…earch (#2302)
  • Loading branch information
shakti-garg authored Mar 29, 2021
1 parent d158da7 commit 918097c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contrib/kubernetes/datahub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Current chart version is `0.1.1`
| datahub-mce-consumer.image.repository | string | `"linkedin/datahub-mce-consumer"` | |
| datahub-mce-consumer.image.tag | string | `"latest"` | |
| datahub-ingestion-cron.enabled | bool | `false` | |
| elasticsearchInitJob.enabled | bool | `true` | |
| elasticsearchInitJob.image.repository | string | `"linkedin/datahub-elasticsearch-setup"` | |
| elasticsearchInitJob.image.tag | string | `"latest"` | |
| global.datahub.appVersion | string | `"1.0"` | |
| global.datahub.gms.port | string | `"8080"` | |
| global.elasticsearch.host | string | `"elasticsearch"` | |
Expand Down
43 changes: 43 additions & 0 deletions contrib/kubernetes/datahub/templates/elasticsearch-setup-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if .Values.elasticsearchInitJob.enabled -}}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-elasticsearch-init-job
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
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
spec:
template:
spec:
{{- with .Values.global.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
restartPolicy: Never
securityContext:
runAsUser: 1000
fsGroup: 1000
containers:
- name: elasticsearch-init-job
image: "{{ .Values.elasticsearchInitJob.image.repository }}:{{ .Values.elasticsearchInitJob.image.tag }}"
env:
- name: ELASTICSEARCH_HOST
value: {{ .Values.global.elasticsearch.host | quote }}
- name: ELASTICSEARCH_PORT
value: {{ .Values.global.elasticsearch.port | quote }}
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 300m
memory: 256Mi
{{- end -}}
6 changes: 6 additions & 0 deletions contrib/kubernetes/datahub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ datahub-ingestion-cron:
repository: linkedin/datahub-ingestion
tag: "latest"

elasticsearchInitJob:
enabled: true
image:
repository: linkedin/datahub-elasticsearch-setup
tag: "latest"

global:
elasticsearch:
host: "elasticsearch"
Expand Down

0 comments on commit 918097c

Please sign in to comment.