Skip to content

Commit 413fd9f

Browse files
author
Michael Burke
committed
OCPBUGS50932: ClusterResourceOverride Operator modifies the pod resources even if resource requests and limits are defined
1 parent ce17dec commit 413fd9f

File tree

2 files changed

+60
-7
lines changed

2 files changed

+60
-7
lines changed

modules/nodes-cluster-resource-override.adoc

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
// * nodes/clusters/nodes-cluster-overcommit.adoc
44
// * post_installation_configuration/node-tasks.adoc
55

6+
:_mod-docs-content-type: REFERENCE
67
[id="nodes-cluster-resource-override_{context}"]
78
= Cluster-level overcommit using the Cluster Resource Override Operator
89

910
The Cluster Resource Override Operator is an admission webhook that allows you to control the level of overcommit and manage
1011
container density across all the nodes in your cluster. The Operator controls how nodes in specific projects can exceed defined memory and CPU limits.
1112

12-
You must install the Cluster Resource Override Operator using the {product-title} console or CLI as shown in the following sections.
13+
// Paragraph taken from 3.11 docs and modified.
14+
// https://docs.openshift.com/container-platform/3.11/admin_guide/overcommit.html#configuring-masters-for-overcommitment
15+
The Operator modifies the ratio between the requests and limits that are set on developer containers. In conjunction with a per-project limit range that specifies limits and defaults, you can achieve the desired level of overcommit.
16+
17+
You must install the Cluster Resource Override Operator by using the {product-title} console or CLI as shown in the following sections. After you deploy the Cluster Resource Override Operator, the Operator modifies all new pods in specific namespaces. The Operator does not edit pods that existed before you deployed the Operator.
18+
1319
During the installation, you create a `ClusterResourceOverride` custom resource (CR), where you set the level of overcommit, as shown in the
1420
following example:
1521

@@ -39,8 +45,7 @@ been set on containers. Create a `LimitRange` object with default limits per ind
3945
or configure limits in `Pod` specs for the overrides to apply.
4046
====
4147

42-
When configured, overrides can be enabled per-project by applying the following
43-
label to the Namespace object for each project:
48+
When configured, you can enable overrides on a per-project basis by applying the following label to the `Namespace` object for each project where you want the overrides to apply. For example, you can configure override so that infrastructure components are not subject to the overrides.
4449

4550
[source,yaml]
4651
----
@@ -57,3 +62,53 @@ metadata:
5762
----
5863

5964
The Operator watches for the `ClusterResourceOverride` CR and ensures that the `ClusterResourceOverride` admission webhook is installed into the same namespace as the operator.
65+
66+
// Examples take from: https://github.com/openshift/cluster-resource-override-admission-operator?tab=readme-ov-file#test-pod-resource-override
67+
For example, a pod has the following resources limits:
68+
69+
[source,yaml]
70+
----
71+
apiVersion: v1
72+
kind: Pod
73+
metadata:
74+
name: my-pod
75+
namespace: my-namespace
76+
# ...
77+
spec:
78+
containers:
79+
- name: hello-openshift
80+
image: openshift/hello-openshift
81+
resources:
82+
limits:
83+
memory: "512Mi"
84+
cpu: "2000m"
85+
# ...
86+
----
87+
88+
The Cluster Resource Override Operator intercepts the original pod request, then overrides the resources according to the configuration set in the `ClusterResourceOverride` object.
89+
90+
[source,yaml]
91+
----
92+
apiVersion: v1
93+
kind: Pod
94+
metadata:
95+
name: my-pod
96+
namespace: my-namespace
97+
# ...
98+
spec:
99+
containers:
100+
- image: openshift/hello-openshift
101+
name: hello-openshift
102+
resources:
103+
limits:
104+
cpu: "1" <1>
105+
memory: 512Mi
106+
requests:
107+
cpu: 250m <2>
108+
memory: 256Mi
109+
# ...
110+
----
111+
<1> The CPU limit has been overridden to `1` because the `limitCPUToMemoryPercent` parameter is set to `200` in the `ClusterResourceOverride` object. As such, 200% of the memory limit, 512Mi in CPU terms, is 1 CPU core.
112+
<2> The CPU request is now `250m` because the `cpuRequestToLimit` is set to `25` in the `ClusterResourceOverride` object. As such, 25% of the 1 CPU core is 250m.
113+
114+

nodes/clusters/nodes-cluster-overcommit.adoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ resource requests and nodes' available capacity into consideration.
2121

2222
ifndef::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
2323
{product-title} administrators can control the level of overcommit and manage
24-
container density on nodes. You can configure cluster-level overcommit using
25-
the xref:#nodes-cluster-resource-override_nodes-cluster-overcommit[ClusterResourceOverride Operator]
26-
to override the ratio between requests and limits set on developer containers.
27-
In conjunction with xref:#nodes-cluster-node-overcommit_nodes-cluster-overcommit[node overcommit], you can adjust the resource limit and request to achieve the desired level of overcommit.
24+
container density on developer containers by using
25+
the xref:#nodes-cluster-resource-override_nodes-cluster-overcommit[ClusterResourceOverride Operator].
2826

2927
[NOTE]
3028
====

0 commit comments

Comments
 (0)