Skip to content

Commit b797793

Browse files
committed
feat: allow to specify nodespec
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
1 parent a50f5ec commit b797793

6 files changed

Lines changed: 57 additions & 2 deletions

File tree

api/v1alpha1/slurm_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ type Node struct {
168168
// +optional
169169
WorkingDir string `json:"workingDir,omitempty"`
170170

171+
// Node specification. Leave empty for testing cluster
172+
// This does not include hostlist (generated automatically)
173+
// +optional
174+
Nodespec string `json:"nodespec,omitempty"`
175+
171176
// PullAlways will always pull the container
172177
// +optional
173178
PullAlways bool `json:"pullAlways"`
@@ -238,6 +243,10 @@ func (s *Slurm) Validate() bool {
238243
s.Spec.ClusterName = "linux"
239244
}
240245

246+
// Default node spec
247+
if s.Spec.Node.Nodespec == "" {
248+
s.Spec.Node.Nodespec = "RealMemory=1000 CPUs=1 State=UNKNOWN"
249+
}
241250
// Along with a username and password
242251
if s.Spec.Database.DatabaseName == "" {
243252
s.Spec.Database.DatabaseName = "slurm_acct_db"

config/crd/bases/flux-framework.org_slurms.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ spec:
6565
default: ghcr.io/converged-computing/slurm
6666
description: Image to use for slurm
6767
type: string
68+
nodespec:
69+
description: |-
70+
Node specification. Leave empty for testing cluster
71+
This does not include hostlist (generated automatically)
72+
type: string
6873
ports:
6974
description: |-
7075
Ports to be exposed to other containers in the cluster
@@ -188,6 +193,11 @@ spec:
188193
default: ghcr.io/converged-computing/slurm
189194
description: Image to use for slurm
190195
type: string
196+
nodespec:
197+
description: |-
198+
Node specification. Leave empty for testing cluster
199+
This does not include hostlist (generated automatically)
200+
type: string
191201
ports:
192202
description: |-
193203
Ports to be exposed to other containers in the cluster
@@ -266,6 +276,11 @@ spec:
266276
default: ghcr.io/converged-computing/slurm
267277
description: Image to use for slurm
268278
type: string
279+
nodespec:
280+
description: |-
281+
Node specification. Leave empty for testing cluster
282+
This does not include hostlist (generated automatically)
283+
type: string
269284
ports:
270285
description: |-
271286
Ports to be exposed to other containers in the cluster

controllers/slurm/templates.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type ConfigTemplate struct {
5050
ControlHost string
5151
DatabaseHost string
5252
Hostlist string
53+
Nodespec string
5354
}
5455

5556
// combineTemplates into one "start"
@@ -124,6 +125,7 @@ func generateConfig(cluster *api.Slurm, startTemplate string) (string, error) {
124125
DatabaseHost: database,
125126
DaemonHost: daemon,
126127
Hostlist: generateHostlist(cluster),
128+
Nodespec: cluster.Spec.Worker.Nodespec,
127129
}
128130

129131
// Wrap the named template to identify it later

controllers/slurm/templates/slurm.conf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ AccountingStoragePort=6819
8989
#AccountingStorageUser=
9090
#
9191
# COMPUTE NODES
92-
# TODO customize memory here?
93-
NodeName={{ .Hostlist }} RealMemory=1000 State=UNKNOWN
92+
NodeName={{ .Hostlist }} {{ .Spec.Node.Nodespec }}
9493
#
9594
# PARTITIONS
9695
PartitionName=normal Default=yes Nodes={{ .Hostlist }} Priority=50 DefMemPerCPU=500 Shared=NO MaxNodes=2 MaxTime=5-00:00:00 DefaultTime=5-00:00:00 State=UP

examples/dist/slurm-operator-arm.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ spec:
7777
default: ghcr.io/converged-computing/slurm
7878
description: Image to use for slurm
7979
type: string
80+
nodespec:
81+
description: |-
82+
Node specification. Leave empty for testing cluster
83+
This does not include hostlist (generated automatically)
84+
type: string
8085
ports:
8186
description: |-
8287
Ports to be exposed to other containers in the cluster
@@ -200,6 +205,11 @@ spec:
200205
default: ghcr.io/converged-computing/slurm
201206
description: Image to use for slurm
202207
type: string
208+
nodespec:
209+
description: |-
210+
Node specification. Leave empty for testing cluster
211+
This does not include hostlist (generated automatically)
212+
type: string
203213
ports:
204214
description: |-
205215
Ports to be exposed to other containers in the cluster
@@ -277,6 +287,11 @@ spec:
277287
default: ghcr.io/converged-computing/slurm
278288
description: Image to use for slurm
279289
type: string
290+
nodespec:
291+
description: |-
292+
Node specification. Leave empty for testing cluster
293+
This does not include hostlist (generated automatically)
294+
type: string
280295
ports:
281296
description: |-
282297
Ports to be exposed to other containers in the cluster

examples/dist/slurm-operator.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ spec:
7777
default: ghcr.io/converged-computing/slurm
7878
description: Image to use for slurm
7979
type: string
80+
nodespec:
81+
description: |-
82+
Node specification. Leave empty for testing cluster
83+
This does not include hostlist (generated automatically)
84+
type: string
8085
ports:
8186
description: |-
8287
Ports to be exposed to other containers in the cluster
@@ -200,6 +205,11 @@ spec:
200205
default: ghcr.io/converged-computing/slurm
201206
description: Image to use for slurm
202207
type: string
208+
nodespec:
209+
description: |-
210+
Node specification. Leave empty for testing cluster
211+
This does not include hostlist (generated automatically)
212+
type: string
203213
ports:
204214
description: |-
205215
Ports to be exposed to other containers in the cluster
@@ -277,6 +287,11 @@ spec:
277287
default: ghcr.io/converged-computing/slurm
278288
description: Image to use for slurm
279289
type: string
290+
nodespec:
291+
description: |-
292+
Node specification. Leave empty for testing cluster
293+
This does not include hostlist (generated automatically)
294+
type: string
280295
ports:
281296
description: |-
282297
Ports to be exposed to other containers in the cluster

0 commit comments

Comments
 (0)