Skip to content

Commit 0344f1e

Browse files
committed
machine_config: add BootImageSkewEnforcement API
1 parent 674ad74 commit 0344f1e

16 files changed

+9203
-5
lines changed

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 80 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi/openapi.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27562,6 +27562,31 @@
2756227562
}
2756327563
}
2756427564
},
27565+
"com.github.openshift.api.operator.v1.BootImageSkewEnforcement": {
27566+
"type": "object",
27567+
"required": [
27568+
"mode"
27569+
],
27570+
"properties": {
27571+
"clusterBootImage": {
27572+
"description": "clusterBootImage describes the current boot image of the cluster. This will be used to enforce the skew limit. This value will be compared against the cluster's skew limit to determine skew compliance. Required when mode is set to \"Automatic\" or \"Manual\" and forbidden otherwise.",
27573+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ClusterBootImage"
27574+
},
27575+
"mode": {
27576+
"description": "mode determines the underlying behavior of skew enforcement mechanism. Valid values are Automatic, Manual and None. Automatic means that the MCO will store the OCP version associated with the last boot image update in the clusterBootImage field. Manual means that the cluster admin is expected to perform manual boot image updates and store OCP version associated with the last boot image update in the clusterBootImage field. In Automatic and Manual mode, the MCO will prevent upgrades when the boot image skew exceeds the skew limit described by the release image. None means that the MCO will permit upgrades when the boot image exceeds the skew limit described by the release image. This will affect the cluster's ability to scale. This field is required.",
27577+
"type": "string",
27578+
"default": ""
27579+
}
27580+
},
27581+
"x-kubernetes-unions": [
27582+
{
27583+
"discriminator": "mode",
27584+
"fields-to-discriminateBy": {
27585+
"clusterBootImage": "ClusterBootImage"
27586+
}
27587+
}
27588+
]
27589+
},
2756527590
"com.github.openshift.api.operator.v1.CSIDriverConfigSpec": {
2756627591
"description": "CSIDriverConfigSpec defines configuration spec that can be used to optionally configure a specific CSI Driver.",
2756727592
"type": "object",
@@ -27968,6 +27993,24 @@
2796827993
}
2796927994
}
2797027995
},
27996+
"com.github.openshift.api.operator.v1.ClusterBootImage": {
27997+
"description": "ClusterBootImage describes the boot image of a cluster. It stores the RHCOS version of the boot image and the OCP release version which shipped with that RHCOS boot image. If ocpVersion and rhcosVersion are defined, both values will be used for checking skew compliance. If only ocpVersion is defined, only that value will be used for checking skew compliance.",
27998+
"type": "object",
27999+
"required": [
28000+
"ocpVersion"
28001+
],
28002+
"properties": {
28003+
"ocpVersion": {
28004+
"description": "ocpVersion provides a string which represents the OCP version of the boot image. This field must match the OCP semver compatible format of x.y.z",
28005+
"type": "string",
28006+
"default": ""
28007+
},
28008+
"rhcosVersion": {
28009+
"description": "rhcosVersion provides a string which represents the RHCOS version of the boot image This field must match rhcosVersion formatting of [major].[minor].[datestamp(YYYYMMDD)]-[buildnumber] or the legacy format of [major].[minor].[timestamp(YYYYMMDDHHmm)]-[buildnumber]",
28010+
"type": "string"
28011+
}
28012+
}
28013+
},
2797128014
"com.github.openshift.api.operator.v1.ClusterCSIDriver": {
2797228015
"description": "ClusterCSIDriver object allows management and configuration of a CSI driver operator installed by default in OpenShift. Name of the object must be name of the CSI driver it operates. See CSIDriverName type for list of allowed values.\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).",
2797328016
"type": "object",
@@ -31278,6 +31321,11 @@
3127831321
"forceRedeploymentReason"
3127931322
],
3128031323
"properties": {
31324+
"bootImageSkewEnforcement": {
31325+
"description": "bootImageSkewEnforcement allows an admin to set the behavior of the boot image skew enforcement mechanism.",
31326+
"default": {},
31327+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.BootImageSkewEnforcement"
31328+
},
3128131329
"failedRevisionLimit": {
3128231330
"description": "failedRevisionLimit is the number of failed static pod installer revisions to keep on disk and in the api -1 = unlimited, 0 or unset = 5 (default)",
3128331331
"type": "integer",
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
2+
name: "MachineConfiguration"
3+
crdName: machineconfigurations.operator.openshift.io
4+
featureGates:
5+
- BootImageSkewEnforcement
6+
tests:
7+
onCreate:
8+
- name: Should be able to create a minimal MachineConfiguration
9+
initial: |
10+
apiVersion: operator.openshift.io/v1
11+
kind: MachineConfiguration
12+
spec: {} # No spec is required for a MachineConfiguration
13+
expected: |
14+
apiVersion: operator.openshift.io/v1
15+
kind: MachineConfiguration
16+
spec:
17+
logLevel: Normal
18+
operatorLogLevel: Normal
19+
- name: Should be able to create an manual BootImageSkewEnforcement configuration knob
20+
initial: |
21+
apiVersion: operator.openshift.io/v1
22+
kind: MachineConfiguration
23+
spec:
24+
bootImageSkewEnforcement:
25+
mode: Manual
26+
clusterBootImage:
27+
ocpVersion: "4.18.2"
28+
rhcosVersion: "9.6.20250523-1"
29+
expected: |
30+
apiVersion: operator.openshift.io/v1
31+
kind: MachineConfiguration
32+
spec:
33+
logLevel: Normal
34+
operatorLogLevel: Normal
35+
bootImageSkewEnforcement:
36+
mode: Manual
37+
clusterBootImage:
38+
ocpVersion: "4.18.2"
39+
rhcosVersion: "9.6.20250523-1"
40+
- name: Should be able to create an automatic BootImageSkewEnforcement configuration knob
41+
initial: |
42+
apiVersion: operator.openshift.io/v1
43+
kind: MachineConfiguration
44+
spec:
45+
bootImageSkewEnforcement:
46+
mode: Automatic
47+
clusterBootImage:
48+
ocpVersion: "4.18.2"
49+
rhcosVersion: "9.6.20250523-1"
50+
expected: |
51+
apiVersion: operator.openshift.io/v1
52+
kind: MachineConfiguration
53+
spec:
54+
logLevel: Normal
55+
operatorLogLevel: Normal
56+
bootImageSkewEnforcement:
57+
mode: Automatic
58+
clusterBootImage:
59+
ocpVersion: "4.18.2"
60+
rhcosVersion: "9.6.20250523-1"
61+
- name: Should be able to create an manual BootImageSkewEnforcement configuration knob with a legacy cluster boot image
62+
initial: |
63+
apiVersion: operator.openshift.io/v1
64+
kind: MachineConfiguration
65+
spec:
66+
bootImageSkewEnforcement:
67+
mode: Manual
68+
clusterBootImage:
69+
ocpVersion: "4.18.2"
70+
rhcosVersion: "416.94.202411201433-0"
71+
expected: |
72+
apiVersion: operator.openshift.io/v1
73+
kind: MachineConfiguration
74+
spec:
75+
logLevel: Normal
76+
operatorLogLevel: Normal
77+
bootImageSkewEnforcement:
78+
mode: Manual
79+
clusterBootImage:
80+
ocpVersion: "4.18.2"
81+
rhcosVersion: "416.94.202411201433-0"
82+
- name: Should be able to create an automatic BootImageSkewEnforcement configuration knob with a legacy cluster boot image
83+
initial: |
84+
apiVersion: operator.openshift.io/v1
85+
kind: MachineConfiguration
86+
spec:
87+
bootImageSkewEnforcement:
88+
mode: Automatic
89+
clusterBootImage:
90+
ocpVersion: "4.18.2"
91+
rhcosVersion: "416.94.202411201433-0"
92+
expected: |
93+
apiVersion: operator.openshift.io/v1
94+
kind: MachineConfiguration
95+
spec:
96+
logLevel: Normal
97+
operatorLogLevel: Normal
98+
bootImageSkewEnforcement:
99+
mode: Automatic
100+
clusterBootImage:
101+
ocpVersion: "4.18.2"
102+
rhcosVersion: "416.94.202411201433-0"
103+
- name: Should be able to create a None BootImageSkewEnforcement configuration knob
104+
initial: |
105+
apiVersion: operator.openshift.io/v1
106+
kind: MachineConfiguration
107+
spec:
108+
bootImageSkewEnforcement:
109+
mode: None
110+
expected: |
111+
apiVersion: operator.openshift.io/v1
112+
kind: MachineConfiguration
113+
spec:
114+
logLevel: Normal
115+
operatorLogLevel: Normal
116+
bootImageSkewEnforcement:
117+
mode: None
118+
- name: Should not be able to add ClusterBootImage field if bootImageSkewEnforcement.mode is set to None
119+
initial: |
120+
apiVersion: operator.openshift.io/v1
121+
kind: MachineConfiguration
122+
spec:
123+
bootImageSkewEnforcement:
124+
mode: None
125+
clusterBootImage:
126+
ocpVersion: "4.18.2"
127+
rhcosVersion: "9.6.20250523-1"
128+
expectedError: "clusterBootImage is required when mode is Automatic or Manual, and forbidden otherwise"
129+
- name: ClusterBootImage field should be set if bootImageSkewEnforcement.mode is set to Automatic
130+
initial: |
131+
apiVersion: operator.openshift.io/v1
132+
kind: MachineConfiguration
133+
spec:
134+
bootImageSkewEnforcement:
135+
mode: Automatic
136+
expectedError: "clusterBootImage is required when mode is Automatic or Manual, and forbidden otherwise"
137+
- name: ClusterBootImage field should be set if bootImageSkewEnforcement.mode is set to Manual
138+
initial: |
139+
apiVersion: operator.openshift.io/v1
140+
kind: MachineConfiguration
141+
spec:
142+
bootImageSkewEnforcement:
143+
mode: Manual
144+
expectedError: "clusterBootImage is required when mode is Automatic or Manual, and forbidden otherwise"

0 commit comments

Comments
 (0)