Skip to content

Commit 35acc7c

Browse files
Merge pull request openshift#8226 from sadasu/sadasu-bug-4466
OCPBUGS-4466: Add check for compact-cluster install on GCP, AWS & Azure
2 parents 523f573 + 94eeb5d commit 35acc7c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pkg/asset/cluster/tfvars/tfvars.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,13 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
272272
if err != nil {
273273
return err
274274
}
275+
// Based on the number of workers, we could have the following outcomes:
276+
// 1. workers > 0, masters not schedulable, valid cluster
277+
// 2. workers = 0, masters schedulable, valid compact cluster but currently unsupported
278+
// 3. workers = 0, masters not schedulable, invalid cluster
279+
if len(workers) == 0 {
280+
return errors.Errorf("compact clusters with 0 workers are not supported at this time")
281+
}
275282
workerConfigs := make([]*machinev1beta1.AWSMachineProviderConfig, len(workers))
276283
for i, m := range workers {
277284
workerConfigs[i] = m.Spec.Template.Spec.ProviderSpec.Value.Object.(*machinev1beta1.AWSMachineProviderConfig) //nolint:errcheck // legacy, pre-linter
@@ -370,6 +377,13 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
370377
if err != nil {
371378
return err
372379
}
380+
// Based on the number of workers, we could have the following outcomes:
381+
// 1. workers > 0, masters not schedulable, valid cluster
382+
// 2. workers = 0, masters schedulable, valid compact cluster but currently unsupported
383+
// 3. workers = 0, masters not schedulable, invalid cluster
384+
if len(workers) == 0 {
385+
return errors.Errorf("compact clusters with 0 workers are not supported at this time")
386+
}
373387
workerConfigs := make([]*machinev1beta1.AzureMachineProviderSpec, len(workers))
374388
for i, w := range workers {
375389
workerConfigs[i] = w.Spec.Template.Spec.ProviderSpec.Value.Object.(*machinev1beta1.AzureMachineProviderSpec) //nolint:errcheck // legacy, pre-linter
@@ -485,6 +499,13 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
485499
if err != nil {
486500
return err
487501
}
502+
// Based on the number of workers, we could have the following outcomes:
503+
// 1. workers > 0, masters not schedulable, valid cluster
504+
// 2. workers = 0, masters schedulable, valid compact cluster but currently unsupported
505+
// 3. workers = 0, masters not schedulable, invalid cluster
506+
if len(workers) == 0 {
507+
return errors.Errorf("compact clusters with 0 workers are not supported at this time")
508+
}
488509
workerConfigs := make([]*machinev1beta1.GCPMachineProviderSpec, len(workers))
489510
for i, w := range workers {
490511
workerConfigs[i] = w.Spec.Template.Spec.ProviderSpec.Value.Object.(*machinev1beta1.GCPMachineProviderSpec) //nolint:errcheck // legacy, pre-linter

0 commit comments

Comments
 (0)