|
| 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 | +- ManagedBootImages |
| 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 empty ManagedBootImages configuration knob |
| 20 | + initial: | |
| 21 | + apiVersion: operator.openshift.io/v1 |
| 22 | + kind: MachineConfiguration |
| 23 | + spec: |
| 24 | + managedBootImages: |
| 25 | + machineManagers: [] |
| 26 | + expected: | |
| 27 | + apiVersion: operator.openshift.io/v1 |
| 28 | + kind: MachineConfiguration |
| 29 | + spec: |
| 30 | + logLevel: Normal |
| 31 | + operatorLogLevel: Normal |
| 32 | + managedBootImages: |
| 33 | + machineManagers: [] |
| 34 | + - name: Should be able to create a ManagedBootImages configuration knob that opts in all ControlPlaneMachineSets |
| 35 | + initial: | |
| 36 | + apiVersion: operator.openshift.io/v1 |
| 37 | + kind: MachineConfiguration |
| 38 | + spec: |
| 39 | + managedBootImages: |
| 40 | + machineManagers: |
| 41 | + - resource: controlplanemachinesets |
| 42 | + apiGroup: machine.openshift.io |
| 43 | + selection: |
| 44 | + mode: All |
| 45 | + expected: | |
| 46 | + apiVersion: operator.openshift.io/v1 |
| 47 | + kind: MachineConfiguration |
| 48 | + spec: |
| 49 | + logLevel: Normal |
| 50 | + operatorLogLevel: Normal |
| 51 | + managedBootImages: |
| 52 | + machineManagers: |
| 53 | + - resource: controlplanemachinesets |
| 54 | + apiGroup: machine.openshift.io |
| 55 | + selection: |
| 56 | + mode: All |
| 57 | + - name: Should be able to create a ManagedBootImages configuration knob that opts in ControlPlaneMachineSets in partial mode |
| 58 | + initial: | |
| 59 | + apiVersion: operator.openshift.io/v1 |
| 60 | + kind: MachineConfiguration |
| 61 | + spec: |
| 62 | + managedBootImages: |
| 63 | + machineManagers: |
| 64 | + - resource: controlplanemachinesets |
| 65 | + apiGroup: machine.openshift.io |
| 66 | + selection: |
| 67 | + mode: Partial |
| 68 | + partial: |
| 69 | + machineResourceSelector: |
| 70 | + matchLabels: {} |
| 71 | + expected: | |
| 72 | + apiVersion: operator.openshift.io/v1 |
| 73 | + kind: MachineConfiguration |
| 74 | + spec: |
| 75 | + logLevel: Normal |
| 76 | + operatorLogLevel: Normal |
| 77 | + managedBootImages: |
| 78 | + machineManagers: |
| 79 | + - resource: controlplanemachinesets |
| 80 | + apiGroup: machine.openshift.io |
| 81 | + selection: |
| 82 | + mode: Partial |
| 83 | + partial: |
| 84 | + machineResourceSelector: |
| 85 | + matchLabels: {} |
| 86 | + - name: Should not be able to add partial field if machineManager.selection.mode is not set to Partial |
| 87 | + initial: | |
| 88 | + apiVersion: operator.openshift.io/v1 |
| 89 | + kind: MachineConfiguration |
| 90 | + spec: |
| 91 | + managedBootImages: |
| 92 | + machineManagers: |
| 93 | + - resource: controlplanemachinesets |
| 94 | + apiGroup: machine.openshift.io |
| 95 | + selection: |
| 96 | + mode: All |
| 97 | + partial: |
| 98 | + machineResourceSelector: |
| 99 | + matchLabels: {} |
| 100 | + expectedError: "Partial is required when type is partial, and forbidden otherwise" |
| 101 | + - name: Only one unique pair of resource/apigroup is allowed in machineManagers |
| 102 | + initial: | |
| 103 | + apiVersion: operator.openshift.io/v1 |
| 104 | + kind: MachineConfiguration |
| 105 | + spec: |
| 106 | + managedBootImages: |
| 107 | + machineManagers: |
| 108 | + - resource: controlplanemachinesets |
| 109 | + apiGroup: machine.openshift.io |
| 110 | + selection: |
| 111 | + mode: Partial |
| 112 | + partial: |
| 113 | + machineResourceSelector: |
| 114 | + matchLabels: {} |
| 115 | + - resource: controlplanemachinesets |
| 116 | + apiGroup: machine.openshift.io |
| 117 | + selection: |
| 118 | + mode: All |
| 119 | + expectedError: "spec.managedBootImages.machineManagers[1]: Duplicate value: map[string]interface {}{\"apiGroup\":\"machine.openshift.io\", \"resource\":\"machinesets\"}" |
0 commit comments