You can use the {oc-first} to enable or disable individual feature gates on your cluster by setting the CustomNoUpgrade feature set on the FeatureGate custom resource (CR). Unlike TechPreviewNoUpgrade, which enables all Technology Preview features, CustomNoUpgrade gives you granular control over individual feature gates.
|
Warning
|
Enabling the This feature set is not supported for production clusters. Because of its nature, this setting cannot be validated. If you have any typos or accidentally apply invalid combinations, your cluster may fail in an unrecoverable way. |
-
You have installed the {oc-first}.
-
You have cluster administrator privileges.
-
Enable a specific feature gate by patching the
FeatureGateCR:$ oc patch featuregate cluster --type=merge -p \ '{"spec":{"featureSet":"CustomNoUpgrade","customNoUpgrade":{"enabled":["<feature_gate_name>"]}}}'where
<feature_gate_name>is the name of the feature gate you want to enable, for exampleClusterAPIMachineManagement. Thespec.customNoUpgrade.enabledfield accepts a string array. Each element is a feature gate name as a plain string. Do not use the object format{"name": "FeatureGateName"}, which appears instatus.featureGatesbut is not valid for the spec. -
To enable multiple feature gates at once:
$ oc patch featuregate cluster --type=merge -p \ '{"spec":{"featureSet":"CustomNoUpgrade","customNoUpgrade":{"enabled":["<feature_gate_1>","<feature_gate_2>"]}}}' -
To remove a previously enabled feature gate from the enabled list:
$ oc patch featuregate cluster --type=merge -p \ '{"spec":{"customNoUpgrade":{"enabled":[]}}}'NoteThis removes all individually enabled gates but does not revert the
CustomNoUpgradefeature set. The cluster remains onCustomNoUpgradeand minor version upgrades remain blocked. -
Alternatively, you can enable the feature set by editing the
FeatureGateCR directly:$ oc edit featuregate clusterSample FeatureGate custom resource with CustomNoUpgradeapiVersion: config.openshift.io/v1 kind: FeatureGate metadata: name: cluster spec: featureSet: CustomNoUpgrade customNoUpgrade: enabled: - <feature_gate_name> disabled: - <feature_gate_name>
where:
spec.featureSet-
Must be set to
CustomNoUpgradeto use thecustomNoUpgradefield. spec.customNoUpgrade.enabled-
A list of feature gate names to enable, specified as plain strings.
spec.customNoUpgrade.disabled-
Optional. A list of feature gate names to explicitly disable.
After you save the changes, new machine configs are created, the machine config pools are updated, and scheduling on each node is disabled while the change is being applied.
|
Note
|
The syntax for enabling feature gates differs between the
|
You can also verify the enabled feature gates by checking the FeatureGate CR status:
$ oc get featuregate cluster -o jsonpath='{.status.featureGates[0].enabled[*].name}' | tr ' ' '\n'