diff --git a/api/v1beta2/ibmpowervscluster_webhook.go b/api/v1beta2/ibmpowervscluster_webhook.go index cf5f36dab..bac5ee35a 100644 --- a/api/v1beta2/ibmpowervscluster_webhook.go +++ b/api/v1beta2/ibmpowervscluster_webhook.go @@ -121,6 +121,10 @@ func (r *IBMPowerVSCluster) validateIBMPowerVSClusterCreateInfraPrereq() *field. return field.Invalid(field.NewPath("spec.zone"), r.Spec.Zone, "value of zone is empty") } + if r.Spec.VPC == nil { + return field.Invalid(field.NewPath("spec.vpc"), r.Spec.VPC, "value of VPC is empty") + } + if r.Spec.VPC.Region == nil { return field.Invalid(field.NewPath("spec.vpc.region"), r.Spec.VPC.Region, "value of VPC region is empty") } diff --git a/cloud/scope/powervs_machine.go b/cloud/scope/powervs_machine.go index dfeb80e30..7706bb89c 100644 --- a/cloud/scope/powervs_machine.go +++ b/cloud/scope/powervs_machine.go @@ -162,6 +162,8 @@ func NewPowerVSMachineScope(params PowerVSMachineScopeParams) (scope *PowerVSMac var serviceInstanceID, serviceInstanceName string if params.IBMPowerVSMachine.Spec.ServiceInstanceID != "" { serviceInstanceID = params.IBMPowerVSMachine.Spec.ServiceInstanceID + } else if params.IBMPowerVSMachine.Spec.ServiceInstance != nil && params.IBMPowerVSMachine.Spec.ServiceInstance.ID != nil { + serviceInstanceID = *params.IBMPowerVSMachine.Spec.ServiceInstance.ID } else { serviceInstanceName = fmt.Sprintf("%s-%s", params.IBMPowerVSCluster.GetName(), "serviceInstance") if params.IBMPowerVSCluster.Spec.ServiceInstance != nil && params.IBMPowerVSCluster.Spec.ServiceInstance.Name != nil {