Skip to content

Commit

Permalink
Follow diracx-web changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Oct 9, 2023
1 parent e826680 commit 1e63643
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 40 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ TODO
| developer.enableCoverage | bool | `false` | |
| developer.enabled | bool | `true` | |
| developer.localCSPath | string | `"/local_cs_store"` | |
| developer.nodeImage | string | `"node:16-alpine"` | |
| developer.nodeModuleToInstall | string | `nil` | |
| developer.pythonModulesToEditableInstall | list | `[]` | |
| developer.sourcePath | string | `"/diracx_source"` | |
Expand Down Expand Up @@ -115,13 +116,11 @@ TODO
| diracx.settings.DIRACX_CONFIG_BACKEND_URL | string | `"git+file:///cs_store/initialRepo"` | |
| diracx.settings.DIRACX_SERVICE_AUTH_ALLOWED_REDIRECTS | string | `"[\"http://anything:8000/docs/oauth2-redirect\"]"` | |
| diracx.settings.DIRACX_SERVICE_AUTH_TOKEN_KEY | string | `"file:///signing-key/rsa256.key"` | |
| diracxWeb.image.pullPolicy | string | `"IfNotPresent"` | |
| diracxWeb.image.repository | string | `"ghcr.io/diracgrid/diracx-web/client"` | |
| diracxWeb.image.pullPolicy | string | `"Always"` | |
| diracxWeb.image.repository | string | `"ghcr.io/diracgrid/diracx-web/static"` | |
| diracxWeb.image.tag | string | `"latest"` | |
| diracxWeb.service.port | int | `3000` | |
| diracxWeb.service.port | int | `8080` | |
| diracxWeb.service.type | string | `"ClusterIP"` | |
| diracxWeb.settings.DEFAULT_SCOPE | string | `"vo:diracAdmin"` | |
| diracxWeb.settings.DIRACX_CLIENT_ID | string | `"myDIRACClientID"` | |
| fullnameOverride | string | `""` | |
| global.batchJobTTL | int | `600` | |
| image.pullPolicy | string | `"Always"` | |
Expand Down
3 changes: 0 additions & 3 deletions demo/demo_cluster_conf.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ nodes:
- containerPort: 443
hostPort: 8000
protocol: TCP
- containerPort: 3000
hostPort: 3000
protocol: TCP
- containerPort: 32000
hostPort: 32000
protocol: TCP
Expand Down
7 changes: 1 addition & 6 deletions demo/values.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@ init-cs:
diracx:
hostname: {{ hostname }}
settings:
DIRACX_SERVICE_AUTH_ALLOWED_REDIRECTS: '["https://{{ hostname }}:8000/api/docs/oauth2-redirect", "https://{{ hostname }}:8000/dashboard/#authentication-callback"]'
DIRACX_SERVICE_AUTH_ALLOWED_REDIRECTS: '["https://{{ hostname }}:8000/api/docs/oauth2-redirect", "https://{{ hostname }}:8000/#authentication-callback"]'
DIRACX_SANDBOX_STORE_BUCKET_NAME: demo-sandboxes
DIRACX_SANDBOX_STORE_S3_CLIENT_KWARGS: '{"endpoint_url": "http://{{ hostname }}:32000", "aws_access_key_id": "console", "aws_secret_access_key": "console123"}'
DIRACX_SANDBOX_STORE_AUTO_CREATE_BUCKET: "true"

diracxWeb:
settings:
REDIRECT_URI: https://{{ hostname }}:8000/dashboard/#authentication-callback
NEXT_PUBLIC_DIRACX_URL: https://{{ hostname }}:8000/api

