aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/aai/components/aai-graphadmin/templates
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/aai/components/aai-graphadmin/templates')
-rw-r--r--kubernetes/aai/components/aai-graphadmin/templates/_helpers.tpl42
-rw-r--r--kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml59
-rw-r--r--kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml5
3 files changed, 103 insertions, 3 deletions
diff --git a/kubernetes/aai/components/aai-graphadmin/templates/_helpers.tpl b/kubernetes/aai/components/aai-graphadmin/templates/_helpers.tpl
new file mode 100644
index 0000000000..a6c414517b
--- /dev/null
+++ b/kubernetes/aai/components/aai-graphadmin/templates/_helpers.tpl
@@ -0,0 +1,42 @@
+{{- 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 -}}
+
+{{- define "aai.waitForSchemaService" -}}
+- name: wait-for-schema-service
+ image: "{{ include "repositoryGenerator.image.curl" . }}"
+ imagePullPolicy: IfNotPresent
+ command: ["/bin/sh", "-c"]
+ args:
+ - |
+ URL="{{ required "URL is required" (.Values.schemaInitCheckURL | default "http://aai-schema-service:8452/aai/schema-service/util/echo") }}"
+ 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
+ if curl --fail --header 'X-FromAppId: graphadmin' --header 'X-TransactionId: someTransaction' -u $AUTH -s $URL; then
+ echo "Request successful. Schema-service is available"
+ exit 0
+ else
+ echo "Request unsuccessful. Schema-service is not available yet. Retrying in 3 seconds..."
+ sleep 3
+ fi
+ done
+ {{ include "common.containerSecurityContext" . | indent 2 | trim }}
+{{- end -}}
diff --git a/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml b/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml
index 31566fc939..92fea15055 100644
--- a/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml
+++ b/kubernetes/aai/components/aai-graphadmin/templates/deployment.yaml
@@ -47,7 +47,64 @@ spec:
terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
{{- if .Values.global.initContainers.enabled }}
initContainers:
- {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.waitForWithCreateSchemaDisabled ) | indent 6 | trim }}
+ {{- if not .Values.createDbSchemaViaJob.enabled }}
+ {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.waitForCassandraService ) | indent 8 | trim }}
+ - name: {{ include "common.name" . }}-create-db-schema
+ image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
+ imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+ {{ include "common.containerSecurityContext" . | nindent 10 | trim }}
+ command:
+ - sh
+ args:
+ - -c
+ - |
+ {{- if include "common.onServiceMesh" . }}
+ echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }}
+ sh docker-entrypoint.sh createDBSchema.sh;
+ {{ include "common.serviceMesh.killSidecar" . | indent 11 | trim }}
+ env:
+ {{- if .Values.config.debug.enabled }}
+ - name: JVM_OPTS
+ value: {{ .Values.config.debug.args | quote }}
+ {{- end }}
+ {{- if .Values.config.env }}
+ {{- range $key,$value := .Values.config.env }}
+ - name: {{ $key | upper | quote}}
+ value: {{ $value | quote}}
+ {{- end }}
+ {{- end }}
+ - name: BOOTSTRAP_SERVERS
+ value: {{ include "common.release" . }}-strimzi-kafka-bootstrap:9092
+ - name: JAAS_CONFIG
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "common.release" . }}-{{ .Values.global.aaiGraphKafkaUser }}
+ key: sasl.jaas.config
+ {{- if .Values.config.debug.enabled }}
+ ports:
+ - containerPort: {{ .Values.service.debugPort }}
+ name: {{ .Values.service.debugPortName }}
+ {{- end }}
+ volumeMounts:
+ - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
+ name: config
+ subPath: janusgraph-realtime.properties
+ - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
+ name: properties
+ subPath: aaiconfig.properties
+ - mountPath: /opt/aai/logroot/AAI-GA
+ name: logs
+ - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
+ name: config
+ subPath: logback.xml
+ - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
+ name: config
+ subPath: localhost-access-logback.xml
+ - mountPath: /opt/app/aai-graphadmin/resources/application.properties
+ name: properties
+ subPath: application.properties
+ resources: {{ include "common.resources" . | nindent 12 }}
+ {{- end }}
{{- end }}
{{ include "common.podSecurityContext" . | indent 6 | trim }}
containers:
diff --git a/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml b/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml
index 6c57680724..fc35966f79 100644
--- a/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml
+++ b/kubernetes/aai/components/aai-graphadmin/templates/job-create-db.yaml
@@ -34,6 +34,8 @@
# then it is your job to ensure that there are no connections to the database
*/}}
+{{/* the new default is schema creation via graphadmin init container. This will be removed in the future. */}}
+{{- if .Values.createDbSchemaViaJob.enabled }}
{{- if and ( not .Values.global.jobs.migration.enabled ) ( .Values.global.jobs.createSchema.enabled ) }}
apiVersion: batch/v1
kind: Job
@@ -51,8 +53,6 @@ spec:
labels: {{- include "common.labels" (dict "labels" .Values.labels "ignoreHelmChart" .Values.ignoreHelmChart "dot" . "suffix" "job") | nindent 8 }}
name: {{ include "common.name" . }}
spec:
- initContainers:
- {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.waitForWithCreateSchemaDisabled) | indent 6 | trim }}
{{ include "common.podSecurityContext" . | indent 6 | trim }}
containers:
- name: {{ include "common.name" . }}-job
@@ -129,3 +129,4 @@ spec:
restartPolicy: Never
{{- include "common.imagePullSecrets" . | nindent 6 }}
{{- end }}
+{{- end }}