@@ -129,7 +129,7 @@ func (m *ManagedMachinePoolScope) SetReplicaCount(count int32) {
129
129
// GetWorkerMachineSubnet returns the WorkerRole core.Subnet id for the cluster
130
130
func (m * ManagedMachinePoolScope ) GetWorkerMachineSubnet () * string {
131
131
for _ , subnet := range m .OCIManagedCluster .Spec .NetworkSpec .Vcn .Subnets {
132
- if subnet .Role == infrastructurev1beta2 .WorkerRole {
132
+ if subnet != nil && subnet .Role == infrastructurev1beta2 .WorkerRole {
133
133
return subnet .ID
134
134
}
135
135
}
@@ -140,7 +140,7 @@ func (m *ManagedMachinePoolScope) GetWorkerMachineSubnet() *string {
140
140
func (m * ManagedMachinePoolScope ) SetListandSetMachinePoolInstances (ctx context.Context , nodePool * oke.NodePool ) (int32 , error ) {
141
141
providerIDList := make ([]string , 0 )
142
142
for _ , instance := range nodePool .Nodes {
143
- if instance .LifecycleState == oke .NodeLifecycleStateActive {
143
+ if instance .Id != nil && instance . LifecycleState == oke .NodeLifecycleStateActive {
144
144
providerIDList = append (providerIDList , * instance .Id )
145
145
}
146
146
}
@@ -484,7 +484,7 @@ func (m *ManagedMachinePoolScope) getFreeFormTags() map[string]string {
484
484
func (m * ManagedMachinePoolScope ) getWorkerMachineSubnets () []string {
485
485
subnetList := make ([]string , 0 )
486
486
for _ , subnet := range m .OCIManagedCluster .Spec .NetworkSpec .Vcn .Subnets {
487
- if subnet .Role == infrastructurev1beta2 .WorkerRole {
487
+ if subnet != nil && subnet .Role == infrastructurev1beta2 .WorkerRole {
488
488
subnetList = append (subnetList , subnet .Name )
489
489
}
490
490
}
@@ -497,14 +497,14 @@ func (m *ManagedMachinePoolScope) getWorkerMachineNSGs() []string {
497
497
if len (specNsgNames ) > 0 {
498
498
for _ , nsgName := range specNsgNames {
499
499
for _ , nsg := range m .OCIManagedCluster .Spec .NetworkSpec .Vcn .NetworkSecurityGroup .List {
500
- if nsg .Name == nsgName {
500
+ if nsg != nil && nsg . ID != nil && nsg .Name == nsgName {
501
501
nsgList = append (nsgList , * nsg .ID )
502
502
}
503
503
}
504
504
}
505
505
} else {
506
506
for _ , nsg := range m .OCIManagedCluster .Spec .NetworkSpec .Vcn .NetworkSecurityGroup .List {
507
- if nsg .Role == infrastructurev1beta2 .WorkerRole {
507
+ if nsg != nil && nsg . ID != nil && nsg .Role == infrastructurev1beta2 .WorkerRole {
508
508
nsgList = append (nsgList , * nsg .ID )
509
509
}
510
510
}
@@ -515,7 +515,7 @@ func (m *ManagedMachinePoolScope) getWorkerMachineNSGs() []string {
515
515
func (m * ManagedMachinePoolScope ) getWorkerMachineNSGList () []string {
516
516
nsgList := make ([]string , 0 )
517
517
for _ , nsg := range m .OCIManagedCluster .Spec .NetworkSpec .Vcn .NetworkSecurityGroup .List {
518
- if nsg .Role == infrastructurev1beta2 .WorkerRole {
518
+ if nsg != nil && nsg .Role == infrastructurev1beta2 .WorkerRole {
519
519
nsgList = append (nsgList , nsg .Name )
520
520
}
521
521
}
@@ -527,7 +527,7 @@ func (m *ManagedMachinePoolScope) getPodSubnets(subnets []string) []string {
527
527
if len (subnets ) > 0 {
528
528
for _ , subnetName := range subnets {
529
529
for _ , subnet := range m .OCIManagedCluster .Spec .NetworkSpec .Vcn .Subnets {
530
- if subnet .Name == subnetName {
530
+ if subnet != nil && subnet . ID != nil && subnet .Name == subnetName {
531
531
subnetList = append (subnetList , * subnet .ID )
532
532
}
533
533
}
@@ -541,7 +541,7 @@ func (m *ManagedMachinePoolScope) getPodNSGs(nsgs []string) []string {
541
541
if len (nsgs ) > 0 {
542
542
for _ , nsgName := range nsgs {
543
543
for _ , nsg := range m .OCIManagedCluster .Spec .NetworkSpec .Vcn .NetworkSecurityGroup .List {
544
- if nsg .Name == nsgName {
544
+ if nsg != nil && nsg . ID != nil && nsg .Name == nsgName {
545
545
nsgList = append (nsgList , * nsg .ID )
546
546
}
547
547
}
@@ -581,7 +581,7 @@ func (m *ManagedMachinePoolScope) getInitialNodeKeyValuePairs() []oke.KeyValue {
581
581
582
582
func (m * ManagedMachinePoolScope ) getWorkerMachineSubnet (name * string ) * string {
583
583
for _ , subnet := range m .OCIManagedCluster .Spec .NetworkSpec .Vcn .Subnets {
584
- if subnet .Name == * name {
584
+ if subnet != nil && subnet . ID != nil && subnet .Name == * name {
585
585
return subnet .ID
586
586
}
587
587
}
0 commit comments