@@ -957,18 +957,20 @@ func (m *machinePool) CreateNodePools(r *rosa.Runtime, cmd *cobra.Command, clust
957
957
sumOfMaxReplicas := maxReplicas
958
958
sumOfMinReplicas := minReplicas
959
959
960
- for _ , np := range cluster .NodePools ().Items () {
960
+ nodepools , err := r .OCMClient .GetNodePools (cluster .ID ())
961
+ if err != nil {
962
+ r .Reporter .Errorf ("Error getting node pools from cluster '%s': %s" , cluster .ID (), err )
963
+ }
964
+
965
+ for _ , np := range nodepools {
961
966
// If autoscaling, calculate min and max, use min and max in separate messages below
962
- autoscaling , ok := np .GetAutoscaling ()
963
- if ! ok || autoscaling == nil {
964
- npReplicas , ok := np .GetReplicas ()
965
- if ! ok {
966
- return fmt .Errorf ("Failed to get node pool replicas for hosted cluster '%s': %v" , clusterKey , err )
967
- }
967
+ npAutoscaling , ok := np .GetAutoscaling ()
968
+ if ! ok || npAutoscaling == nil {
969
+ npReplicas , _ := np .GetReplicas ()
968
970
sumOfReplicas += npReplicas
969
971
} else {
970
- sumOfMaxReplicas += autoscaling .MaxReplica ()
971
- sumOfMinReplicas += autoscaling .MinReplica ()
972
+ sumOfMaxReplicas += npAutoscaling .MaxReplica ()
973
+ sumOfMinReplicas += npAutoscaling .MinReplica ()
972
974
}
973
975
}
974
976
@@ -1833,18 +1835,20 @@ func editNodePool(cmd *cobra.Command, nodePoolID string,
1833
1835
sumOfMaxReplicas := maxReplicas
1834
1836
sumOfMinReplicas := minReplicas
1835
1837
1836
- for _ , np := range cluster .NodePools ().Items () {
1838
+ nodepools , err := r .OCMClient .GetNodePools (cluster .ID ())
1839
+ if err != nil {
1840
+ r .Reporter .Errorf ("Error getting node pools from cluster '%s': %s" , cluster .ID (), err )
1841
+ }
1842
+
1843
+ for _ , np := range nodepools {
1837
1844
// If autoscaling, calculate min and max, use min and max in separate messages below
1838
- autoscaling , ok := np .GetAutoscaling ()
1839
- if ! ok || autoscaling == nil {
1840
- npReplicas , ok := np .GetReplicas ()
1841
- if ! ok {
1842
- return fmt .Errorf ("Failed to get node pool replicas for hosted cluster '%s': %v" , clusterKey , err )
1843
- }
1845
+ npAutoscaling , ok := np .GetAutoscaling ()
1846
+ if ! ok || npAutoscaling == nil {
1847
+ npReplicas , _ := np .GetReplicas ()
1844
1848
sumOfReplicas += npReplicas
1845
1849
} else {
1846
- sumOfMaxReplicas += autoscaling .MaxReplica ()
1847
- sumOfMinReplicas += autoscaling .MinReplica ()
1850
+ sumOfMaxReplicas += npAutoscaling .MaxReplica ()
1851
+ sumOfMinReplicas += npAutoscaling .MinReplica ()
1848
1852
}
1849
1853
}
1850
1854
0 commit comments