Skip to content

Commit

Permalink
Add Post Install Job which waits for cluster to be ready (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Jan 27, 2022
1 parent 3b571d9 commit 3c50445
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
31 changes: 31 additions & 0 deletions charts/atlas-cluster/templates/atlas-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,35 @@ spec:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

{{- if $.Values.postInstallHook.enabled }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .name | quote }}
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
spec:
template:
metadata:
name: {{ .name | quote }}
labels:
app.kubernetes.io/managed-by: {{ .name | quote }}
app.kubernetes.io/instance: {{ .name | quote }}
spec:
serviceAccountName: mongodb-atlas-operator
restartPolicy: Never
containers:
- name: post-install-job
imagePullPolicy: Always
image: "{{ $.Values.postInstallHook.registry }}/{{ $.Values.postInstallHook.image }}:{{ $.Values.postInstallHook.version }}"
env:
- name: "CLUSTER_NAME"
value: "{{ .name }}"
- name: "NAMESPACE"
value: "{{ $.Release.Namespace }}"
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/atlas-cluster/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
mongodb-atlas-operator:
enabled: true

postInstallHook:
version: 1.0.0
registry: quay.io/mongodb
image: atlas-operator-post-install-hook
# enabled "true" will create a post install job which waits for the created
# resources to reach the ready state.
enabled: false

# Please provide Atlas API credentials and Organization
atlas:
create: true
Expand Down

0 comments on commit 3c50445

Please sign in to comment.