aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/aai/components/aai-traversal/templates/_helpers.tpl
blob: 003be58409eb3bed9bd2ac5ff35fde40c61e18ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{{- define "aai.waitForSchemaCreation" -}}
- name: wait-for-schema-creation
  image: "{{ include "repositoryGenerator.image.curl" . }}"
  imagePullPolicy: IfNotPresent
  command: ["/bin/sh", "-c"]
  args:
    - |
      URL="{{ required "URL is required" (.Values.schemaInitCheckURL | default "http://aai-graphadmin:8449/isSchemaInitialized") }}"
      AUTH="{{ printf "%s:%s" (index .Values.global.config.basic.auth.users 0).username (index .Values.global.config.basic.auth.users 0).password }}"
      while true; do
        RESPONSE=$(curl -u $AUTH -s $URL)
        if [ "$RESPONSE" = "true" ]; then
          echo "Request successful. Schema is initialized."
          exit 0
        else
          echo "Request unsuccessful. Schema is not yet initialized. Retrying in 3 seconds..."
          sleep 3
        fi
      done
  {{ include "common.containerSecurityContext" . | indent 2 | trim }}
{{- end -}}