Skip to content

Commit 6f01ac3

Browse files
authored
Merge pull request #1493 from devfile/1492
chore: Add hostUsers field to DWOC
2 parents fc0462c + 3920ae8 commit 6f01ac3

11 files changed

+73
-0
lines changed

apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ type WorkspaceConfig struct {
196196
// If not specified or "0", the timeout is disabled.
197197
// +kubebuilder:validation:Optional
198198
PostStartTimeout string `json:"postStartTimeout,omitempty"`
199+
// Controls whether the Pod uses the host's user namespace.
200+
// If true (or omitted), the Pod runs in the host's user namespace.
201+
// If false, a new user namespace is created for the Pod.
202+
// This field is only used when the UserNamespacesSupport feature is enabled.
203+
// If the feature is disabled, setting this field may cause an endless workspace start loop.
204+
// +kubebuilder:validation:Optional
205+
HostUsers *bool `json:"hostUsers,omitempty"`
199206
}
200207

201208
type WebhookConfig struct {

apis/controller/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/bundle/manifests/controller.devfile.io_devworkspaceoperatorconfigs.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/deployment/kubernetes/combined.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/deployment/kubernetes/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/deployment/openshift/combined.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/deployment/openshift/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/templates/crd/bases/controller.devfile.io_devworkspaceoperatorconfigs.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/defaults.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ var defaultConfig = &v1alpha1.OperatorConfiguration{
8282
RetainTime: pointer.Int32(2592000),
8383
Schedule: "0 0 1 * *",
8484
},
85+
// Do not declare a default value for this field.
86+
// Setting a default leads to an endless reconcile loop when UserNamespacesSupport is disabled,
87+
// because in that case the field is ignored and always set to nil.
88+
// See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/
89+
// HostUsers: pointer.Bool(true),
8590
},
8691
}
8792

pkg/config/sync.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@ func mergeConfig(from, to *controller.OperatorConfiguration) {
435435
if from.Workspace.PostStartTimeout != "" {
436436
to.Workspace.PostStartTimeout = from.Workspace.PostStartTimeout
437437
}
438+
439+
if from.Workspace.HostUsers != nil {
440+
to.Workspace.HostUsers = from.Workspace.HostUsers
441+
}
438442
}
439443
}
440444

@@ -680,6 +684,9 @@ func GetCurrentConfigString(currConfig *controller.OperatorConfiguration) string
680684
config = append(config, fmt.Sprintf("workspace.cleanupCronJob.cronJobScript=%s", workspace.CleanupCronJob.Schedule))
681685
}
682686
}
687+
if workspace.HostUsers != nil {
688+
config = append(config, fmt.Sprintf("workspace.hostUsers=%t", *workspace.HostUsers))
689+
}
683690
}
684691
if currConfig.EnableExperimentalFeatures != nil && *currConfig.EnableExperimentalFeatures {
685692
config = append(config, "enableExperimentalFeatures=true")

0 commit comments

Comments
 (0)