Skip to content

Commit

Permalink
UPSTREAM: 1816: Fetch service instance id from spec of IBMPowerVSClus…
Browse files Browse the repository at this point in the history
…ter object while setting provider id
  • Loading branch information
Karthik-K-N authored and aman4433 committed Nov 22, 2024
1 parent a2beaa3 commit 49445b8
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 49445b8

Please sign in to comment.