@@ -90,6 +90,9 @@ func CreateNodePoolManager(cloudConfigPath string, nodeGroupAutoDiscoveryList []
90
90
var err error
91
91
var configProvider common.ConfigurationProvider
92
92
93
+ // enable SDK to look up the IMDS endpoint to figure out the right realmDomain
94
+ common .EnableInstanceMetadataServiceLookup ()
95
+
93
96
if os .Getenv (ipconsts .OciUseWorkloadIdentityEnvVar ) == "true" {
94
97
klog .Info ("using workload identity provider" )
95
98
configProvider , err = auth .OkeWorkloadIdentityConfigurationProvider ()
@@ -214,21 +217,34 @@ func autoDiscoverNodeGroups(m *ociManagerImpl, okeClient okeClient, nodeGroup no
214
217
if validateNodepoolTags (nodeGroup .tags , nodePoolSummary .FreeformTags , nodePoolSummary .DefinedTags ) {
215
218
nodepool := & nodePool {}
216
219
nodepool .id = * nodePoolSummary .Id
217
- nodepool .minSize = nodeGroup .minSize
218
- nodepool .maxSize = nodeGroup .maxSize
220
+ // set minSize-maxSize from nodepool free form tags, or else use nodeGroupAutoDiscovery configuration
221
+ nodepool .minSize = getIntFromMap (nodePoolSummary .FreeformTags , "minSize" , nodeGroup .minSize )
222
+ nodepool .maxSize = getIntFromMap (nodePoolSummary .FreeformTags , "maxSize" , nodeGroup .maxSize )
219
223
220
224
nodepool .manager = nodeGroup .manager
221
225
nodepool .kubeClient = nodeGroup .kubeClient
222
226
223
227
m .staticNodePools [nodepool .id ] = nodepool
224
- klog .V (5 ).Infof ("auto discovered nodepool in compartment : %s , nodepoolid: %s" , nodeGroup .compartmentId , nodepool .id )
228
+ klog .V (4 ).Infof ("auto discovered nodepool in compartment : %s , nodepoolid: %s ,minSize: %d, maxSize:%d " , nodeGroup .compartmentId , nodepool .id , nodepool . minSize , nodepool . maxSize )
225
229
} else {
226
230
klog .Warningf ("nodepool ignored as the tags do not satisfy the requirement : %s , %v, %v" , * nodePoolSummary .Id , nodePoolSummary .FreeformTags , nodePoolSummary .DefinedTags )
227
231
}
228
232
}
229
233
return true , nil
230
234
}
231
235
236
+ func getIntFromMap (m map [string ]string , key string , defaultValue int ) int {
237
+ value , ok := m [key ]
238
+ if ! ok {
239
+ return defaultValue
240
+ }
241
+ i , err := strconv .Atoi (value )
242
+ if err != nil {
243
+ return defaultValue
244
+ }
245
+ return i
246
+ }
247
+
232
248
func validateNodepoolTags (nodeGroupTags map [string ]string , freeFormTags map [string ]string , definedTags map [string ]map [string ]interface {}) bool {
233
249
if nodeGroupTags != nil {
234
250
for tagKey , tagValue := range nodeGroupTags {
0 commit comments