Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ spec:
format: int32
type: integer
type: object
zones:
description: Zones defines available zones
items:
type: string
type: array
type: object
type: object
replicas:
Expand Down Expand Up @@ -980,6 +985,11 @@ spec:
format: int32
type: integer
type: object
zones:
description: Zones defines available zones
items:
type: string
type: array
type: object
type: object
replicas:
Expand Down Expand Up @@ -2234,6 +2244,11 @@ spec:
format: int32
type: integer
type: object
zones:
description: Zones defines available zones
items:
type: string
type: array
type: object
diskType:
description: DiskType is the name of the disk provisioning type,
Expand Down
5 changes: 5 additions & 0 deletions pkg/types/vsphere/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ type MachinePool struct {
//
// +optional
OSDisk `json:"osDisk"`

// Zones defines available zones
//
// +omitempty
Zones []string `json:"zones,omitempty"`
}

// OSDisk defines the disk for a virtual machine.
Expand Down
9 changes: 9 additions & 0 deletions pkg/types/vsphere/validation/machinepool.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package validation

import (
"github.com/openshift/installer/pkg/validate"
"k8s.io/apimachinery/pkg/util/validation/field"

"github.com/openshift/installer/pkg/types/vsphere"
Expand All @@ -24,5 +25,13 @@ func ValidateMachinePool(p *vsphere.MachinePool, fldPath *field.Path) field.Erro
if p.NumCoresPerSocket >= 0 && p.NumCPUs >= 0 && p.NumCoresPerSocket > p.NumCPUs {
allErrs = append(allErrs, field.Invalid(fldPath.Child("coresPerSocket"), p.NumCoresPerSocket, "cores per socket must be less than number of CPUs"))
}
if len(p.Zones) > 0 {
for _, zone := range p.Zones {
err := validate.ClusterName1035(zone)
if err != nil {
allErrs = append(allErrs, field.Invalid(fldPath.Child("zones"), p.Zones, err.Error()))
}
}
}
return allErrs
}
8 changes: 8 additions & 0 deletions pkg/types/vsphere/validation/machinepool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ func TestValidateMachinePool(t *testing.T) {
NumCoresPerSocket: 8,
},
expectedErrMsg: `^test-path\.coresPerSocket: Invalid value: 8: cores per socket must be less than number of CPUs$`,
}, {
name: "invalid zone name",
pool: &vsphere.MachinePool{
Zones: []string{
"Zone%^@112233",
},
},
expectedErrMsg: `^test-path.zones: Invalid value: \[\]string{"Zone%\^@112233"}: cluster name must begin with a lower-case letter$`,
},
}
for _, tc := range cases {
Expand Down