Skip to content

Commit

Permalink
Made database more configurable and made separate options for interal…
Browse files Browse the repository at this point in the history
…ly managed database
  • Loading branch information
wtripp180901 committed Aug 29, 2023
1 parent a0a2323 commit 5a98be5
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 8 deletions.
12 changes: 12 additions & 0 deletions slurm-cluster-chart/templates/database-auth-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@ apiVersion: v1
kind: Secret
metadata:
name: database-auth-secret
{{ if not .Values.databaseConnection.password }}
annotations:
helm.sh/hook: pre-install
{{ end }}

{{ if .Values.databaseConnection.password }}

stringData:
password: {{ .Values.databaseConnection.password }}

{{ else }}

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

{{ end }}
6 changes: 5 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 @@ -33,7 +35,7 @@ spec:
- 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 +50,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 }}
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 }}
23 changes: 19 additions & 4 deletions slurm-cluster-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,29 @@ 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
# Password for database user. If left as nil, one will be randomly generated (recommended for internal database)
password:

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

0 comments on commit 5a98be5

Please sign in to comment.