Skip to content

Commit

Permalink
Create helm chart and use in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
milliams committed Aug 9, 2024
1 parent 0cf60db commit 4cfd0a3
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 56 deletions.
9 changes: 9 additions & 0 deletions helm/conch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: © 2024 Matt Williams <[email protected]>
# SPDX-License-Identifier: MIT
---
apiVersion: v2
name: conch
version: "0.0.0" # Set by release script
appVersion: "" # Set by release script
sources:
- https://github.com/isambard-sc/conch/
11 changes: 11 additions & 0 deletions helm/conch/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# SPDX-FileCopyrightText: © 2024 Matt Williams <[email protected]>
# SPDX-License-Identifier: MIT
apiVersion: v1
kind: ConfigMap
metadata:
name: conch-config
data:
conch.toml: |
signing_key_path = "{{ .Values.signing_key_dir }}/key"
{{ .Values.config | toToml | nindent 4 }}
47 changes: 47 additions & 0 deletions helm/conch/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
# SPDX-FileCopyrightText: © 2024 Matt Williams <[email protected]>
# SPDX-License-Identifier: MIT
apiVersion: v1
kind: Deployment
metadata:
name: conch
labels:
app: conch
spec:
{{- if .Values.replicas }}
replicas: {{ .Values.replicas }}
{{- end }}
selector:
matchLabels:
app: conch
template:
metadata:
labels:
app: conch
spec:
containers:
- name: conch
image: {{ required "image_name must be set" .Values.image.name }}:{{ default .Chart.AppVersion .Values.image.tag }}
args: ["--port={{ .Values.port }}", "--config=/config/conch.toml"]
env:
- name: RUST_LOG
value: debug
ports:
- containerPort: {{ .Values.port }}
- hostPort: {{ .Values.port }}
volumeMounts:
- mountPath: {{ required "signing_key_dir must be set" .Values.signing_key_dir | quote }}
name: conch-signing-key-volume
read-only: true
- mountPath: "/config"
name: conch-config-volume
read-only: true
securityContext:
readOnlyRootFilesystem: true
volumes:
- name: conch-signing-key-volume
secret:
secretName: conch-signing-key-secret
- name: conch-config-volume
configMap:
name: conch-config
Empty file added helm/conch/values.schema.yaml
Empty file.
10 changes: 10 additions & 0 deletions helm/conch/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: © 2024 Matt Williams <[email protected]>
# SPDX-License-Identifier: MIT
---
config: {}
image:
name: conch
tag:
port: 3000
signing_key_dir: "/signing_key"
replicas:
55 changes: 0 additions & 55 deletions tests/integration/k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,6 @@
# SPDX-License-Identifier: MIT
---
apiVersion: v1
kind: ConfigMap
metadata:
name: conch-config
data:
conch.toml: |
issuer = "http://keycloak:8080/realms/conch"
signing_key_path = "/signing_key/key"
[services."ai.isambard"]
hostname = "ai-p1.access.isambard.ac.uk"
proxy_jump = "ai.login.isambard.ac.uk"
---
apiVersion: v1
kind: Deployment
metadata:
name: conch
labels:
app: conch
spec:
replicas: 1
selector:
matchLabels:
app: conch
template:
metadata:
labels:
app: conch
spec:
containers:
- name: conch
image: localhost/conch:latest
args: ["--port=3000", "--config=/config/conch.toml"]
env:
- name: RUST_LOG
value: debug
ports:
- containerPort: 3000
- hostPort: 3000
volumeMounts:
- mountPath: "/signing_key"
name: conch-signing-key-volume
read-only: true
- mountPath: "/config"
name: conch-config-volume
read-only: true
securityContext:
readOnlyRootFilesystem: true
volumes:
- name: conch-signing-key-volume
secret:
secretName: conch-signing-key-secret
- name: conch-config-volume
configMap:
name: conch-config
---
apiVersion: v1
kind: Pod
metadata:
name: keycloak
Expand Down
8 changes: 7 additions & 1 deletion tests/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ metadata:
data:
key: $(base64 --wrap=0 temp/signing_key)
EOF
header "Starting test pod"
header "Templating conch helm chart"
rm -f conch-chart.yaml
helm template --values values.yaml ../../helm/conch > temp/conch-chart.yaml
header "Starting keycloak pod"
podman kube play --replace k8s.yml

header "Logging in to KeyCloak"
Expand Down Expand Up @@ -157,3 +160,6 @@ for USERID in ${USERIDS}; do
}
EOF
done

header "Starting conch chart"
podman kube play --replace temp/conch-chart.yaml
12 changes: 12 additions & 0 deletions tests/integration/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: © 2024 Matt Williams <[email protected]>
# SPDX-License-Identifier: MIT
---
config:
issuer: "http://keycloak:8080/realms/conch"
services:
ai.isambard:
hostname: "ai-p1.access.isambard.ac.uk"
proxy_jump: "ai.login.isambard.ac.uk"
image:
name: localhost/conch
tag: latest

0 comments on commit 4cfd0a3

Please sign in to comment.