Skip to content

Commit 04ee2bb

Browse files
committed
Allow AZs to be Omitted at Runtime
CAPI appears to make implicit CP scheduling decisions based on what it's told is available by CAPO on an "LRU" basis. It also assumes an infinite sized AZ, so problems begin when the "next" AZ cannot accommodate the VM. We could manually specify an AZ that aggregates all machines explcitly, however this is another mechanism that disables scheduling by CAPI altogether and allows Nova to do what it does, along with a soft-AA rule. However, switching from CAPI scheduling to Nova scheduling is impossible as the field is immutable, so allow this. Testing shows existing scheduled clusters undergo no topology changes, which will be due to the KCPM not taking action, but you can force the changes with a rolling upgrade of some variety. Crucially, if a cluster with CAPI scheduling gets stuck, we can modify to Nova scheduling and it should pick up the new specification and get past the hurdle.
1 parent 47b87c8 commit 04ee2bb

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

api/v1alpha8/openstackcluster_webhook.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ func (r *OpenStackCluster) ValidateUpdate(oldRaw runtime.Object) (admission.Warn
130130
old.Spec.ControlPlaneAvailabilityZones = []string{}
131131
r.Spec.ControlPlaneAvailabilityZones = []string{}
132132

133+
// Allow the scheduling to be changed from CAPI managed to Nova and
134+
// vice versa.
135+
old.Spec.ControlPlaneOmitAvailabilityZone = false
136+
r.Spec.ControlPlaneOmitAvailabilityZone = false
137+
133138
// Allow change to the allowAllInClusterTraffic.
134139
old.Spec.AllowAllInClusterTraffic = false
135140
r.Spec.AllowAllInClusterTraffic = false

api/v1alpha8/openstackcluster_webhook_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,21 @@ func TestOpenStackCluster_ValidateUpdate(t *testing.T) {
234234
},
235235
wantErr: false,
236236
},
237+
{
238+
name: "Modifying OpenstackCluster.Spec.ControlPlaneOmitAvailabilityZone is allowed",
239+
oldTemplate: &OpenStackCluster{
240+
Spec: OpenStackClusterSpec{
241+
CloudName: "foobar",
242+
},
243+
},
244+
newTemplate: &OpenStackCluster{
245+
Spec: OpenStackClusterSpec{
246+
CloudName: "foobar",
247+
ControlPlaneOmitAvailabilityZone: true,
248+
},
249+
},
250+
wantErr: false,
251+
},
237252
{
238253
name: "Changing OpenStackCluster.Spec.APIServerFixedIP is allowed when API Server Floating IP is disabled",
239254
oldTemplate: &OpenStackCluster{

0 commit comments

Comments
 (0)