minio:
environment:
MINIO_BROWSER_REDIRECT_URL: http://{{ hostname }}:32001/
Expand Down
7 changes: 0 additions & 7 deletions diracx/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ stringData:
{{- end }}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: diracx-web-secrets
stringData:
{{ .Values.diracxWeb.settings | toYaml | indent 2 }}
---
{{- if index .Values "init-sql" "enabled" }}
apiVersion: v1
kind: Secret
Expand Down
55 changes: 43 additions & 12 deletions diracx/templates/web-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- $nodeDevInstall := and .Values.developer.enabled (empty .Values.developer.nodeModuleToInstall | not) -}}
{{- $nodeModulePath := $nodeDevInstall | ternary (printf "%s/%s" .Values.developer.sourcePath .Values.developer.nodeModuleToInstall) "" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -28,17 +30,48 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
{{- if and .Values.developer.enabled .Values.developer.nodeModuleToInstall }}
{{- if $nodeDevInstall }}
- name: diracx-web-code-mount
persistentVolumeClaim:
claimName: pvc-diracx-code
- name: diracx-web-scratch-node-modules
empty-dir:
sizeLimit: 1Gi
- name: diracx-web-scratch-next
empty-dir:
sizeLimit: 1Gi
{{- end }}

initContainers:
{{- if $nodeDevInstall }}
- name: install-deps
image: {{ .Values.developer.nodeImage }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
# We use "npm ci" instead of "npm install" so it will use the package-lock.json file
# rather than using the package.json file. Using package.json would fail as the mount
# is read-only so package-lock.json can't be edited.
command: ["npm", "ci"]
workingDir: {{ $nodeModulePath }}
volumeMounts:
- mountPath: "{{ .Values.developer.sourcePath }}/{{ .Values.developer.nodeModuleToInstall }}"
name: "diracx-web-code-mount"
subPath: "{{ .Values.developer.nodeModuleToInstall }}"
readOnly: true
- mountPath: "{{ $nodeModulePath }}/node_modules"
name: "diracx-web-scratch-node-modules"
- mountPath: "{{ $nodeModulePath }}/.next"
name: "diracx-web-scratch-next"
{{- end }}

containers:
- name: {{ .Chart.Name }}-web
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.diracxWeb.image.repository }}:{{ .Values.diracxWeb.image.tag | default .Chart.AppVersion }}"
{{- if $nodeDevInstall }}
image: {{ .Values.developer.nodeImage }}
{{- else }}
image: {{ .Values.diracxWeb.image.repository }}:{{ .Values.diracxWeb.image.tag }}
{{- end }}
imagePullPolicy: {{ .Values.diracxWeb.image.pullPolicy }}
ports:
- name: http
Expand All @@ -52,20 +85,18 @@ spec:
httpGet:
path: /
port: http
{{- if and .Values.developer.enabled .Values.developer.nodeModuleToInstall }}
command: ["npm", "run", "dev", "--prefix", {{ printf "%s/%s" $.Values.developer.sourcePath $.Values.developer.nodeModuleToInstall }}]
{{- if $nodeDevInstall }}
command: ["npm", "run", "dev", "--prefix", "{{ $nodeModulePath }}", "--", "-p", "{{ .Values.diracxWeb.service.port }}"]
volumeMounts:
- mountPath: {{ .Values.developer.sourcePath }}
- mountPath: "{{ .Values.developer.sourcePath }}/{{ .Values.developer.nodeModuleToInstall }}"
name: "diracx-web-code-mount"
subPath: "{{ .Values.developer.nodeModuleToInstall }}"
readOnly: true
{{- else if .Values.developer.enabled }}
command: ["npm", "run", "dev"]
{{- else }}
command: ["npm", "start"]
- mountPath: "{{ $nodeModulePath }}/node_modules"
name: "diracx-web-scratch-node-modules"
- mountPath: "{{ $nodeModulePath }}/.next"
name: "diracx-web-scratch-next"
{{- end }}
envFrom:
- secretRef:
name: diracx-web-secrets
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
12 changes: 5 additions & 7 deletions diracx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ developer:
pythonModulesToEditableInstall: []
# List of node modules to install
nodeModuleToInstall: null
# Image to use for the webapp if nodeModuleToInstall is set
nodeImage: node:16-alpine
# Enable collection of coverage reports (intended for CI usage only)
enableCoverage: false
# Enable automatic reloading inside uvicorn when the sources change
Expand Down Expand Up @@ -125,16 +127,12 @@ ingress:

diracxWeb:
image:
repository: ghcr.io/diracgrid/diracx-web/client
pullPolicy: IfNotPresent
repository: ghcr.io/diracgrid/diracx-web/static
pullPolicy: Always
tag: latest
settings:
# This corresponds to the basic .env file
DIRACX_CLIENT_ID: "myDIRACClientID"
DEFAULT_SCOPE: "vo:diracAdmin"
service:
type: ClusterIP
port: 3000
port: 8080

##########################

Expand Down

0 comments on commit 1e63643

Please sign in to comment.