Skip to content

Commit 081897f

Browse files
authored
Merge pull request #33 from FNNDSC/dev
chris version 1.0.0-alpha.1
2 parents 9985cc1 + 648e9b6 commit 081897f

32 files changed

+1273
-812
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ignore subchart tarballs
2+
/charts/*/charts

charts/chris/.gitignore

-2
This file was deleted.

charts/chris/Chart.lock

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
dependencies:
22
- name: postgresql
33
repository: oci://registry-1.docker.io/bitnamicharts
4-
version: 13.4.6
4+
version: 15.5.38
55
- name: rabbitmq
66
repository: oci://registry-1.docker.io/bitnamicharts
7-
version: 12.5.7
7+
version: 15.0.7
8+
- name: nats
9+
repository: oci://registry-1.docker.io/bitnamicharts
10+
version: 8.4.9
811
- name: pfcon
912
repository: https://fnndsc.github.io/charts
10-
version: 0.2.2
13+
version: 1.0.0-alpha.1
1114
- name: orthanc
1215
repository: https://fnndsc.github.io/charts
1316
version: 1.2.1
14-
digest: sha256:73790836be68258a9906a59e91dc88c0cc21e457d16099326c31a7650b464a85
15-
generated: "2024-05-07T00:25:28.370260264-04:00"
17+
- name: util
18+
repository: https://fnndsc.github.io/charts
19+
version: 0.2.1
20+
digest: sha256:ddb0a0ddb7eefa4f129e92cbe4c0eafaf49213a185ce422412be49177f564a0d
21+
generated: "2024-11-27T01:06:55.210808071-05:00"

charts/chris/Chart.yaml

+12-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ keywords:
1717
icon: ./logo_chris.png
1818

1919
type: application
20-
version: "0.14.0"
21-
appVersion: "5.0.0"
20+
version: "1.0.0-alpha.1"
21+
appVersion: "6.3.0-beta.6"
2222

2323
maintainers:
2424
- name: The FNNDSC Dev Team
@@ -27,16 +27,23 @@ maintainers:
2727

2828
dependencies:
2929
- name: postgresql
30-
version: "~13.4.4"
30+
version: "~15.5.36"
3131
repository: "oci://registry-1.docker.io/bitnamicharts"
32+
condition: postgresql.enabled
3233
- name: rabbitmq
33-
version: "~12.5.6"
34+
version: "~15.0.1"
35+
repository: "oci://registry-1.docker.io/bitnamicharts"
36+
- name: nats
37+
version: "~8.4.3"
3438
repository: "oci://registry-1.docker.io/bitnamicharts"
3539
- name: pfcon
36-
version: ">=0.1.2, <0.3.0"
40+
version: "1.0.0-alpha.1"
3741
repository: "https://fnndsc.github.io/charts"
3842
condition: pfcon.enabled
3943
- name: orthanc
4044
version: "~1.2.1"
4145
repository: "https://fnndsc.github.io/charts"
4246
condition: orthanc.enabled
47+
- name: util
48+
version: "0.2.1"
49+
repository: "https://fnndsc.github.io/charts"

charts/chris/templates/NOTES.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1+
{{- $kubectl := ternary "oc" "kubectl" (.Capabilities.APIVersions.Has "security.openshift.io/v1/SecurityContextConstraints") -}}
2+
13
The ChRIS backend is being deployed. Please wait for it to be ready.
24
You can run this command to block while the server is starting up:
35

4-
kubectl wait --for=condition=ready pod -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} -l app.kubernetes.io/name={{ include "chris.name" . }}-server --timeout=300s
6+
{{ $kubectl }} wait --for=condition=ready pod -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} -l app.kubernetes.io/name={{ include "chris.name" . }}-server --timeout=300s
57

6-
After that, try logging in as the admin user. The username is "{{ .Values.chris_admin.username }}".
7-
The password can be revealed by running the command
8+
After that, try logging in as the admin user. The password can be revealed by running the command
89

9-
kubectl get secret -n {{ .Release.Namespace }} {{ .Release.Name }}-chris-superuser -o jsonpath='{.data.password}' | base64 --decode
10+
{{ $kubectl }} get secret -n {{ .Release.Namespace }} {{ .Release.Name }}-chris-backend -o jsonpath='{.data.CHRIS_SUPERUSER_PASSWORD}' | base64 --decode
1011
{{ if (and .Values.cube.server.service.nodePort .Values.cube.server.service.nodePortHost) }}
1112
Your CUBE API address is:
1213

1314
http://{{ .Values.cube.server.service.nodePortHost }}:{{ .Values.cube.server.service.nodePort }}/api/v1/
1415

1516
Here is a one-liner for you to check that everything is up and running:
1617

17-
curl -i --fail-with-body -u "{{ .Values.chris_admin.username }}:$(kubectl get secret -n {{ .Release.Namespace }} {{ .Release.Name }}-chris-superuser -o jsonpath='{.data.password}' | base64 --decode)" http://{{ .Values.cube.server.service.nodePortHost }}:{{ .Values.cube.server.service.nodePort }}/chris-admin/api/v1/
18+
curl -i --fail-with-body -u "chris:$(kubectl get secret -n {{ .Release.Namespace }} {{ .Release.Name }}-chris-backend -o jsonpath='{.data.CHRIS_SUPERUSER_PASSWORD}' | base64 --decode)" http://{{ .Values.cube.server.service.nodePortHost }}:{{ .Values.cube.server.service.nodePort }}/chris-admin/api/v1/
1819

1920
{{ end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{{- /* A template for CUBE deployments. */ -}}
2+
{{- define "cube.deployment" -}}
3+
{{- $appName := (printf "%s-%s" (include "chris.name" .) (.name | required "name is a required parameter of cube.deployment helper function.")) -}}
4+
apiVersion: apps/v1
5+
kind: Deployment
6+
metadata:
7+
name: {{ include "chris.fullname" . }}-{{ .name }}
8+
namespace: {{ .Release.Namespace }}
9+
labels: &LABELS_{{ .name }}
10+
app.kubernetes.io/name: {{ $appName }}
11+
app.kubernetes.io/instance: {{ .Release.Name }}
12+
{{- include "cube.labels" . | nindent 4 }}
13+
{{- with .description }}
14+
annotations:
15+
kubernetes.io/description: {{ quote . }}
16+
{{- end }}
17+
spec:
18+
replicas: {{ .replicas | default 1 }}
19+
selector:
20+
matchLabels:
21+
app.kubernetes.io/name: {{ $appName }}
22+
app.kubernetes.io/instance: {{ .Release.Name }}
23+
template:
24+
metadata:
25+
{{- with .podAnnotations }}
26+
annotations:
27+
{{- toYaml . | nindent 8 }}
28+
{{- end }}
29+
labels: *LABELS_{{ .name }}
30+
spec:
31+
{{- with .Values.imagePullSecrets }}
32+
imagePullSecrets:
33+
{{- toYaml . | nindent 8 }}
34+
{{- end }}
35+
initContainers:
36+
{{- include "cube.waitServerReady" . | nindent 8 }}
37+
containers:
38+
- name: {{ .name }}
39+
command:
40+
{{- .command | required "command is a required parameter of the cube.deployment helper function." | toYaml | nindent 12 }}
41+
resources:
42+
{{- .resources | required "resources is a required parameter of the cube.deployment helper function." | toYaml | nindent 12 }}
43+
{{- if .httpPort }}
44+
ports:
45+
- name: http
46+
containerPort: {{ .httpPort }}
47+
{{- if .hostPort }}
48+
hostPort: {{ .hostPort }}
49+
{{- end }}
50+
{{- end }}
51+
{{- with .livenessProbe }}
52+
livenessProbe:
53+
{{- . | toYaml | nindent 12 }}
54+
{{- end }}
55+
{{- include "cube.container" . | nindent 10 }}
56+
{{- include "cube.pod" . | nindent 6 }}
57+
{{- include "cube.podAffinityWorkaround" . | nindent 6 }}
58+
{{- end -}}
+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{{/*
2+
CUBE file storage
3+
--------------------------------------------------------------------------------
4+
In the default configuration, pfcon is configured as "innetwork" and CUBE uses
5+
the volume managed by the pfcon subchart for file storage.
6+
If pfcon is not enabled or not configured as "innetwork" then CUBE needs to create
7+
its own PVC.
8+
*/}}
9+
10+
{{- define "cube.useOwnVolume" -}}
11+
{{- if (and .Values.pfcon.enabled .Values.pfcon.pfcon.config.innetwork) -}}
12+
{{- /* no (empty value) */ -}}
13+
{{- else -}}
14+
yes
15+
{{- end }}
16+
{{- end }}
17+
18+
{{- define "cube.wasUsingOwnVolume" -}}
19+
{{- with (lookup "v1" "PersistentVolumeClaim" .Release.Namespace ( print .Release.Name "-cube-files")) -}}
20+
yes
21+
{{- end -}}
22+
{{- end -}}
23+
24+
{{- define "cube.filesVolume" -}}
25+
{{- /*
26+
Validators to check that you aren't self-destructive.
27+
28+
You should never:
29+
- enable "innetwork pfcon" where previously it wasn't
30+
- disable "innetwork pfcon" where it previously was
31+
*/ -}}
32+
{{- if (and .Release.IsUpgrade (eq "yes" (include "cube.wasUsingOwnVolume" .)) (ne "yes" (include "cube.useOwnVolume" .))) -}}
33+
{{- fail "Cannot set pfcon.enabled=true and/or pfcon.pfcon.config.innetwork=true now because CUBE is using its own PersistentVolumeClaim for storage." -}}
34+
{{- else if (and .Release.IsUpgrade (ne "yes" (include "cube.wasUsingOwnVolume" .)) (eq "yes" (include "cube.useOwnVolume" .))) -}}
35+
{{- fail "Cannot set pfcon.enabled=false and/or pfcon.pfcon.config.innetwork=false now because CUBE currently depends on pfcon configured in \"innetwork\" mode for storage." -}}
36+
{{- else if (include "cube.useOwnVolume" .) -}}
37+
{{- /* will be created by ./storage.yml */ -}}
38+
{{ .Release.Name }}-cube-files
39+
{{- else -}}
40+
{{- /* defined in ../../pfcon/templates/storage.yml */ -}}
41+
{{ .Release.Name }}-storebase
42+
{{- end }}
43+
{{- end }}
44+
45+
{{- define "cube.db.secret" -}}
46+
{{- if .Values.postgresSecret.name -}}
47+
{{- .Values.postgresSecret.name -}}
48+
{{- else if .Values.postgresql.enabled -}}
49+
{{ .Release.Name }}-postgresql-svcbind-custom-user
50+
{{- else -}}
51+
{{- fail "postgresSecret.name cannot be unset because postgresql.enabled=false" -}}
52+
{{- end -}}
53+
{{- end -}}
54+
55+
{{- define "cube.image" -}}
56+
{{ .Values.cube.image.repository }}:{{ .Values.cube.image.tag | default .Chart.AppVersion }}
57+
{{- end -}}
58+
{{- define "cube.container" -}}
59+
image: {{ include "cube.image" . }}
60+
imagePullPolicy: {{ .Values.cube.image.pullPolicy }}
61+
volumeMounts:
62+
- mountPath: /data
63+
name: file-storage
64+
envFrom:
65+
- configMapRef:
66+
name: {{ .Release.Name }}-cube-config
67+
- secretRef:
68+
name: {{ .Release.Name }}-chris-backend
69+
env:
70+
{{- $dbenvs := (dict
71+
"POSTGRES_DB" (include "chris.db.secretItemKey" (dict "Values" .Values "name" "database" "crunchyName" "dbname"))
72+
"POSTGRES_USER" (include "chris.db.secretItemKey" (dict "Values" .Values "name" "username" "crunchyName" "user"))
73+
"POSTGRES_PASSWORD" (include "chris.db.secretItemKey" (dict "Values" .Values "name" "password" "crunchyName" "password"))
74+
"DATABASE_HOST" (include "chris.db.secretItemKey" (dict "Values" .Values "name" "host" "crunchyName" "host"))
75+
"DATABASE_PORT" (include "chris.db.secretItemKey" (dict "Values" .Values "name" "port" "crunchyName" "port"))
76+
) }}
77+
{{- $secretName := include "cube.db.secret" . }}
78+
{{- range $name, $key := $dbenvs }}
79+
- name: {{ $name }}
80+
valueFrom:
81+
secretKeyRef:
82+
name: {{ $secretName }}
83+
key: {{ $key }}
84+
{{- end }}
85+
- name: CELERY_BROKER_URL
86+
valueFrom:
87+
secretKeyRef:
88+
name: {{ .Release.Name }}-rabbitmq-svcbind
89+
key: uri
90+
{{- range $name, $val := .moreEnv }}
91+
- name: {{ $name }}
92+
valueFrom:
93+
{{ get $val "valueFrom" }}:
94+
name: {{ get $val "name" }}
95+
key: {{ get $val "key" }}
96+
{{- end }}
97+
{{- end }}
98+
99+
{{- /* Helper function to get the name of an item of a key. If unspecified in Values, use a default name
100+
where the default may be different for Crunchy PGO. */}}
101+
{{- define "chris.db.secretItemKey" }}
102+
{{- get .Values.postgresSecret.keys .name | default (ternary .crunchyName .name .Values.postgresSecret.isCrunchy) -}}
103+
{{- end }}
104+
105+
{{- define "cube.pod" -}}
106+
volumes:
107+
- name: file-storage
108+
persistentVolumeClaim:
109+
claimName: {{ include "cube.filesVolume" . }}
110+
{{- if .Values.global.podSecurityContext }}
111+
securityContext:
112+
{{- toYaml .Values.global.podSecurityContext | nindent 2 }}
113+
{{- end }}
114+
{{- end }}
115+
116+
{{- define "cube.podAffinityWorkaround" -}}
117+
{{ if .Values.cube.enablePodAffinityWorkaround }}
118+
affinity:
119+
podAffinity:
120+
requiredDuringSchedulingIgnoredDuringExecution:
121+
- labelSelector:
122+
matchExpressions:
123+
- key: app.kubernetes.io/instance
124+
operator: In
125+
values:
126+
- {{ .Release.Name }}
127+
{{- /* if CUBE is using its own volume, pods should be attracted to heart. Otherwise, pods should be attracted to pfcon. */}}
128+
- key: app.kubernetes.io/name
129+
operator: In
130+
values:
131+
- {{ if (include "cube.useOwnVolume" .) }}{{ include "chris.heart.appName" . }}{{ else }}pfcon{{ end }}
132+
topologyKey: kubernetes.io/hostname
133+
{{- end }}
134+
{{- end }}
135+
136+
{{- /*
137+
Since the server deployment is the one which defines the database migrations, everything else
138+
should start after the server. It's ok for ancillary services to be started late.
139+
*/ -}}
140+
{{- define "cube.waitServerReady" -}}
141+
- name: wait-for-server
142+
image: quay.io/prometheus/busybox:latest
143+
command: ["/bin/sh", "-c"]
144+
args: ["until wget --spider 'http://{{ include "chris.heart.name" . }}:{{ include "chris.heart.port" . }}/api/v1/users/'; do sleep 5; done"]
145+
{{- end }}
146+

0 commit comments

Comments
 (0)