Skip to content

Commit 222d9e5

Browse files
Merge pull request #1751 from sairameshv/deprecate_cgrpv1
OCPNODE-2877: Update cgroups enhancement proposal to support the removal of cgroupv1
2 parents cd83ffd + 40761d4 commit 222d9e5

File tree

1 file changed

+46
-23
lines changed

1 file changed

+46
-23
lines changed

enhancements/machine-config/mco-cgroupsv2-support.md

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
title: Control Group v2 Enablement
33
authors:
44
- "@rphillips"
5+
- "@sairameshv"
56
reviewers:
67
- "@mrunalp"
8+
- "@haircommander"
79
- "@kikisdeliveryservice"
810
- "@sinnykumari"
911
- "@yuqi-zhang"
1012
- "@cgwalters"
1113
approvers:
1214
- "@mrunalp"
13-
- "@sinnykumari"
15+
- "@yuqi-zhang"
1416
api-approvers:
17+
- "@deads2k"
1518
- "@sttts"
1619
creation-date: 2021-10-19
17-
last-updated: 2021-10-20
20+
last-updated: 2025-02-05
1821
status: implementable
1922
---
2023

@@ -40,12 +43,10 @@ status: implementable
4043

4144
## Summary
4245

43-
Control Group v2 (cgroup v2) enablement in Kubernetes has progressed to beta
46+
Control Group v2 (cgroup v2) enablement in Kubernetes has progressed to stable
4447
[upstream](https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2254-cgroup-v2).
45-
The underlying runtime (cri-o) and supporting subsystems are now ready for
46-
customers to begin their own testing with it. Not all workloads will be
47-
compatible with cgroup v2, so it will *not* be enabled by default within
48-
OpenShift at this time.
48+
cgroup v2 is enabled by default in all the freshly installed Openshift clusters >= 4.14.
49+
Control Group v1 is a deprecated feature from OCP 4.16 and the support is intended to be removed from OCP >= 4.19
4950

5051
Note: This enhancement is focusing on `pure` mode cgroup v2. Mixed mode environments
5152
may behave differently (metrics, vpa, hpa, etc) since cgroup v1 is not
@@ -70,6 +71,9 @@ Some features of cgroup v2 include:
7071

