Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ type WorkspaceConfig struct {
// If not specified or "0", the timeout is disabled.
// +kubebuilder:validation:Optional
PostStartTimeout string `json:"postStartTimeout,omitempty"`
// Controls whether the Pod uses the host's user namespace.
// If true (or omitted), the Pod runs in the host's user namespace.
// If false, a new user namespace is created for the Pod.
// This field is only used when the UserNamespacesSupport feature is enabled.
// If the feature is disabled, setting this field may cause an endless workspace start loop.
// +kubebuilder:validation:Optional
HostUsers *bool `json:"hostUsers,omitempty"`
}

type WebhookConfig struct {
Expand Down
5 changes: 5 additions & 0 deletions apis/controller/v1alpha1/zz_generated.deepcopy.go

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

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

8 changes: 8 additions & 0 deletions deploy/deployment/kubernetes/combined.yaml

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

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

8 changes: 8 additions & 0 deletions deploy/deployment/openshift/combined.yaml

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

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

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

5 changes: 5 additions & 0 deletions pkg/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ var defaultConfig = &v1alpha1.OperatorConfiguration{
RetainTime: pointer.Int32(2592000),
Schedule: "0 0 1 * *",
},
// Do not declare a default value for this field.
// Setting a default leads to an endless reconcile loop when UserNamespacesSupport is disabled,
// because in that case the field is ignored and always set to nil.
// See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/
// HostUsers: pointer.Bool(true),
},
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/config/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ func mergeConfig(from, to *controller.OperatorConfiguration) {
if from.Workspace.PostStartTimeout != "" {
to.Workspace.PostStartTimeout = from.Workspace.PostStartTimeout
}

if from.Workspace.HostUsers != nil {
to.Workspace.HostUsers = from.Workspace.HostUsers
}
}
}

Expand Down Expand Up @@ -680,6 +684,9 @@ func GetCurrentConfigString(currConfig *controller.OperatorConfiguration) string
config = append(config, fmt.Sprintf("workspace.cleanupCronJob.cronJobScript=%s", workspace.CleanupCronJob.Schedule))
}
}
if workspace.HostUsers != nil {
config = append(config, fmt.Sprintf("workspace.hostUsers=%t", *workspace.HostUsers))
}
}
if currConfig.EnableExperimentalFeatures != nil && *currConfig.EnableExperimentalFeatures {
config = append(config, "enableExperimentalFeatures=true")
Expand Down
1 change: 1 addition & 0 deletions pkg/provision/workspace/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func getSpecDeployment(
ServiceAccountName: saName,
AutomountServiceAccountToken: nil,
RuntimeClassName: workspace.Config.Workspace.RuntimeClassName,
HostUsers: workspace.Config.Workspace.HostUsers,
},
},
},
Expand Down
Loading