Skip to content
Open
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
6 changes: 4 additions & 2 deletions helm/slurm/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions helm/slurm/templates/loginset/loginset-cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ spec:
extraSshdConfig: |
{{- . | nindent 4 }}
{{- end }}{{- /* with $loginset.extraSshdConfig */}}
{{- $sssdRef := ($loginset.sssd | default dict).secretRef | default dict }}
{{- if and $sssdRef.key (not $sssdRef.name) }}
{{- fail (printf "loginset `%s` sets sssd.secretRef.key without sssd.secretRef.name." $key) }}
{{- end }}
{{- if not $sssdRef.name }}
{{- $sssdRef = dict "name" (include "slurm.sssdConf.name" $) "key" (include "slurm.sssdConf.key" $) }}
{{- end }}
sssdConfRef:
name: {{ include "slurm.sssdConf.name" $ }}
key: {{ include "slurm.sssdConf.key" $ }}
name: {{ $sssdRef.name }}
key: {{ $sssdRef.key | default "sssd.conf" }}
{{- with $loginset.rootSshAuthorizedKeys }}
rootSshAuthorizedKeys: |
{{- . | nindent 4 }}
Expand Down
9 changes: 8 additions & 1 deletion helm/slurm/templates/nodeset/nodeset-cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ spec:
{{- end }}{{- /* with $nodeset.partition */}}
{{- with $nodeset.ssh }}
{{- if .enabled }}
{{- $_ := set $nodeset.ssh "sssdConfRef" (dict "name" (include "slurm.sssdConf.name" $) "key" (include "slurm.sssdConf.key" $)) }}
{{- $sssdRef := ($nodeset.sssd | default dict).secretRef | default dict }}
{{- if and $sssdRef.key (not $sssdRef.name) }}
{{- fail (printf "nodeset `%s` sets sssd.secretRef.key without sssd.secretRef.name." $key) }}
{{- end }}
{{- if not $sssdRef.name }}
{{- $sssdRef = dict "name" (include "slurm.sssdConf.name" $) "key" (include "slurm.sssdConf.key" $) }}
{{- end }}
{{- $_ := set $nodeset.ssh "sssdConfRef" (dict "name" $sssdRef.name "key" ($sssdRef.key | default "sssd.conf")) }}
ssh:
{{- toYaml . | nindent 4 }}
{{- end }}{{- /* if .enabled */}}
Expand Down
103 changes: 103 additions & 0 deletions helm/slurm/tests/loginset_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,106 @@ tests:
- equal:
path: spec.initconf.image
value: registry.example.com/org/initconf@sha256:abcdef0123456789
- it: should use the cluster-wide sssd secretRef when the set has none
set:
sssd:
secretRef:
name: global-sssd
key: sssd.conf
loginsets:
slinky:
enabled: true
asserts:
- equal:
path: spec.sssdConfRef.name
value: global-sssd
- equal:
path: spec.sssdConfRef.key
value: sssd.conf
- it: should prefer the per-loginset sssd secretRef over the cluster-wide one
set:
sssd:
secretRef:
name: global-sssd
key: sssd.conf
loginsets:
slinky:
enabled: true
sssd:
secretRef:
name: my-sssd-secret
key: my-sssd.conf
asserts:
- equal:
path: spec.sssdConfRef.name
value: my-sssd-secret
- equal:
path: spec.sssdConfRef.key
value: my-sssd.conf
- it: should take the whole reference from the set, not one field from each
set:
sssd:
secretRef:
name: global-sssd
key: global.conf
loginsets:
slinky:
enabled: true
sssd:
secretRef:
name: my-sssd-secret
asserts:
- equal:
path: spec.sssdConfRef.name
value: my-sssd-secret
- equal:
path: spec.sssdConfRef.key
value: sssd.conf
- it: should fail when the set gives a secret key without a name
set:
loginsets:
slinky:
enabled: true
sssd:
secretRef:
key: my-sssd.conf
asserts:
- failedTemplate:
errorMessage: "loginset `slinky` sets sssd.secretRef.key without sssd.secretRef.name."
- it: should fall back to the cluster-wide sssd secretRef when the set clears it
set:
sssd:
secretRef:
name: global-sssd
key: global.conf
loginsets:
slinky:
enabled: true
sssd: null
asserts:
- equal:
path: spec.sssdConfRef.name
value: global-sssd
- equal:
path: spec.sssdConfRef.key
value: global.conf
- it: should give each loginset its own sssd secretRef
set:
loginsets:
slinky:
enabled: true
slinky2:
enabled: true
sssd:
secretRef:
name: my-sssd-secret
key: my-sssd.conf
asserts:
- equal:
path: spec.sssdConfRef.name
value: test-release-slurm-sssd-conf
documentIndex: 0
- equal:
path: spec.sssdConfRef.name
value: my-sssd-secret
documentIndex: 1
117 changes: 117 additions & 0 deletions helm/slurm/tests/nodeset_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,120 @@ tests:
- equal:
path: spec.logfile.image
value: registry.example.com/org/logfile@sha256:abcdef0123456789
- it: should use the cluster-wide sssd secretRef when the set has none
set:
sssd:
secretRef:
name: global-sssd
key: sssd.conf
nodesets:
slinky:
enabled: true
ssh:
enabled: true
asserts:
- equal:
path: spec.ssh.sssdConfRef.name
value: global-sssd
- equal:
path: spec.ssh.sssdConfRef.key
value: sssd.conf
- it: should prefer the per-nodeset sssd secretRef over the cluster-wide one
set:
sssd:
secretRef:
name: global-sssd
key: sssd.conf
nodesets:
slinky:
enabled: true
ssh:
enabled: true
sssd:
secretRef:
name: my-sssd-secret
key: my-sssd.conf
asserts:
- equal:
path: spec.ssh.sssdConfRef.name
value: my-sssd-secret
- equal:
path: spec.ssh.sssdConfRef.key
value: my-sssd.conf
- it: should take the whole reference from the set, not one field from each
set:
sssd:
secretRef:
name: global-sssd
key: global.conf
nodesets:
slinky:
enabled: true
ssh:
enabled: true
sssd:
secretRef:
name: my-sssd-secret
asserts:
- equal:
path: spec.ssh.sssdConfRef.name
value: my-sssd-secret
- equal:
path: spec.ssh.sssdConfRef.key
value: sssd.conf
- it: should fail when the set gives a secret key without a name
set:
nodesets:
slinky:
enabled: true
ssh:
enabled: true
sssd:
secretRef:
key: my-sssd.conf
asserts:
- failedTemplate:
errorMessage: "nodeset `slinky` sets sssd.secretRef.key without sssd.secretRef.name."
- it: should fall back to the cluster-wide sssd secretRef when the set clears it
set:
sssd:
secretRef:
name: global-sssd
key: global.conf
nodesets:
slinky:
enabled: true
ssh:
enabled: true
sssd: null
asserts:
- equal:
path: spec.ssh.sssdConfRef.name
value: global-sssd
- equal:
path: spec.ssh.sssdConfRef.key
value: global.conf
- it: should give each nodeset its own sssd secretRef
set:
nodesets:
slinky:
enabled: true
ssh:
enabled: true
slinky2:
enabled: true
ssh:
enabled: true
sssd:
secretRef:
name: my-sssd-secret
key: my-sssd.conf
asserts:
- equal:
path: spec.ssh.sssdConfRef.name
value: test-release-slurm-sssd-conf
documentIndex: 0
- equal:
path: spec.ssh.sssdConfRef.name
value: my-sssd-secret
documentIndex: 1
16 changes: 16 additions & 0 deletions helm/slurm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,14 @@ sssd:

# -- (object) Defines defaults for the LoginSet map values.
loginsetDefaults:
sssd:
# -- (secretKeyRef) Per-set `sssd.conf`, replacing the cluster-wide
# `sssd.secretRef` as a whole. Give it a `name`; `key` defaults to
# `sssd.conf` and is never inherited from the cluster-wide value. Use it
# when sets must resolve identities from different directories.
secretRef: {}
# name: my-sssd-secret
# key: sssd.conf
# -- Enable use of this LoginSet.
enabled: true
# -- Number of replicas to deploy.
Expand Down Expand Up @@ -719,6 +727,14 @@ loginsets: {}

# -- (object) Defines defaults for the NodeSet map values.
nodesetDefaults:
sssd:
# -- (secretKeyRef) Per-set `sssd.conf`, replacing the cluster-wide
# `sssd.secretRef` as a whole. Give it a `name`; `key` defaults to
# `sssd.conf` and is never inherited from the cluster-wide value. Use it
# when sets must resolve identities from different directories.
secretRef: {}
# name: my-sssd-secret
# key: sssd.conf
# -- Enable use of this NodeSet.
enabled: true
# -- Scaling mode: "StatefulSet" (fixed replica count) or "DaemonSet" (one pod per matching node).
Expand Down