Skip to content

Commit

Permalink
- use new check image to use PG environment variables
Browse files Browse the repository at this point in the history
- add-user and load-db are now jobs, not hooks (prevent timeout issues)
  • Loading branch information
robkooper committed Jul 23, 2022
1 parent fb95ed5 commit 83cd44a
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 39 deletions.
7 changes: 3 additions & 4 deletions Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
11 changes: 6 additions & 5 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}"
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 8 additions & 13 deletions templates/hooks/add-user.yaml → templates/jobs/add-user.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -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:
Expand All @@ -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 }}
Expand All @@ -52,7 +47,7 @@ spec:
- {{ .data | quote }}
- {{ .page | quote }}
env:
{{ $pgenv | nindent 12 }}
{{ $betyenv | nindent 12 }}
{{- $pgenv | nindent 12 }}
{{- $betyenv | nindent 12 }}
{{- end }}
{{- end }}
Empty file added templates/jobs/foo
Empty file.
17 changes: 5 additions & 12 deletions templates/hooks/load-db.yaml → templates/jobs/load-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion values.yaml
Original file line number Diff line number Diff line change
@@ -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: []
Expand Down

0 comments on commit 83cd44a

Please sign in to comment.