Skip to content

Commit

Permalink
Fetch service instance id from spec of IBMPowerVSCluster object (#1816)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik-K-N authored May 29, 2024
1 parent 2eb1c85 commit a36e496
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,10 +922,16 @@ func (m *PowerVSMachineScope) GetZone() string {

// GetServiceInstanceID returns the service instance id.
func (m *PowerVSMachineScope) GetServiceInstanceID() string {
if m.IBMPowerVSCluster.Status.ServiceInstance == nil || m.IBMPowerVSCluster.Status.ServiceInstance.ID == nil {
return ""
if m.IBMPowerVSCluster.Status.ServiceInstance != nil && m.IBMPowerVSCluster.Status.ServiceInstance.ID != nil {
return *m.IBMPowerVSCluster.Status.ServiceInstance.ID
}
if m.IBMPowerVSCluster.Spec.ServiceInstanceID != "" {
return m.IBMPowerVSCluster.Spec.ServiceInstanceID
}
return *m.IBMPowerVSCluster.Status.ServiceInstance.ID
if m.IBMPowerVSCluster.Spec.ServiceInstance != nil && m.IBMPowerVSCluster.Spec.ServiceInstance.ID != nil {
return *m.IBMPowerVSCluster.Spec.ServiceInstance.ID
}
return ""
}

// SetProviderID will set the provider id for the machine.
Expand Down

0 comments on commit a36e496

Please sign in to comment.