Skip to content

Commit 54938cf

Browse files
committed
machine_config: add BootImageSkewEnforcement API
1 parent 674ad74 commit 54938cf

16 files changed

+9147
-5
lines changed

openapi/generated_openapi/zz_generated.openapi.go

Lines changed: 81 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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27562,6 +27562,32 @@
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+
"default": {},
27574+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ClusterBootImage"
27575+
},
27576+
"mode": {
27577+
"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.",
27578+
"type": "string",
27579+
"default": ""
27580+
}
27581+
},
27582+
"x-kubernetes-unions": [
27583+
{
27584+
"discriminator": "mode",
27585+
"fields-to-discriminateBy": {
27586+
"clusterBootImage": "ClusterBootImage"
27587+
}
27588+
}
27589+
]
27590+
},
2756527591
"com.github.openshift.api.operator.v1.CSIDriverConfigSpec": {
2756627592
"description": "CSIDriverConfigSpec defines configuration spec that can be used to optionally configure a specific CSI Driver.",
2756727593
"type": "object",
@@ -27968,6 +27994,24 @@
2796827994
}
2796927995
}
2797027996
},
27997+
"com.github.openshift.api.operator.v1.ClusterBootImage": {
27998+
"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.",
27999+
"type": "object",
28000+
"required": [
28001+
"ocpVersion"
28002+
],
28003+
"properties": {
28004+
"ocpVersion": {
28005+
"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",
28006+
"type": "string",
28007+
"default": ""
28008+
},
28009+
"rhcosVersion": {
28010+
"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]",
28011+
"type": "string"
28012+
}
28013+
}
28014+
},
2797128015
"com.github.openshift.api.operator.v1.ClusterCSIDriver": {
2797228016
"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).",
2797328017
"type": "object",
@@ -31278,6 +31322,11 @@
3127831322
"forceRedeploymentReason"
3127931323
],
3128031324
"properties": {
31325+
"bootImageSkewEnforcement": {
31326+
"description": "bootImageSkewEnforcement allows an admin to set the behavior of the boot image skew enforcement mechanism.",
31327+
"default": {},
31328+
"$ref": "#/definitions/com.github.openshift.api.operator.v1.BootImageSkewEnforcement"
31329+
},
3128131330
"failedRevisionLimit": {
3128231331
"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)",
3128331332
"type": "integer",
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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 a disabled BootImageSkewEnforcement configuration knob
62+
initial: |
63+
apiVersion: operator.openshift.io/v1
64+
kind: MachineConfiguration
65+
spec:
66+
bootImageSkewEnforcement:
67+
mode: Disabled
68+
expected: |
69+
apiVersion: operator.openshift.io/v1
70+
kind: MachineConfiguration
71+
spec:
72+
logLevel: Normal
73+
operatorLogLevel: Normal
74+
bootImageSkewEnforcement:
75+
mode: Disabled
76+
- name: Should not be able to add ClusterBootImage field if bootImageSkewEnforcement.mode is set to Disabled
77+
initial: |
78+
apiVersion: operator.openshift.io/v1
79+
kind: MachineConfiguration
80+
spec:
81+
bootImageSkewEnforcement:
82+
mode: Disabled
83+
clusterBootImage:
84+
ocpVersion: "4.18.2"
85+
rhcosVersion: "9.6.20250523-1"
86+
expectedError: "clusterBootImage is required when type is Automatic or Manual, and forbidden otherwise"
87+
- name: ClusterBootImage field should be set if bootImageSkewEnforcement.mode is set to Automatic
88+
initial: |
89+
apiVersion: operator.openshift.io/v1
90+
kind: MachineConfiguration
91+
spec:
92+
bootImageSkewEnforcement:
93+
mode: Automatic
94+
expectedError: "clusterBootImage is required when type is Automatic or Manual, and forbidden otherwise"
95+
- name: ClusterBootImage field should be set if bootImageSkewEnforcement.mode is set to Manual
96+
initial: |
97+
apiVersion: operator.openshift.io/v1
98+
kind: MachineConfiguration
99+
spec:
100+
bootImageSkewEnforcement:
101+
mode: Manual
102+
expectedError: "clusterBootImage is required when type is Automatic or Manual, and forbidden otherwise"

0 commit comments

Comments
 (0)