|
| 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