From 83cd44abc593b9fa8cfbddd6f7f14fbc8a926019 Mon Sep 17 00:00:00 2001 From: Rob Kooper Date: Sat, 23 Jul 2022 14:35:34 -0500 Subject: [PATCH] - use new check image to use PG environment variables - add-user and load-db are now jobs, not hooks (prevent timeout issues) --- Chart.yaml | 7 +++---- README.md | 4 ++++ templates/configmap.yaml | 2 +- templates/deployment.yaml | 11 ++++++----- templates/ingress.yaml | 2 +- templates/{hooks => jobs}/add-user.yaml | 21 ++++++++------------- templates/jobs/foo | 0 templates/{hooks => jobs}/load-db.yaml | 17 +++++------------ templates/secrets.yaml | 2 +- templates/service.yaml | 2 +- values.yaml | 2 +- 11 files changed, 31 insertions(+), 39 deletions(-) rename templates/{hooks => jobs}/add-user.yaml (66%) create mode 100644 templates/jobs/foo rename templates/{hooks => jobs}/load-db.yaml (69%) diff --git a/Chart.yaml b/Chart.yaml index 5ccdf541..0d7e1f2d 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -12,7 +12,7 @@ description: > # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.5.1 +version: 0.5.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to @@ -43,6 +43,5 @@ annotations: - name: Helm Chart url: https://github.com/pecanproject/bety-helm artifacthub.io/changes: | - - update README to describe values - - fix left over when initializing from URL - - fix binami url change + - use new check image to use PG environment variables + - add-user and load-db are now jobs, not hooks (prevent timeout issues) diff --git a/README.md b/README.md index 6b512da7..19b35484 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,10 @@ The command removes all the Kubernetes components associated with the chart and ## ChangeLog +### 0.5.2 +- use new check image to use PG environment variables +- add-user and load-db are now jobs, not hooks (prevent timeout issues) + ### 0.5.1 - update README to describe values - fix left over when initializing from URL diff --git a/templates/configmap.yaml b/templates/configmap.yaml index 56a760d5..15f97975 100644 --- a/templates/configmap.yaml +++ b/templates/configmap.yaml @@ -4,7 +4,7 @@ kind: ConfigMap metadata: name: {{ include "betydb.fullname" . }}-application labels: - {{ include "betydb.labels" . | nindent 4 }} + {{- include "betydb.labels" . | nindent 4 }} data: {{- if .Values.customization.application }} application.yml: | diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 0493d75c..1ed3cf38 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: name: {{ include "betydb.fullname" . }} labels: - {{ include "betydb.labels" . | nindent 4 }} + {{- include "betydb.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: @@ -41,8 +41,9 @@ spec: image: "{{ $.Values.image.checks }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - {{ include "betydb.postgresqlEnv" . | nindent 12 }} - {{ include "betydb.betydbEnv" . | nindent 12 }} + {{- include "betydb.postgresqlEnv" . | nindent 12 }} + - name: PG_TABLE + value: {{ .Values.betyDatabase | quote }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -63,8 +64,8 @@ spec: value: {{ .Values.ingress.path | default "" | trimSuffix "/" | quote }} - name: RAILS_LOG_TO_STDOUT value: "true" - {{ include "betydb.postgresqlEnv" . | nindent 12 }} - {{ include "betydb.betydbEnv" . | nindent 12 }} + {{- include "betydb.postgresqlEnv" . | nindent 12 }} + {{- include "betydb.betydbEnv" . | nindent 12 }} {{- if .Values.customization }} volumeMounts: {{- if .Values.customization.application }} diff --git a/templates/ingress.yaml b/templates/ingress.yaml index 0b2eacf5..9c18d481 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -5,7 +5,7 @@ kind: Ingress metadata: name: {{ $fullName }} labels: -{{ include "betydb.labels" . | indent 4 }} + {{- include "betydb.labels" . | nindent 4 }} annotations: {{- if .Values.ingress.tls }} kubernetes.io/tls-acme: "true" diff --git a/templates/hooks/add-user.yaml b/templates/jobs/add-user.yaml similarity index 66% rename from templates/hooks/add-user.yaml rename to templates/jobs/add-user.yaml index 332442da..40011564 100644 --- a/templates/hooks/add-user.yaml +++ b/templates/jobs/add-user.yaml @@ -1,5 +1,5 @@ {{- if .Values.users }} -{{- $imagetag := printf "%s:%s" .Values.image.repository .Values.image.tag }} +{{- $imagetag := printf "%s:%s" .Values.image.repository (.Values.image.tag | default .Chart.AppVersion) }} {{- $pgenv := include "betydb.postgresqlEnv" . }} {{- $betyenv := include "betydb.betydbEnv" . }} {{- $pullPolicy := .Values.image.pullPolicy }} @@ -8,19 +8,13 @@ kind: Job metadata: name: {{ include "betydb.fullname" . }}-add-user labels: - {{ include "betydb.labels" . | nindent 4 }} - annotations: - # This is what defines this resource as a hook. Without this line, the - # job is considered part of the release. - "helm.sh/hook": "post-install" - "helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation" - "helm.sh/hook-weight": "10" + {{- include "betydb.labels" . | nindent 4 }} spec: template: metadata: name: {{ include "betydb.name" . }}-add-user labels: - {{ include "betydb.labels" . | nindent 8 }} + {{- include "betydb.labels" . | nindent 8 }} spec: {{- with .Values.hooks.affinity }} affinity: @@ -36,8 +30,9 @@ spec: image: "{{ $.Values.image.checks }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - {{ include "betydb.postgresqlEnv" . | nindent 12 }} - {{ include "betydb.betydbEnv" . | nindent 12 }} + {{- include "betydb.postgresqlEnv" . | nindent 12 }} + - name: PG_TABLE + value: {{ .Values.betyDatabase | quote }} containers: {{- range $index, $element := .Values.users }} - name: bety-add-user-{{ $index }} @@ -52,7 +47,7 @@ spec: - {{ .data | quote }} - {{ .page | quote }} env: - {{ $pgenv | nindent 12 }} - {{ $betyenv | nindent 12 }} + {{- $pgenv | nindent 12 }} + {{- $betyenv | nindent 12 }} {{- end }} {{- end }} diff --git a/templates/jobs/foo b/templates/jobs/foo new file mode 100644 index 00000000..e69de29b diff --git a/templates/hooks/load-db.yaml b/templates/jobs/load-db.yaml similarity index 69% rename from templates/hooks/load-db.yaml rename to templates/jobs/load-db.yaml index 2d62a2ee..f3c09e45 100644 --- a/templates/hooks/load-db.yaml +++ b/templates/jobs/load-db.yaml @@ -4,19 +4,13 @@ kind: Job metadata: name: {{ include "betydb.fullname" . }}-load-db labels: -{{ include "betydb.labels" . | indent 4 }} - annotations: - # This is what defines this resource as a hook. Without this line, the - # job is considered part of the release. - "helm.sh/hook": "post-install" - "helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation" - "helm.sh/hook-weight": "5" + {{- include "betydb.labels" . | nindent 4 }} spec: template: metadata: name: {{ include "betydb.name" . }}-load-db labels: - {{ include "betydb.labels" . | nindent 8 }} + {{- include "betydb.labels" . | nindent 8 }} spec: {{- with .Values.hooks.affinity }} affinity: @@ -32,8 +26,7 @@ spec: image: "{{ $.Values.image.checks }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - {{ include "betydb.postgresqlEnv" . | nindent 12 }} - {{ include "betydb.betydbEnv" . | nindent 12 }} + {{- include "betydb.postgresqlEnv" . | nindent 12 }} containers: - name: bety-init {{- if .Values.dburl }} @@ -58,6 +51,6 @@ spec: imagePullPolicy: Always {{- end }} env: - {{ include "betydb.postgresqlEnv" . | nindent 12 }} - {{ include "betydb.betydbEnv" . | nindent 12 }} + {{- include "betydb.postgresqlEnv" . | nindent 12 }} + {{- include "betydb.betydbEnv" . | nindent 12 }} {{- end }} diff --git a/templates/secrets.yaml b/templates/secrets.yaml index 82be45b2..70d0e937 100644 --- a/templates/secrets.yaml +++ b/templates/secrets.yaml @@ -3,7 +3,7 @@ kind: Secret metadata: name: {{ include "betydb.fullname" . }} labels: -{{ include "betydb.labels" . | indent 4 }} + {{- include "betydb.labels" . | nindent 4 }} type: Opaque data: {{- if and (not .Values.postgresql.enabled) .Values.postgresql.postgresqlPassword }} diff --git a/templates/service.yaml b/templates/service.yaml index 42b8a468..cd0b09c5 100644 --- a/templates/service.yaml +++ b/templates/service.yaml @@ -3,7 +3,7 @@ kind: Service metadata: name: {{ include "betydb.fullname" . }} labels: -{{ include "betydb.labels" . | indent 4 }} + {{- include "betydb.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: diff --git a/values.yaml b/values.yaml index 1a50cb45..13d48931 100644 --- a/values.yaml +++ b/values.yaml @@ -1,7 +1,7 @@ image: repository: pecan/bety tag: null - checks: "ncsa/checks:1.0.0" + checks: "ncsa/checks:1.0.1" pullPolicy: IfNotPresent imagePullSecrets: []