|
7 | 7 |
|
8 | 8 | configv1 "github.com/openshift/api/config/v1" |
9 | 9 | "github.com/openshift/installer/pkg/types" |
10 | | - "github.com/openshift/installer/pkg/types/gcp" |
| 10 | + "github.com/openshift/installer/pkg/types/aws" |
| 11 | + gcp "github.com/openshift/installer/pkg/types/gcp" |
11 | 12 | ) |
12 | 13 |
|
13 | 14 | func defaultMachinePoolWithReplicaCount(name string, replicaCount int) *types.MachinePool { |
@@ -144,61 +145,57 @@ func TestSetMahcinePoolDefaults(t *testing.T) { |
144 | 145 | } |
145 | 146 |
|
146 | 147 | func TestSetMachinePoolDefaultsWithFeatureGates(t *testing.T) { |
| 148 | + awsPlatform := &types.Platform{AWS: &aws.Platform{}} |
| 149 | + |
147 | 150 | cases := []struct { |
148 | 151 | name string |
149 | 152 | pool *types.MachinePool |
150 | 153 | platform *types.Platform |
151 | | - featureSet configv1.FeatureSet |
| 154 | + featureGates []string |
152 | 155 | expectedManagement types.MachineManagementAPI |
153 | 156 | }{ |
154 | 157 | { |
155 | | - name: "control plane with DevPreviewNoUpgrade feature set", |
156 | | - pool: &types.MachinePool{Name: types.MachinePoolControlPlaneRoleName}, |
157 | | - platform: &types.Platform{}, |
158 | | - featureSet: configv1.DevPreviewNoUpgrade, |
| 158 | + name: "AWS compute sets ClusterAPI management when ClusterAPIMachineManagementAWS enabled", |
| 159 | + pool: &types.MachinePool{Name: types.MachinePoolComputeRoleName}, |
| 160 | + platform: awsPlatform, |
| 161 | + featureGates: []string{"ClusterAPIMachineManagementAWS=True"}, |
159 | 162 | expectedManagement: types.ClusterAPI, |
160 | 163 | }, |
161 | 164 | { |
162 | | - name: "control plane with default feature set", |
163 | | - pool: &types.MachinePool{Name: types.MachinePoolControlPlaneRoleName}, |
164 | | - platform: &types.Platform{}, |
165 | | - featureSet: configv1.Default, |
| 165 | + name: "AWS compute management is unchanged when ClusterAPIMachineManagementAWS disabled", |
| 166 | + pool: &types.MachinePool{Name: types.MachinePoolComputeRoleName}, |
| 167 | + platform: awsPlatform, |
| 168 | + featureGates: []string{"ClusterAPIMachineManagementAWS=False"}, |
166 | 169 | expectedManagement: "", |
167 | 170 | }, |
168 | 171 | { |
169 | | - name: "compute with DevPreviewNoUpgrade feature set", |
170 | | - pool: &types.MachinePool{Name: types.MachinePoolComputeRoleName}, |
171 | | - platform: &types.Platform{}, |
172 | | - featureSet: configv1.DevPreviewNoUpgrade, |
173 | | - expectedManagement: types.ClusterAPI, |
| 172 | + name: "AWS control plane is unaffected by ClusterAPIMachineManagementAWS", |
| 173 | + pool: &types.MachinePool{Name: types.MachinePoolControlPlaneRoleName}, |
| 174 | + platform: awsPlatform, |
| 175 | + featureGates: []string{"ClusterAPIMachineManagementAWS=True"}, |
| 176 | + expectedManagement: "", |
174 | 177 | }, |
175 | 178 | { |
176 | | - name: "compute with default feature set", |
| 179 | + name: "non-AWS compute is unaffected by ClusterAPIMachineManagementAWS", |
177 | 180 | pool: &types.MachinePool{Name: types.MachinePoolComputeRoleName}, |
178 | 181 | platform: &types.Platform{}, |
179 | | - featureSet: configv1.Default, |
| 182 | + featureGates: []string{"ClusterAPIMachineManagementAWS=True"}, |
180 | 183 | expectedManagement: "", |
181 | 184 | }, |
182 | 185 | { |
183 | | - name: "control plane with management already set", |
184 | | - pool: &types.MachinePool{Name: types.MachinePoolControlPlaneRoleName, Management: types.MachineAPI}, |
185 | | - platform: &types.Platform{}, |
186 | | - featureSet: configv1.DevPreviewNoUpgrade, |
187 | | - expectedManagement: types.MachineAPI, |
188 | | - }, |
189 | | - { |
190 | | - name: "compute with management already set", |
| 186 | + name: "AWS compute management is not overwritten when already set", |
191 | 187 | pool: &types.MachinePool{Name: types.MachinePoolComputeRoleName, Management: types.MachineAPI}, |
192 | | - platform: &types.Platform{}, |
193 | | - featureSet: configv1.DevPreviewNoUpgrade, |
| 188 | + platform: awsPlatform, |
| 189 | + featureGates: []string{"ClusterAPIMachineManagementAWS=True"}, |
194 | 190 | expectedManagement: types.MachineAPI, |
195 | 191 | }, |
196 | 192 | } |
197 | 193 |
|
198 | 194 | for _, tc := range cases { |
199 | 195 | t.Run(tc.name, func(t *testing.T) { |
200 | 196 | config := &types.InstallConfig{ |
201 | | - FeatureSet: tc.featureSet, |
| 197 | + FeatureSet: configv1.CustomNoUpgrade, |
| 198 | + FeatureGates: tc.featureGates, |
202 | 199 | } |
203 | 200 | SetMachinePoolDefaults(tc.pool, tc.platform, config.EnabledFeatureGates()) |
204 | 201 | assert.Equal(t, tc.expectedManagement, tc.pool.Management, "unexpected management API") |
|
0 commit comments