From f645b7f17b5751f37cbfdbae7c7dc59b474adab7 Mon Sep 17 00:00:00 2001 From: Mahendra Raghuwanshi Date: Wed, 20 Mar 2019 06:36:19 +0000 Subject: AAI Rolling upgrade using helm hooks Change-Id: I81b8c7069e374e2ee789f6dd99e6cb55d98e5d28 Issue-ID: OOM-1676 Signed-off-by: Mahendra Raghuwanshi --- .../resources/config/janusgraph-cached.properties | 8 +-- .../config/janusgraph-realtime.properties | 8 +-- .../charts/aai-traversal/templates/configmap.yaml | 74 +--------------------- .../charts/aai-traversal/templates/deployment.yaml | 47 ++++++-------- .../aai/charts/aai-traversal/templates/job.yaml | 40 ++++-------- 5 files changed, 38 insertions(+), 139 deletions(-) (limited to 'kubernetes/aai/charts/aai-traversal') diff --git a/kubernetes/aai/charts/aai-traversal/resources/config/janusgraph-cached.properties b/kubernetes/aai/charts/aai-traversal/resources/config/janusgraph-cached.properties index 2c22d14a41..9dc66368ce 100644 --- a/kubernetes/aai/charts/aai-traversal/resources/config/janusgraph-cached.properties +++ b/kubernetes/aai/charts/aai-traversal/resources/config/janusgraph-cached.properties @@ -25,17 +25,13 @@ query.smart-limit=false {{ if .Values.global.config.cluster.cassandra.dynamic }} -{{- $seed_size := default 1 .Values.global.cassandra.replicas | int -}} -{{- $global := . }} - storage.backend=cassandra -storage.hostname={{- range $i, $e := until $seed_size }}{{ $global.Release.Name }}-{{$global.Values.global.cassandra.serviceName}}-{{ $i }}.{{$global.Values.global.cassandra.serviceName}},{{- end }} - +storage.hostname={{.Values.global.cassandra.serviceName}} storage.cassandra.keyspace=aaigraph storage.cassandra.read-consistency-level=LOCAL_QUORUM storage.cassandra.write-consistency-level=LOCAL_QUORUM -storage.cassandra.replication-factor=3 +storage.cassandra.replication-factor={{.Values.global.cassandra.replicas}} storage.cassandra.replication-strategy-class=org.apache.cassandra.locator.SimpleStrategy {{ else }} diff --git a/kubernetes/aai/charts/aai-traversal/resources/config/janusgraph-realtime.properties b/kubernetes/aai/charts/aai-traversal/resources/config/janusgraph-realtime.properties index b19c9b6df6..8791a0bd7e 100644 --- a/kubernetes/aai/charts/aai-traversal/resources/config/janusgraph-realtime.properties +++ b/kubernetes/aai/charts/aai-traversal/resources/config/janusgraph-realtime.properties @@ -23,17 +23,13 @@ query.smart-limit=false {{ if .Values.global.config.cluster.cassandra.dynamic }} -{{- $seed_size := default 1 .Values.global.cassandra.replicas | int -}} -{{- $global := . }} - storage.backend=cassandra -storage.hostname={{- range $i, $e := until $seed_size }}{{ $global.Release.Name }}-{{$global.Values.global.cassandra.serviceName}}-{{ $i }}.{{$global.Values.global.cassandra.serviceName}},{{- end }} - +storage.hostname={{.Values.global.cassandra.serviceName}} storage.cassandra.keyspace=aaigraph storage.cassandra.read-consistency-level=LOCAL_QUORUM storage.cassandra.write-consistency-level=LOCAL_QUORUM -storage.cassandra.replication-factor=3 +storage.cassandra.replication-factor={{.Values.global.cassandra.replicas}} storage.cassandra.replication-strategy-class=org.apache.cassandra.locator.SimpleStrategy {{ else }} diff --git a/kubernetes/aai/charts/aai-traversal/templates/configmap.yaml b/kubernetes/aai/charts/aai-traversal/templates/configmap.yaml index 106031edbc..1a92199d49 100644 --- a/kubernetes/aai/charts/aai-traversal/templates/configmap.yaml +++ b/kubernetes/aai/charts/aai-traversal/templates/configmap.yaml @@ -15,7 +15,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "common.fullname" . }}-log + name: {{ include "common.fullname" . }}-configmap namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.name" . }} @@ -24,83 +24,11 @@ metadata: heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/logback.xml").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-localhost-access-log-configmap - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -data: {{ tpl (.Files.Glob "resources/config/localhost-access-logback.xml").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-db-real-configmap - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -data: {{ tpl (.Files.Glob "resources/config/janusgraph-realtime.properties").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-db-cached-configmap - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -data: {{ tpl (.Files.Glob "resources/config/janusgraph-cached.properties").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-aaiconfig-configmap - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -data: {{ tpl (.Files.Glob "resources/config/aaiconfig.properties").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-springapp-configmap - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -data: {{ tpl (.Files.Glob "resources/config/application.properties").AsConfig . | indent 2 }} ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-realm-configmap - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -data: {{ tpl (.Files.Glob "resources/config/realm.properties").AsConfig . | indent 2 }} --- apiVersion: v1 diff --git a/kubernetes/aai/charts/aai-traversal/templates/deployment.yaml b/kubernetes/aai/charts/aai-traversal/templates/deployment.yaml index be4b863195..b94389f068 100644 --- a/kubernetes/aai/charts/aai-traversal/templates/deployment.yaml +++ b/kubernetes/aai/charts/aai-traversal/templates/deployment.yaml @@ -440,7 +440,12 @@ spec: {{ if .Values.global.initContainers.enabled }} initContainers: - command: - {{ if .Values.global.jobs.createSchema.enabled }} + {{ if .Values.global.jobs.migration.enabled }} + - /root/job_complete.py + args: + - --job-name + - {{ .Release.Name }}-aai-graphadmin-migration + {{ else if .Values.global.jobs.createSchema.enabled }} - /root/job_complete.py args: - --job-name @@ -449,7 +454,11 @@ spec: - /root/ready.py args: - --container-name + {{- if .Values.global.cassandra.localCluster }} - aai-cassandra + {{- else }} + - cassandra + {{- end }} - --container-name - aai-schema-service {{ end }} @@ -479,24 +488,24 @@ spec: name: localtime readOnly: true - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties - name: {{ include "common.fullname" . }}-db-real-conf + name: {{ include "common.fullname" . }}-config subPath: janusgraph-realtime.properties - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties - name: {{ include "common.fullname" . }}-db-cached-conf + name: {{ include "common.fullname" . }}-config subPath: janusgraph-cached.properties - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties - name: {{ include "common.fullname" . }}-aaiconfig-conf + name: {{ include "common.fullname" . }}-config subPath: aaiconfig.properties - mountPath: /opt/aai/logroot/AAI-GQ name: {{ include "common.fullname" . }}-logs - mountPath: /opt/app/aai-traversal/resources/logback.xml - name: {{ include "common.fullname" . }}-log-conf + name: {{ include "common.fullname" . }}-config subPath: logback.xml - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml - name: {{ include "common.fullname" . }}-localhost-access-log-conf + name: {{ include "common.fullname" . }}-config subPath: localhost-access-logback.xml - mountPath: /opt/app/aai-traversal/resources/etc/auth/realm.properties - name: {{ include "common.fullname" . }}-realm-conf + name: {{ include "common.fullname" . }}-config subPath: realm.properties - mountPath: /opt/app/aai-traversal/resources/aaf/org.onap.aai.keyfile name: {{ include "common.fullname" . }}-aaf-certs @@ -523,7 +532,7 @@ spec: name: aai-common-aai-auth-mount subPath: truststoreONAPall.jks - mountPath: /opt/app/aai-traversal/resources/application.properties - name: {{ include "common.fullname" . }}-springapp-conf + name: {{ include "common.fullname" . }}-config subPath: application.properties {{ $global := . }} {{ range $job := .Values.global.config.auth.files }} @@ -584,21 +593,9 @@ spec: emptyDir: {} - name: {{ include "common.fullname" . }}-filebeat emptyDir: {} - - name: {{ include "common.fullname" . }}-log-conf - configMap: - name: {{ include "common.fullname" . }}-log - - name: {{ include "common.fullname" . }}-localhost-access-log-conf - configMap: - name: {{ include "common.fullname" . }}-localhost-access-log-configmap - - name: {{ include "common.fullname" . }}-db-real-conf + - name: {{ include "common.fullname" . }}-config configMap: - name: {{ include "common.fullname" . }}-db-real-configmap - - name: {{ include "common.fullname" . }}-db-cached-conf - configMap: - name: {{ include "common.fullname" . }}-db-cached-configmap - - name: {{ include "common.fullname" . }}-aaiconfig-conf - configMap: - name: {{ include "common.fullname" . }}-aaiconfig-configmap + name: {{ include "common.fullname" . }}-configmap - name: {{ include "common.fullname" . }}-aaf-properties configMap: name: {{ include "common.fullname" . }}-aaf-props @@ -608,12 +605,6 @@ spec: - name: aai-common-aai-auth-mount secret: secretName: aai-common-aai-auth - - name: {{ include "common.fullname" . }}-springapp-conf - configMap: - name: {{ include "common.fullname" . }}-springapp-configmap - - name: {{ include "common.fullname" . }}-realm-conf - configMap: - name: {{ include "common.fullname" . }}-realm-configmap - name: {{ include "common.fullname" . }}-auth-truststore-sec secret: secretName: aai-common-truststore diff --git a/kubernetes/aai/charts/aai-traversal/templates/job.yaml b/kubernetes/aai/charts/aai-traversal/templates/job.yaml index a746f54470..31db068ae8 100644 --- a/kubernetes/aai/charts/aai-traversal/templates/job.yaml +++ b/kubernetes/aai/charts/aai-traversal/templates/job.yaml @@ -25,6 +25,12 @@ metadata: chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} +{{ if .Values.global.jobs.migration.enabled }} + annotations: + "helm.sh/hook": post-upgrade,post-rollback,post-install + "helm.sh/hook-weight": "2" + "helm.sh/hook-delete-policy": before-hook-creation +{{ end }} spec: template: metadata: @@ -74,24 +80,24 @@ spec: name: localtime readOnly: true - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties - name: {{ include "common.fullname" . }}-db-real-conf + name: {{ include "common.fullname" . }}-config subPath: janusgraph-realtime.properties - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties - name: {{ include "common.fullname" . }}-db-cached-conf + name: {{ include "common.fullname" . }}-config subPath: janusgraph-cached.properties - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties - name: {{ include "common.fullname" . }}-aaiconfig-conf + name: {{ include "common.fullname" . }}-config subPath: aaiconfig.properties - mountPath: /opt/aai/logroot/AAI-GQ/ name: {{ include "common.fullname" . }}-logs - mountPath: /opt/app/aai-traversal/resources/logback.xml - name: {{ include "common.fullname" . }}-log-conf + name: {{ include "common.fullname" . }}-config subPath: logback.xml - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml - name: {{ include "common.fullname" . }}-localhost-access-log-conf + name: {{ include "common.fullname" . }}-config subPath: localhost-access-logback.xml - mountPath: /opt/app/aai-traversal/resources/application.properties - name: {{ include "common.fullname" . }}-springapp-conf + name: {{ include "common.fullname" . }}-config subPath: application.properties {{ $global := . }} {{ range $job := .Values.global.config.auth.files }} @@ -113,27 +119,9 @@ spec: path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}-update-query - name: {{ include "common.fullname" . }}-filebeat emptyDir: {} - - name: {{ include "common.fullname" . }}-log-conf - configMap: - name: {{ include "common.fullname" . }}-log - - name: {{ include "common.fullname" . }}-localhost-access-log-conf - configMap: - name: {{ include "common.fullname" . }}-localhost-access-log-configmap - - name: {{ include "common.fullname" . }}-db-real-conf - configMap: - name: {{ include "common.fullname" . }}-db-real-configmap - - name: {{ include "common.fullname" . }}-db-cached-conf - configMap: - name: {{ include "common.fullname" . }}-db-cached-configmap - - name: {{ include "common.fullname" . }}-aaiconfig-conf - configMap: - name: {{ include "common.fullname" . }}-aaiconfig-configmap - - name: {{ include "common.fullname" . }}-springapp-conf - configMap: - name: {{ include "common.fullname" . }}-springapp-configmap - - name: {{ include "common.fullname" . }}-realm-conf + - name: {{ include "common.fullname" . }}-config configMap: - name: {{ include "common.fullname" . }}-realm-configmap + name: {{ include "common.fullname" . }}-configmap - name: {{ include "common.fullname" . }}-auth-truststore-sec secret: secretName: aai-common-truststore -- cgit 1.2.3-korg