Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added options in Helm chart for configuring external or internal database #34

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions slurm-cluster-chart/templates/database-auth-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{{ if not .Values.databaseConnection.passwordSecretName }}

apiVersion: v1
kind: Secret
metadata:
name: database-auth-secret
annotations:
helm.sh/hook: pre-install

data:
password: {{ randAlphaNum 32 | b64enc }}

{{ end }}
10 changes: 9 additions & 1 deletion slurm-cluster-chart/templates/mysql-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ if .Values.database.enabled }}

apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -28,12 +30,16 @@ spec:
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
{{ if .Values.database.passwordSecretName }}
name: {{ .Values.database.passwordSecretName }}
{{ else }}
name: database-auth-secret
{{ end }}
key: password
- name: MYSQL_RANDOM_ROOT_PASSWORD
value: "yes"
- name: MYSQL_USER
value: "slurm"
value: {{ .Values.databaseConnection.user }}
image: {{ .Values.database.image }}
name: mysql
ports:
Expand All @@ -48,3 +54,5 @@ spec:
- name: var-lib-mysql
persistentVolumeClaim:
claimName: var-lib-mysql

{{ end }}
6 changes: 5 additions & 1 deletion slurm-cluster-chart/templates/mysql-service.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{{ if .Values.database.enabled }}

apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: slurm
app.kubernetes.io/component: mysql
name: mysql
name: {{ .Values.databaseConnection.hostname }}
spec:
ports:
- name: mysql
Expand All @@ -14,3 +16,5 @@ spec:
selector:
app.kubernetes.io/name: slurm
app.kubernetes.io/component: mysql

{{ end }}
4 changes: 2 additions & 2 deletions slurm-cluster-chart/templates/slurmdbd-conf-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ data:
#
# Database info
StorageType=accounting_storage/mysql
StorageHost=mysql
StorageUser=slurm
StorageHost={{ .Values.databaseConnection.hostname }}
StorageUser={{ .Values.databaseConnection.user }}

4 changes: 4 additions & 0 deletions slurm-cluster-chart/templates/slurmdbd-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ spec:
- name: StoragePass
valueFrom:
secretKeyRef:
{{ if .Values.database.passwordSecretName }}
name: {{ .Values.database.passwordSecretName }}
{{ else }}
name: database-auth-secret
{{ end }}
key: password
hostname: slurmdbd
restartPolicy: Always
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ if .Values.database.enabled }}

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
Expand All @@ -12,3 +14,5 @@ spec:
resources:
requests:
storage: {{ .Values.database.storage }}

{{ end }}
24 changes: 20 additions & 4 deletions slurm-cluster-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,30 @@ rooknfs:
# backingStorageClass:



# Values for Slurm's database container
# Optional internally managed database deployment. If enabled, will deploy
# MySQL server pod backed by a PVC and a service that can be resolved as databaseConnection.hostname
database:
#Database image to be used
# If enabled, will install an internally managed database pod
enabled: true
# Database image to be used
image: mariadb:10.10
#Storage requested by the var-lib-mysql volume backing the database
# Storage requested by the var-lib-mysql volume backing the database
storage: 100Mi

# MySQL session connection info
databaseConnection:
# Hostname of SQL server.
# If using the internal database, it's service will be configured to resolve with this name
# If using external database, should be set as its endpoint
hostname: mysql
# User with access to the Slurm accounting database on the server
# If using the internal database, changing this field will have no effect
# If using the external database, this user must exist on it
user: slurm
# Name of secret containing database password. Secret should contain a 'password' key. If left as nil, a secret will be created
# automatically with a randomly generated password (recommended for internal database)
passwordSecretName:

# Configmap resource names
configmaps:
slurmConf: slurm-conf-configmap
Expand Down
Loading