Loading deploy/kubernetes/chart/templates/_helpers.tpl +12 −2 Original line number Diff line number Diff line Loading @@ -48,6 +48,16 @@ app.kubernetes.io/component: {{ index . 1 }} Produces an image specification. */}} {{- define "esgf.component.image" -}} image: {{ printf "%s/%s:%s" .prefix .repository .tag }} imagePullPolicy: {{ .pullPolicy }} {{- $context := index . 0 -}} {{- $component := index . 1 -}} {{- $image := mergeOverwrite $context.Values.image $component.image -}} image: {{ printf "%s/%s:%s" $image.prefix $image.repository $image.tag }} imagePullPolicy: {{ $image.pullPolicy }} {{- end -}} {{/* Produces an image specification with the correct nesting for use in deployments. */}} {{- define "esgf.deployment.image" -}} {{- include "esgf.component.image" . | indent 10 | trim -}} {{- end -}} deploy/kubernetes/chart/templates/config/configmap.yaml 0 → 100644 +28 −0 Original line number Diff line number Diff line apiVersion: v1 kind: ConfigMap metadata: name: {{ include "esgf.component.fullname" (list . "config") }} labels: {{ include "esgf.component.labels" (list . "config") | nindent 4 }} data: esgf.properties: |- [installer.properties] esgf.host={{ .Values.hostname }} {{- if .Values.idp.enabled }} esgf.idp.peer={{ .Values.hostname }} {{- end }} {{/* esgf.index.peer={{ include "esgf" . }} */}} db.protocol=jdbc:postgresql: db.driver=org.postgresql.Driver db.host={{ include "esgf.database.host" . }} db.port={{ include "esgf.database.port" . }} db.user={{ include "esgf.database.user" . }} db.database={{ include "esgf.database.dbname" . }} {{- if .Values.idp.enabled }} idp.service.endpoint={{ include "esgf.idp.endpoint.openid" . }} idp.security.attribute.service.endpoint={{ include "esgf.idp.endpoint.attributeService" . }} idp.security.registration.service.endpoint={{ include "esgf.idp.endpoint.registrationService" . }} {{- end }} {{/* gridftp.server.port={{ gridftp.port }} */}} deploy/kubernetes/chart/templates/config/secret.yaml 0 → 100644 +8 −0 Original line number Diff line number Diff line apiVersion: v1 kind: Secret metadata: name: {{ include "esgf.component.fullname" (list . "config") }} labels: {{ include "esgf.component.labels" (list . "config") | nindent 4 }} type: Opaque data: .esg_pg_pass: {{ include "esgf.database.password" . | b64enc | quote }} deploy/kubernetes/chart/templates/database/_helpers.tpl +2 −14 Original line number Diff line number Diff line {{/* Templates for connecting to databases. */}} {{- define "esgf.database.host" -}} {{- if eq .Values.database.type "internal" -}} {{- template "esgf.component.fullname" (list . "database") -}} Loading Loading @@ -34,18 +30,10 @@ Templates for connecting to databases. {{- end -}} {{- end -}} {{- define "esgf.database.securityDatabase" -}} {{- if eq .Values.database.type "internal" -}} {{- printf "%s" "esgcet" -}} {{- else -}} {{- .Values.database.external.securityDatabase | required "Specify an external security database name" -}} {{- end -}} {{- end -}} {{- define "esgf.database.slcsDatabase" -}} {{- define "esgf.database.dbname" -}} {{- if eq .Values.database.type "internal" -}} {{- printf "%s" "esgcet" -}} {{- else -}} {{- .Values.database.external.slcsDatabase | required "Specify an external SLCS database name" -}} {{- .Values.database.external.dbname | required "Specify an external database name" -}} {{- end -}} {{- end -}} deploy/kubernetes/chart/templates/database/deployment.yaml +10 −10 Original line number Diff line number Diff line Loading @@ -6,7 +6,10 @@ metadata: name: {{ include "esgf.component.fullname" (list . "database") }} labels: {{ include "esgf.component.labels" (list . "database") | nindent 4 }} spec: # Use one replica only, and make sure that old containers are destroyed first replicas: 1 strategy: type: Recreate selector: matchLabels: {{ include "esgf.component.selectorLabels" (list . "database") | nindent 6 }} template: Loading @@ -15,21 +18,18 @@ spec: # Force deployments to roll if the secret changes # https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments annotations: checksum/secret: {{ include (print $.Template.BasePath "/database/secret.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/config/secret.yaml") . | sha256sum }} spec: {{- with (default .Values.image.pullSecrets $database.image.pullSecrets) }} imagePullSecrets: {{ toYaml . | nindent 8 }} {{- end }} securityContext: # This is the gid of the esg group in the container # This is the gid of the esgf group in the container # Setting this allows many providers to chown dynamic volumes fsGroup: 1000 containers: - name: database {{- with $database.securityContext }} securityContext: {{ toYaml . | nindent 12 }} {{- end }} {{ include "esgf.component.image" (mergeOverwrite .Values.image $database.image) | indent 10 | trim }} {{ include "esgf.deployment.image" (list . $database) }} resources: {{ toYaml $database.resources | nindent 12 }} ports: - name: postgres Loading @@ -48,14 +48,14 @@ spec: initialDelaySeconds: 120 env: - name: POSTGRES_DATABASE value: esgcet value: {{ include "esgf.database.dbname" . }} - name: POSTGRES_USER value: dbsuper value: {{ include "esgf.database.user" . }} - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: {{ include "esgf.component.fullname" (list . "database") }} key: "database-password" name: {{ include "esgf.component.fullname" (list . "config") }} key: .esg_pg_pass volumeMounts: - name: postgres-data mountPath: /var/lib/pgsql Loading Loading
deploy/kubernetes/chart/templates/_helpers.tpl +12 −2 Original line number Diff line number Diff line Loading @@ -48,6 +48,16 @@ app.kubernetes.io/component: {{ index . 1 }} Produces an image specification. */}} {{- define "esgf.component.image" -}} image: {{ printf "%s/%s:%s" .prefix .repository .tag }} imagePullPolicy: {{ .pullPolicy }} {{- $context := index . 0 -}} {{- $component := index . 1 -}} {{- $image := mergeOverwrite $context.Values.image $component.image -}} image: {{ printf "%s/%s:%s" $image.prefix $image.repository $image.tag }} imagePullPolicy: {{ $image.pullPolicy }} {{- end -}} {{/* Produces an image specification with the correct nesting for use in deployments. */}} {{- define "esgf.deployment.image" -}} {{- include "esgf.component.image" . | indent 10 | trim -}} {{- end -}}
deploy/kubernetes/chart/templates/config/configmap.yaml 0 → 100644 +28 −0 Original line number Diff line number Diff line apiVersion: v1 kind: ConfigMap metadata: name: {{ include "esgf.component.fullname" (list . "config") }} labels: {{ include "esgf.component.labels" (list . "config") | nindent 4 }} data: esgf.properties: |- [installer.properties] esgf.host={{ .Values.hostname }} {{- if .Values.idp.enabled }} esgf.idp.peer={{ .Values.hostname }} {{- end }} {{/* esgf.index.peer={{ include "esgf" . }} */}} db.protocol=jdbc:postgresql: db.driver=org.postgresql.Driver db.host={{ include "esgf.database.host" . }} db.port={{ include "esgf.database.port" . }} db.user={{ include "esgf.database.user" . }} db.database={{ include "esgf.database.dbname" . }} {{- if .Values.idp.enabled }} idp.service.endpoint={{ include "esgf.idp.endpoint.openid" . }} idp.security.attribute.service.endpoint={{ include "esgf.idp.endpoint.attributeService" . }} idp.security.registration.service.endpoint={{ include "esgf.idp.endpoint.registrationService" . }} {{- end }} {{/* gridftp.server.port={{ gridftp.port }} */}}
deploy/kubernetes/chart/templates/config/secret.yaml 0 → 100644 +8 −0 Original line number Diff line number Diff line apiVersion: v1 kind: Secret metadata: name: {{ include "esgf.component.fullname" (list . "config") }} labels: {{ include "esgf.component.labels" (list . "config") | nindent 4 }} type: Opaque data: .esg_pg_pass: {{ include "esgf.database.password" . | b64enc | quote }}
deploy/kubernetes/chart/templates/database/_helpers.tpl +2 −14 Original line number Diff line number Diff line {{/* Templates for connecting to databases. */}} {{- define "esgf.database.host" -}} {{- if eq .Values.database.type "internal" -}} {{- template "esgf.component.fullname" (list . "database") -}} Loading Loading @@ -34,18 +30,10 @@ Templates for connecting to databases. {{- end -}} {{- end -}} {{- define "esgf.database.securityDatabase" -}} {{- if eq .Values.database.type "internal" -}} {{- printf "%s" "esgcet" -}} {{- else -}} {{- .Values.database.external.securityDatabase | required "Specify an external security database name" -}} {{- end -}} {{- end -}} {{- define "esgf.database.slcsDatabase" -}} {{- define "esgf.database.dbname" -}} {{- if eq .Values.database.type "internal" -}} {{- printf "%s" "esgcet" -}} {{- else -}} {{- .Values.database.external.slcsDatabase | required "Specify an external SLCS database name" -}} {{- .Values.database.external.dbname | required "Specify an external database name" -}} {{- end -}} {{- end -}}
deploy/kubernetes/chart/templates/database/deployment.yaml +10 −10 Original line number Diff line number Diff line Loading @@ -6,7 +6,10 @@ metadata: name: {{ include "esgf.component.fullname" (list . "database") }} labels: {{ include "esgf.component.labels" (list . "database") | nindent 4 }} spec: # Use one replica only, and make sure that old containers are destroyed first replicas: 1 strategy: type: Recreate selector: matchLabels: {{ include "esgf.component.selectorLabels" (list . "database") | nindent 6 }} template: Loading @@ -15,21 +18,18 @@ spec: # Force deployments to roll if the secret changes # https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments annotations: checksum/secret: {{ include (print $.Template.BasePath "/database/secret.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/config/secret.yaml") . | sha256sum }} spec: {{- with (default .Values.image.pullSecrets $database.image.pullSecrets) }} imagePullSecrets: {{ toYaml . | nindent 8 }} {{- end }} securityContext: # This is the gid of the esg group in the container # This is the gid of the esgf group in the container # Setting this allows many providers to chown dynamic volumes fsGroup: 1000 containers: - name: database {{- with $database.securityContext }} securityContext: {{ toYaml . | nindent 12 }} {{- end }} {{ include "esgf.component.image" (mergeOverwrite .Values.image $database.image) | indent 10 | trim }} {{ include "esgf.deployment.image" (list . $database) }} resources: {{ toYaml $database.resources | nindent 12 }} ports: - name: postgres Loading @@ -48,14 +48,14 @@ spec: initialDelaySeconds: 120 env: - name: POSTGRES_DATABASE value: esgcet value: {{ include "esgf.database.dbname" . }} - name: POSTGRES_USER value: dbsuper value: {{ include "esgf.database.user" . }} - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: {{ include "esgf.component.fullname" (list . "database") }} key: "database-password" name: {{ include "esgf.component.fullname" (list . "config") }} key: .esg_pg_pass volumeMounts: - name: postgres-data mountPath: /var/lib/pgsql Loading