Skip to content

Commit 63169c6

Browse files
authored
Merge pull request #12 from esgf2-us/update_chart
Update chart for metagrid v1.1.0
2 parents f465cf1 + 15d2b94 commit 63169c6

File tree

12 files changed

+323
-202
lines changed

12 files changed

+323
-202
lines changed

chart/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: v2
22
name: metagrid
33
description: A Helm chart for the Metagrid frontend/backend
44
type: application
5-
version: 0.1.2
6-
appVersion: "v1.0.9-beta"
5+
version: 0.1.3
6+
appVersion: "v1.1.0"
77
home: https://github.com/esgf2-us/metagrid-k8s
88
sources:
99
- https://github.com/aims-group/metagrid

chart/README.md

Lines changed: 74 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -39,50 +39,31 @@ helm delete my-release
3939

4040
| Key | Type | Default | Description |
4141
|-----|------|---------|-------------|
42-
| external.globus.redirect | string | `nil` | Redirect URI used to obtain Globus authorization token |
43-
| external.globus.clientID | string | `nil` | Client ID used to obtain Globus authorization token |
44-
| external.globus.nodes | string | `nil` | List of Globus nodes separated by commas |
45-
| external.wget | string | `"https://esgf-node.llnl.gov/esg-search/wget"` | ESGF wget service URL |
46-
| external.search | string | `"https://esgf-node.llnl.gov/esg-search/search"` | ESGF search URL |
47-
| external.nodeStatus | string | URL to the django backend node status path | Override node status URL, may be required when using an ingress |
48-
| external.metagridAPIUrl | string | URL to the django backend api path | Override the metagrid API URL, may be required when using an ingress |
49-
| external.solr | string | `"https://esgf-fedtest.llnl.gov/solr"` | URL for the ESGF solr catalog |
50-
| external.keycloak.url | string | `"https://login.esgf.io/"` | URL of the ESGF Keycloak instance |
51-
| external.keycloak.realm | string | `"esgf"` | Keycloak realm |
52-
| external.keycloak.clientID | string | `"metagrid-llnl"` | Keycloak client ID |
53-
| external.hotjar | object | `{"id":null,"sv":null}` | [Hotjar](https://www.hotjar.com/) tracking codes, **OPTIONAL** |
54-
| external.googleAnalyticsTrackingID | string | `nil` | Google analytics tracking id, **OPTIONAL** |
42+
| authType | string | `"globus"` | Type of authentication to use, possible choices are globus (deafult), and keycloak |
43+
| globus.redirect | string | `"https://localhost:3000/cart/items"` | |
44+
| globus.frontend | object | `{"clientID":null}` | Client ID for a globus thick client, the redirect will need to be the url of the frontend e.g. https://metagrid.io/metagrid |
45+
| globus.backend | object | `{"clientID":null,"clientSecret":null}` | Client ID/Secret for globus portal, the redirect will need to be the url of the backend e.g. https://metagrid.io/metagrid-backend/complete/globus/ |
46+
| globus.nodes[0] | string | `"aims3.llnl.gov"` | |
47+
| globus.nodes[1] | string | `"esgf-data1.llnl.gov"` | |
48+
| globus.nodes[2] | string | `"esgf-data2.llnl.gov"` | |
49+
| keyCloak.url | string | `nil` | Keycloak service url |
50+
| keyCloak.realm | string | `nil` | Client realm |
51+
| keyCloak.clientID | string | `nil` | Client ID |
52+
| wgetApiUrl | string | `"https://esgf-node.llnl.gov/esg-search/wget"` | ESGF wget service url |
53+
| searchUrl | string | `"https://esgf-node.llnl.gov/esg-search/search"` | ESGF search service url |
54+
| esgfNodeStatusUrl | string | `nil` | ESGF node status url |
55+
| solrUrl | Deprecated | `"https://esgf-node.llnl.gov/solr"` | ESGF solr url |
56+
| baseUrl | string | `nil` | Base url for use when using an external TLS termination e.g. https://metagrid.io |
5557
| projects | string | `nil` | Customize projects loaded during the initial migration, this is the value stored in [initial_projects_data.py](https://github.com/aims-group/metagrid/blob/master/backend/metagrid/initial_projects_data.py) |
5658
| imagePullSecrets | list | `[]` | List of secrets used to pull images from private registries |
57-
| django.replicaCount | int | `1` | Number of replicas |
58-
| django.debug | bool | `false` | Enable Django debugging |
59-
| django.adminURL | string | `"panel/"` | Relative path to the Django management panel |
60-
| django.corsOriginWhitelist | string | to django backend service url | Override CORS origin whitelist |
61-
| django.secretKey | string | a random 50 character string | Django secret key, recommended to set a value rather than use the random default value |
62-
| django.gunicornCmdArgs | string | `nil` | Override the gunicorn command arguments |
63-
| django.image.repository | string | `"ghcr.io/aims-group/metagrid-backend"` | Django container URI |
64-
| django.image.pullPolicy | string | `"Always"` | Image pull policy |
65-
| django.image.tag | string | `"latest"` | Container tag |
66-
| django.nameOverride | string | `""` | |
67-
| django.fullnameOverride | string | `""` | |
68-
| django.podAnnotations | object | `{}` | Extra pod annotations |
69-
| django.migrateJob.enabled | bool | `true` | Enable database migration job |
70-
| django.migrateJob.restartPolicy | string | `"Never"` | |
71-
| django.affinity | object | `{}` | [Affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity), pod node scheduling constraints |
72-
| django.resources | object | `{}` | Container [resources](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers) |
73-
| django.securityContext | object | `{}` | Container [security](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) context |
74-
| django.nodeSelector | object | `{}` | Node [selector](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) labels |
75-
| django.preemptionPolicy | string | `nil` | Pod [preemption](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#preemption) policy |
76-
| django.priority | string | `nil` | Pod scheduling [priority](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority) |
77-
| django.priorityClassName | string | `nil` | Pod scheduling [priority](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) class name |
78-
| django.podSecurityContext | object | `{}` | Pod [security](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) context |
79-
| django.tolerations | list | `[]` | Pod [tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration) |
80-
| django.autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Horizontal pod autoscaling configuration |
81-
| django.service | object | `{"port":5000,"type":"ClusterIP"}` | Django service |
82-
| django.service.type | string | `"ClusterIP"` | Service type |
83-
| django.service.port | int | `5000` | Service port |
59+
| react.hotjarID | string | `nil` | Hotjar configuration |
60+
| react.hotjarSV | string | `nil` | |
61+
| react.googleAnalyticsID | string | `nil` | Google analytics ID |
62+
| react.backendUrl | string | `nil` | Custom url for external metagrid backend |
63+
| react.urlPath | string | `"/metagrid"` | Frontend path prefix |
64+
| react.previousUrlPath | string | `nil` | |
8465
| react.replicaCount | int | `1` | Number of replicas |
85-
| react.image.repository | string | `"ghcr.io/aims-group/metagrid-frontend"` | React container URI |
66+
| react.image.repository | string | `"ghcr.io/esgf2-us/metagrid-frontend"` | React container URI |
8667
| react.image.pullPolicy | string | `"Always"` | Container pull policy |
8768
| react.image.tag | string | `"latest"` | Container tag |
8869
| react.nameOverride | string | `""` | |
@@ -102,16 +83,50 @@ helm delete my-release
10283
| react.service.type | string | `"ClusterIP"` | Service type |
10384
| react.service.port | int | `3000` | Service port |
10485
| react.monitoring | object | `{"enabled":false}` | Prometheus monitoring |
86+
| django.secretKey | string | `nil` | Django [secret](https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-SECRET_KEY) key |
87+
| django.adminUrl | string | `"panel/"` | Path for the admin panel |
88+
| django.debug | bool | `false` | Enable django debugging |
89+
| django.gunicornCmdArgs | list | `nil` | Custom gunicorn CLI arguments |
90+
| django.urlPath | string | `"metagrid-backend"` | Backend path prefix |
91+
| django.loginPath | string | `"login/globus/"` | |
92+
| django.logoutPath | string | `"proxy/globus-logout/"` | |
93+
| django.loginRedirect | string | `"search"` | Frontend path to redirect to on login |
94+
| django.logoutRedirect | string | `"search"` | Frontend path to redirect to on logout |
95+
| django.admin.create | bool | `false` | Enable creating initial admin user |
96+
| django.admin.username | string | `"admin"` | Admin username |
97+
| django.admin.password | string | `nil` | Admin password |
98+
| django.admin.email | string | `nil` | Admin email |
99+
| django.migrateJob.enabled | bool | `true` | Enable migrate database job |
100+
| django.migrateJob.backoffLimit | int | `nil` | Backoff limit for migrate job |
101+
| django.migrateJob.restartPolicy | string | `"Never"` | Restart policy for migrate job |
102+
| django.replicaCount | int | `1` | Number of replicas |
103+
| django.image.repository | string | `"ghcr.io/esgf2-us/metagrid-backend"` | Django container URI |
104+
| django.image.pullPolicy | string | `"Always"` | Image pull policy |
105+
| django.image.tag | string | `"latest"` | Container tag |
106+
| django.nameOverride | string | `""` | |
107+
| django.fullnameOverride | string | `""` | |
108+
| django.podAnnotations | object | `{}` | Extra pod annotations |
109+
| django.affinity | object | `{}` | [Affinity](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity), pod node scheduling constraints |
110+
| django.resources | object | `{}` | Container [resources](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers) |
111+
| django.securityContext | object | `{}` | Container [security](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) context |
112+
| django.nodeSelector | object | `{}` | Node [selector](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector) labels |
113+
| django.preemptionPolicy | string | `nil` | Pod [preemption](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#preemption) policy |
114+
| django.priority | string | `nil` | Pod scheduling [priority](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority) |
115+
| django.priorityClassName | string | `nil` | Pod scheduling [priority](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) class name |
116+
| django.podSecurityContext | object | `{}` | Pod [security](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) context |
117+
| django.tolerations | list | `[]` | Pod [tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration) |
118+
| django.autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Horizontal pod autoscaling configuration |
119+
| django.service | object | `{"port":5000,"type":"ClusterIP"}` | Django service |
120+
| django.service.type | string | `"ClusterIP"` | Service type |
121+
| django.service.port | int | `5000` | Service port |
105122
| ingress.enabled | bool | `false` | Enable ingress |
106123
| ingress.annotations | object | `{}` | Extra ingress annotations |
107124
| ingress.labels | object | `{}` | Extra ingress labels |
108125
| ingress.className | string | `nil` | Override ingress class |
109-
| ingress.react | object | `{"host":null,"path":"/metagrid"}` | React ingress endpoint |
126+
| ingress.react | object | `{"host":null}` | React ingress endpoint |
110127
| ingress.react.host | string | `nil` | Endpoint host |
111-
| ingress.react.path | string | `"/metagrid"` | Endpoint path |
112-
| ingress.django | object | `{"host":null,"path":"/metagrid-backend"}` | Django ingress endpoint |
128+
| ingress.django | object | `{"host":null}` | Django ingress endpoint |
113129
| ingress.django.host | string | `nil` | Endpoint host |
114-
| ingress.django.path | string | `"/metagrid-backend"` | Endpoint path |
115130
| ingress.tls.enabled | bool | `false` | |
116131
| ingress.tls.secretName | string | `nil` | |
117132
| postgresql | object | `{"enabled":true,"persistence":{"enabled":false},"pgpool":{"adminPassword":"pgpooladminpass","containerSecurityContext":{"enabled":false},"podSecurityContext":{"enabled":false}},"postgresql":{"containerSecurityContext":{"enabled":false},"password":"pgpass","podSecurityContext":{"enabled":false},"replicaCount":1,"repmgrPassword":"repmgrpass"}}` | Postgresql database, **REQUIRED** |
@@ -152,14 +167,21 @@ kubectl exec -it $(kubectl get pod -oname -l app.kubernetes.io/component=django)
152167
kubectl exec -it $(kubectl get pod -oname -l app.kubernetes.io/component=django) -- python manage.py migrate projects
153168
```
154169

155-
### External TLS termination
156-
The `nodeStatus` and `metagridAPIUrl` values by default are automatically generated. If using an upstream reverse-proxy that handles TLS, then these urls will be incorrect and cause
157-
the application to not work correctly.
170+
### Create initial admin
171+
To create an initial backend user, enable the following and fill out the details.
158172

159-
To fix this both `nodeStatus` and `metagridAPIUrl` need to be overwritten, see the following example.
173+
```
174+
django:
175+
admin:
176+
create: true
177+
username: <username>
178+
password: <password>
179+
email: <email>
180+
```
181+
182+
### External TLS termination
183+
When using external TLS termination e.g. Traefik, Nginx, etc, the chart will need to be configured with the external url.
160184

161185
```
162-
external:
163-
nodeStatus: https://<host>/metagrid-backend/proxy/status
164-
metagridAPIUrl: https://<host>/metagrid-backend
186+
baseUrl: https://metagrid.io
165187
```

chart/README.md.gotmpl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,21 @@ kubectl exec -it $(kubectl get pod -oname -l app.kubernetes.io/component=django)
5959
kubectl exec -it $(kubectl get pod -oname -l app.kubernetes.io/component=django) -- python manage.py migrate projects
6060
```
6161

62-
### External TLS termination
63-
The `nodeStatus` and `metagridAPIUrl` values by default are automatically generated. If using an upstream reverse-proxy that handles TLS, then these urls will be incorrect and cause
64-
the application to not work correctly.
62+
### Create initial admin
63+
To create an initial backend user, enable the following and fill out the details.
6564

66-
To fix this both `nodeStatus` and `metagridAPIUrl` need to be overwritten, see the following example.
65+
```
66+
django:
67+
admin:
68+
create: true
69+
username: <username>
70+
password: <password>
71+
email: <email>
72+
```
73+
74+
### External TLS termination
75+
When using external TLS termination e.g. Traefik, Nginx, etc, the chart will need to be configured with the external url.
6776

6877
```
69-
external:
70-
nodeStatus: https://<host>/metagrid-backend/proxy/status
71-
metagridAPIUrl: https://<host>/metagrid-backend
78+
baseUrl: https://metagrid.io
7279
```

chart/tbump.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github_url = "https://github.com/esgf2-us/metagrid-k8s/"
22

33
[version]
4-
current = "0.1.0"
4+
current = "0.1.3"
55

66
regex = '''
77
(?P<major>\d+)

chart/templates/_helpers.tpl

Lines changed: 63 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -93,48 +93,83 @@ postgres://{{ include "metagrid.pg_user" $ }}:{{ include "metagrid.pg_pass" $ }}
9393
{{- end }}
9494

9595
{{/*
96-
Keycloak URL
96+
React base url
9797
*/}}
98-
{{- define "metagrid.keycloak_url" -}}
99-
{{- if .Values.keycloak.external -}}
100-
{{- .Values.keycloak.url -}}
101-
{{- else -}}
102-
{{- include "common.names.fullname" .Subcharts.keycloak }}.{{ .Release.Namespace }}.svc.{{ .Subcharts.keycloak.Values.clusterDomain }}:{{ coalesce .Subcharts.keycloak.Values.service.ports.http .Subcharts.keycloak.Values.service.port }}
103-
{{- end -}}
98+
{{- define "metagrid.react.baseUrl" -}}
99+
{{- $host := ternary .Values.ingress.react.host (printf "127.0.0.1:%v" .Values.react.service.port) .Values.ingress.enabled }}
100+
{{- $scheme := ternary "https" "http" (and .Values.ingress.enabled .Values.ingress.tls.enabled) }}
101+
{{- printf "%s" (default (printf "%s://%s" $scheme $host) .Values.baseUrl) }}
104102
{{- end }}
105103

106104
{{/*
107-
Django ALLOWED_HOSTS
105+
React Url
108106
*/}}
109-
{{- define "metagrid.django_allowed_hosts" -}}
110-
{{- join "," (list "0.0.0.0" "localhost" .Values.ingress.react.host (printf "%s-django" (include "metagrid.fullname" .))) -}}
107+
{{- define "metagrid.react.url" -}}
108+
{{- $baseUrl := include "metagrid.react.baseUrl" . }}
109+
{{- printf "%s%s" $baseUrl (printf "/%s" (trimPrefix "/" .Values.react.urlPath)) }}
111110
{{- end }}
112111

113112
{{/*
114-
Django CORS_ORIGIN_WHITELIST
113+
Django base url
115114
*/}}
116-
{{- define "metagrid.django.corsOriginWhitelist" -}}
117-
{{- $defaultValue := printf "http://%v-react:%v" (include "metagrid.fullname" .) .Values.react.service.port }}
118-
{{- printf "%s" (default $defaultValue .Values.django.corsOriginWhitelist) }}
115+
{{- define "metagrid.django.baseUrl" -}}
116+
{{- $host := ternary .Values.ingress.django.host (printf "127.0.0.1:%v" .Values.django.service.port) .Values.ingress.enabled }}
117+
{{- $scheme := ternary "https" "http" (and .Values.ingress.enabled .Values.ingress.tls.enabled) }}
118+
{{- printf "%s" (default (printf "%s://%s" $scheme $host) .Values.baseUrl) }}
119+
{{- end }}
120+
121+
{{/*
122+
Django Url
123+
*/}}
124+
{{- define "metagrid.django.url" -}}
125+
{{- $baseUrl := include "metagrid.django.baseUrl" . }}
126+
{{- printf "%s%s" $baseUrl (printf "/%s" (trimPrefix "/" .Values.django.urlPath)) }}
127+
{{- end }}
128+
129+
{{/*
130+
Django login url
131+
*/}}
132+
{{- define "metagrid.django.loginUrl" -}}
133+
{{- $baseUrl := include "metagrid.django.url" . }}
134+
{{- printf "%s/login/globus/" $baseUrl }}
135+
{{- end }}
136+
137+
{{/*
138+
Django logout url
139+
*/}}
140+
{{- define "metagrid.django.logoutUrl" -}}
141+
{{- $baseUrl := include "metagrid.django.url" . }}
142+
{{- printf "%s/proxy/globus-logout/" $baseUrl }}
143+
{{- end }}
144+
145+
{{/*
146+
Django login redirect
147+
*/}}
148+
{{- define "metagrid.django.loginRedirect" -}}
149+
{{- $baseUrl := include "metagrid.react.url" . }}
150+
{{- printf "%s/%s" $baseUrl (trimPrefix "/" .Values.django.loginRedirect) }}
151+
{{- end }}
152+
153+
{{/*
154+
Django logout redirect
155+
*/}}
156+
{{- define "metagrid.django.logoutRedirect" -}}
157+
{{- $baseUrl := include "metagrid.react.url" . }}
158+
{{- printf "%s/%s" $baseUrl (trimPrefix "/" .Values.django.logoutRedirect) }}
119159
{{- end }}
120160

121161
{{/*
122-
Django ESGF node status url
162+
Django ALLOWED_HOSTS
123163
*/}}
124-
{{- define "metagrid.django.esgfNodeStatusUrl" -}}
125-
{{- $service := printf "127.0.0.1:%v" .Values.django.service.port }}
126-
{{- $ssl := ternary "s" "" .Values.ingress.tls.enabled }}
127-
{{- $host := ternary .Values.ingress.django.host $service .Values.ingress.enabled }}
128-
{{- $url := printf "http%v://%v/%v/proxy/status" $ssl $host (trimPrefix "/" .Values.ingress.django.path) }}
129-
{{- printf "%v" (default $url .Values.external.nodeStatus) }}
164+
{{- define "metagrid.djangoAllowedHosts" -}}
165+
{{- join "," (list "127.0.0.1" "localhost" (printf "%s-django" (include "metagrid.fullname" .)) .Values.ingress.react.host ) -}}
130166
{{- end }}
131167

132-
{{- define "metagrid.react.metagridUrl" -}}
133-
{{- $service := printf "127.0.0.1:%v" .Values.django.service.port }}
134-
{{- $ssl := ternary "s" "" .Values.ingress.tls.enabled }}
135-
{{- $host := ternary .Values.ingress.django.host $service .Values.ingress.enabled }}
136-
{{- $url := printf "http%v://%v/%v" $ssl $host .Values.ingress.django.path }}
137-
{{- printf "%v" (default $url .Values.external.metagridAPIUrl) }}
168+
{{/*
169+
Django CORS_ORIGIN_WHITELIST
170+
*/}}
171+
{{- define "metagrid.django.corsOriginWhitelist" -}}
172+
{{- printf "%s" (include "metagrid.react.baseUrl" .) }}
138173
{{- end }}
139174

140175
{{- define "metagrid.podSpec" -}}
@@ -156,7 +191,7 @@ containers:
156191
env:
157192
{{- range $name, $value := . }}
158193
- name: {{ $name }}
159-
value: {{ tpl $value .TemplateValues | quote }}
194+
value: {{ tpl $value $.TemplateValues | quote }}
160195
{{- end }}
161196
{{- end }}
162197
{{- with .envFrom }}

0 commit comments

Comments
 (0)