Skip to content

Commit 8276d1f

Browse files
authored
Merge pull request #1545 from devfile/CRW-9546
Add container resource caps enforcement for workspace containers
2 parents dad556b + e3ea44f commit 8276d1f

14 files changed

+567
-2
lines changed

apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ type WorkspaceConfig struct {
224224
// the value "0" should be used. By default, the memory limit is 128Mi and the memory request is 64Mi.
225225
// No CPU limit or request is added by default.
226226
DefaultContainerResources *corev1.ResourceRequirements `json:"defaultContainerResources,omitempty"`
227+
// ContainerResourceCaps defines the maximum resource requirements enforced for workspace
228+
// containers. If a container specifies limits or requests that exceed these values, they
229+
// will be capped at the maximum. Note: Caps only apply when resources are already specified
230+
// on a container. For containers without resource specifications, use DefaultContainerResources
231+
// instead. These resource caps do not apply to initContainers or the projectClone container.
232+
ContainerResourceCaps *corev1.ResourceRequirements `json:"containerResourceCaps,omitempty"`
227233
// PodAnnotations defines the metadata.annotations for DevWorkspace pods created by the DevWorkspace Operator.
228234
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
229235
// RuntimeClassName defines the spec.runtimeClassName for DevWorkspace pods created by the DevWorkspace Operator.

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.

controllers/workspace/devworkspace_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ func (r *DevWorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request
335335
workspace.Config.Workspace.ContainerSecurityContext,
336336
workspace.Config.Workspace.ImagePullPolicy,
337337
workspace.Config.Workspace.DefaultContainerResources,
338+
workspace.Config.Workspace.ContainerResourceCaps,
338339
workspace.Config.Workspace.PostStartTimeout,
339340
postStartDebugTrapSleepDuration,
340341
)

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

Lines changed: 64 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: 64 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: 64 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: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)