Skip to content

Commit 4e841b5

Browse files
committed
Implement DWOC config.workspace.runtimeClassName in DWOC types
Signed-off-by: dkwon17 <[email protected]>
1 parent 8fc183f commit 4e841b5

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ type WorkspaceConfig struct {
151151
DefaultContainerResources *corev1.ResourceRequirements `json:"defaultContainerResources,omitempty"`
152152
// PodAnnotations defines the metadata.annotations for DevWorkspace pods created by the DevWorkspace Operator.
153153
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
154+
// RuntimeClassName defines the spec.runtimeClassName for DevWorkspace pods created by the DevWorkspace Operator.
155+
RuntimeClassName *string `json:"runtimeClassName,omitempty"`
154156
}
155157

156158
type WebhookConfig struct {

pkg/config/sync.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ func mergeConfig(from, to *controller.OperatorConfiguration) {
297297
if from.Workspace.StorageClassName != nil {
298298
to.Workspace.StorageClassName = from.Workspace.StorageClassName
299299
}
300+
if from.Workspace.RuntimeClassName != nil {
301+
to.Workspace.RuntimeClassName = from.Workspace.RuntimeClassName
302+
}
300303
if from.Workspace.PVCName != "" {
301304
to.Workspace.PVCName = from.Workspace.PVCName
302305
}
@@ -571,6 +574,9 @@ func GetCurrentConfigString(currConfig *controller.OperatorConfiguration) string
571574
if workspace.StorageClassName != nil && workspace.StorageClassName != defaultConfig.Workspace.StorageClassName {
572575
config = append(config, fmt.Sprintf("workspace.storageClassName=%s", *workspace.StorageClassName))
573576
}
577+
if workspace.RuntimeClassName != nil && workspace.RuntimeClassName != defaultConfig.Workspace.RuntimeClassName {
578+
config = append(config, fmt.Sprintf("workspace.runtimeClassName=%s", *workspace.RuntimeClassName))
579+
}
574580
if workspace.IdleTimeout != defaultConfig.Workspace.IdleTimeout {
575581
config = append(config, fmt.Sprintf("workspace.idleTimeout=%s", workspace.IdleTimeout))
576582
}

pkg/provision/workspace/deployment.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ func getSpecDeployment(
210210
SecurityContext: workspace.Config.Workspace.PodSecurityContext,
211211
ServiceAccountName: saName,
212212
AutomountServiceAccountToken: nil,
213+
RuntimeClassName: workspace.Config.Workspace.RuntimeClassName,
213214
},
214215
},
215216
},

0 commit comments

Comments
 (0)