Skip to content

Commit

Permalink
MSP-3909: Try to support node-local jail submounts
Browse files Browse the repository at this point in the history
  • Loading branch information
rdjjke committed Jan 8, 2025
1 parent 10dfeb6 commit 44b6079
Show file tree
Hide file tree
Showing 8 changed files with 1,269 additions and 20 deletions.
9 changes: 7 additions & 2 deletions api/v1/slurmcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,13 @@ type NodeVolumeJailSubMount struct {
// VolumeSourceName defines the name of the volume source for the sub-mount.
// Must correspond to the name of one of [VolumeSource]
//
// +kubebuilder:validation:Required
VolumeSourceName string `json:"volumeSourceName"`
// +kubebuilder:validation:Optional
VolumeSourceName *string `json:"volumeSourceName"`

// VolumeClaimTemplateSpec defines the [corev1.PersistentVolumeClaim] template specification
//
// +kubebuilder:validation:Optional
VolumeClaimTemplateSpec *corev1.PersistentVolumeClaimSpec `json:"volumeClaimTemplateSpec,omitempty"`
}

type Telemetry struct {
Expand Down
18 changes: 16 additions & 2 deletions api/v1/zz_generated.deepcopy.go

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

408 changes: 406 additions & 2 deletions config/crd/bases/slurm.nebius.ai_slurmclusters.yaml

Large diffs are not rendered by default.

408 changes: 406 additions & 2 deletions helm/soperator-crds/templates/slurmcluster-crd.yaml

Large diffs are not rendered by default.

408 changes: 406 additions & 2 deletions helm/soperator/crds/slurmcluster-crd.yaml

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions internal/render/login/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,19 @@ func renderVolumesAndClaimTemplateSpecs(

// Jail sub-mounts
for _, subMount := range login.JailSubMounts {
volumes = append(
volumes,
common.RenderVolumeFromSource(volumeSources, subMount.VolumeSourceName, subMount.Name),
)
if v, s, err := common.AddVolumeOrSpec(
subMount.VolumeSourceName,
func(sourceName string) corev1.Volume {
return common.RenderVolumeFromSource(volumeSources, *subMount.VolumeSourceName, subMount.Name)
},
subMount.VolumeClaimTemplateSpec,
subMount.Name,
); err != nil {
return nil, nil, err
} else {
volumes = append(volumes, v...)
pvcTemplateSpecs = append(pvcTemplateSpecs, s...)
}
}

return volumes, pvcTemplateSpecs, nil
Expand Down
17 changes: 13 additions & 4 deletions internal/render/worker/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,19 @@ func renderVolumesAndClaimTemplateSpecs(

// Jail sub-mounts
for _, subMount := range worker.JailSubMounts {
volumes = append(
volumes,
common.RenderVolumeFromSource(volumeSources, subMount.VolumeSourceName, subMount.Name),
)
if v, s, err := common.AddVolumeOrSpec(
subMount.VolumeSourceName,
func(sourceName string) corev1.Volume {
return common.RenderVolumeFromSource(volumeSources, *subMount.VolumeSourceName, subMount.Name)
},
subMount.VolumeClaimTemplateSpec,
subMount.Name,
); err != nil {
return nil, nil, err
} else {
volumes = append(volumes, v...)
pvcTemplateSpecs = append(pvcTemplateSpecs, s...)
}
}

return volumes, pvcTemplateSpecs, nil
Expand Down
4 changes: 2 additions & 2 deletions internal/values/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ func (c *SlurmCluster) Validate(ctx context.Context) error {
}
// worker jail sub-mounts
for _, subMount := range c.NodeWorker.JailSubMounts {
volumeSourceNamesRaw = append(volumeSourceNamesRaw, &subMount.VolumeSourceName)
volumeSourceNamesRaw = append(volumeSourceNamesRaw, subMount.VolumeSourceName)
}
// login jail sub-mounts
for _, subMount := range c.NodeLogin.JailSubMounts {
volumeSourceNamesRaw = append(volumeSourceNamesRaw, &subMount.VolumeSourceName)
volumeSourceNamesRaw = append(volumeSourceNamesRaw, subMount.VolumeSourceName)
}
for _, volumeSourceName := range volumeSourceNamesRaw {
if volumeSourceName == nil {
Expand Down

0 comments on commit 44b6079

Please sign in to comment.