7172
- [ ] Enable cgroup v2 within the Openshift API
7273
- [ ] Add kernel flags to MCO to enable cgroup v2 on nodes
74+
- [ ] Add a [CEL validation](https://kubernetes.io/docs/reference/using-api/cel/) to deny updating `CgroupMode` of the `nodes.config.openshift.io` object to `CgroupMode_V1`
75+
- [ ] Block the upgrades of the OCP clusters that are using cgroup v1 until migrated to cgroup v2
76+
- [ ] Backport the changes to OCP 4.18, add an upgrade edge in the [cincinnati-graph-data](https://github.com/openshift/cincinnati-graph-data) repository so that all the clusters update to a certain version of 4.18 i.e. 4.18.z before upgrading to 4.19
7377

7478
### Non-Goals
7579

@@ -81,12 +85,10 @@ to gather data from.
8185

8286
## Proposal
8387

84-
The option to enable cgroup v2 will have to reside in a centralized location.
85-
The [OpenShift Infrastructure config
86-
object](https://github.com/openshift/api/blob/master/config/v1/types_infrastructure.go#L28)
87-
contains information describing how a cluster functions including cloud config
88-
and platform specification for each cloud. Setting the cgroup mode is an
89-
infrastructure setting.
88+
- The option to enable cgroup v2 resides in a centralized location i.e. [OpenShift Node config
89+
object](https://github.com/openshift/api/blob/master/config/v1/types_node.go)
90+
- Set the upgrade ability of the MCO cluster operator to `false` if a cluster is on cgroup v1
91+
- A [CEL validation](https://kubernetes.io/docs/reference/using-api/cel/) is introduced to reject the setting of `CgroupModeV1` in the `nodes.config.openshift.io` object's `CgroupMode` spec field.
9092

9193
### API Extensions
9294

@@ -121,19 +123,19 @@ type NodeSpec struct {
121123

122124
### Operational Aspects of API Extensions
123125

124-
Once the previous API is defined, the MCO will read the configured object and
125-
set the appropriate kernel options (on bootstrap). The MCO will report an error
126+
- MCO reads the configured object and
127+
sets the appropriate kernel options (on bootstrap).
128+
- The MCO will report an error
126129
if a user tries to modify/add cgroup related kargs within a MachineConfig.
127-
128-
129-
The following kernel command line arguments would be set when `CgroupMode_v2` is enabled:
130+
- A CEL validation is introduced to deny the setting of `CgroupMode` field of `nodes.config.openshift.io` object to `CgroupModeV1`
131+
- MCO also reports error if a user tries to set the `CgroupMode` to `CgroupMode_V1` and sets the cluster operator's status condition of `Upgradeble=False`
132+
- The following kernel command line arguments would be observed on the machine config pools by default and also when `CgroupMode_v2` is enabled:
130133
```yaml
131134
kernelArguments:
132135
- systemd.unified_cgroup_hierarchy=1
133136
- cgroup_no_v1="all"
134137
- psi=1
135138
```
136-
137139
#### Failure Modes
138140
139141
N/A
@@ -201,19 +203,40 @@ The following jobs will be run against cgroup v2 periodically and with a minimum
201203
202204
### Upgrade / Downgrade Strategy
203205
204-
Downgrading a cluster to an OpenShift version not containing cgroup v2 support
206+
- Downgrading a cluster to an OpenShift version not containing cgroup v2 support
205207
is unsupported.
206-
208+
- Upgrading a cluster which is on cgroup v1 to a version >= 4.19 is blocked until it is migrated to cgroup v2.
209+
In such case, the MCO cluster operator's status condition is set to `Upgradeable=False` blocking the upgrade.
210+
- A user/admin has to manually set the `CgroupMode` from `v1` to `v2` as follows to make it `Upgradeable=True` again.
211+
- A user/admin has to upgrade to a certain minimum version of 4.18.z according to the [cincinnati-graph-data](https://github.com/openshift/cincinnati-graph-data) before upgrading to 4.19 so that there is a seamless upgrade.
212+
```shell
213+
# fetch the nodes.config.openshift.io object
214+
oc edit nodes.config.openshift.io cluster
215+
# Update the `CgroupMode` field inside the spec to "v2"
216+
# Wait for the MCO to rollout cgroup v2 related kernel arguments on all the machine config pools
217+
```
207218
### Version Skew Strategy
208219

209220
A cluster installed with cgroup v2 will abide by the usual skew upgrade path.
210221

211222
#### Removing a deprecated feature
223+
cgroup v1 support would be removed from the future versions of RHEL and hence the setting of `CgroupMode_V1` would be denied by [CEL validation](https://kubernetes.io/docs/reference/using-api/cel/) from OCP clusters(>= 4.19)
212224

213-
N/A
225+
Note: Even after removing the support to configure cgroup v1 from OCP, the `CgroupMode_V1` is not deleted as one of the enum values for the `CgroupMode` in the interest of non-breaking API changes.
214226

215227
## Implementation History
216-
228+
Following code change inside the MCO [operator](https://github.com/openshift/machine-config-operator/blob/master/pkg/operator/status.go#L265)'s `pkg/operator/status.go` sets the ClusterOperator's `Upgradeable` status to `False` if the cluster is found to be using `CgroupMode_V1`
229+
```go
230+
configNode, err := optr.configClient.ConfigV1().Nodes().Get(context.Background(), ctrlcommon.ClusterNodeInstanceName, metav1.GetOptions{})
231+
if err != nil {
232+
return err
233+
}
234+
if configNode.Spec.CgroupMode == configv1.CgroupModeV1 {
235+
coStatusCondition.Status = configv1.ConditionFalse
236+
coStatusCondition.Reason = "ClusterOnCgroupV1"
237+
coStatusCondition.Message = "Cluster is using cgroup v1 and is not upgradable. Please update the `CgroupMode` in the `nodes.config.openshift.io` object to 'v2'. Once upgraded, the cluster cannot be changed back to cgroup v1"
238+
}
239+
```
217240
## Alternatives
218241

219242
## Drawbacks

0 commit comments

Comments
 (0)