post-install-job.yaml 2.1 KB
Newer Older
Daniel Scholl's avatar
Daniel Scholl committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
apiVersion: batch/v1
kind: Job
metadata:
  name: "{{ .Release.Name }}-setup-default-user"
  labels:
    app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
    app.kubernetes.io/instance: {{ .Release.Name | quote }}
    app.kubernetes.io/version: {{ .Chart.AppVersion }}
  annotations:
    "helm.sh/hook": post-install
    "helm.sh/hook-weight": "-5"
    "helm.sh/hook-delete-policy": hook-succeeded
spec:
  template:
    metadata:
      name: "{{ .Release.Name }}"
      labels:
        app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
        app.kubernetes.io/instance: {{ .Release.Name | quote }}
        helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
        aadpodidbinding: "osdu-identity"
    spec:
      restartPolicy: Never
      containers:
      - name: post-install-job
        image: python:3.6.12-slim-buster
        command: ['sh','-c','pip install --user -r /post-install-scripts/requirements.txt && python /post-install-scripts/create_default_user.py']
        volumeMounts:
        - name: config-volume
          mountPath: /post-install-scripts
        - name: azure-keyvault
          mountPath: "/mnt/azure-keyvault"
          readOnly: true
        env:
        - name: DATABASE_USER
          value: {{ .Values.airflow.externalDatabase.user }}
        - name: DATABASE_HOST
          value: {{ .Values.airflow.externalDatabase.host }}
        - name: DATABASE_DB
          value: {{ .Values.airflow.externalDatabase.database }}
        - name: DATABASE_USER_PASS
          valueFrom:
            secretKeyRef:
              name: postgres
              key: postgres-password
        - name: AIRFLOW_ADMIN
          value: {{ .Values.airflowLogin.name }}
        - name: AIRFLOW_ADMIN_PASS
          valueFrom:
            secretKeyRef:
              name: airflow
52
              key: admin-password
Daniel Scholl's avatar
Daniel Scholl committed
53
54
55
56
57
58
59
60
61
62
      volumes:
      - name: config-volume
        configMap:
          name: post-install-job-config
      - name: azure-keyvault
        csi:
          driver: secrets-store.csi.k8s.io
          readOnly: true
          volumeAttributes:
            secretProviderClass: azure-keyvault