@@ -90,6 +90,9 @@ func CreateNodePoolManager(cloudConfigPath string, nodeGroupAutoDiscoveryList []
9090 var err error
9191 var configProvider common.ConfigurationProvider
9292
93+ // enable SDK to look up the IMDS endpoint to figure out the right realmDomain
94+ common .EnableInstanceMetadataServiceLookup ()
95+
9396 if os .Getenv (ipconsts .OciUseWorkloadIdentityEnvVar ) == "true" {
9497 klog .Info ("using workload identity provider" )
9598 configProvider , err = auth .OkeWorkloadIdentityConfigurationProvider ()
@@ -214,21 +217,34 @@ func autoDiscoverNodeGroups(m *ociManagerImpl, okeClient okeClient, nodeGroup no
214217 if validateNodepoolTags (nodeGroup .tags , nodePoolSummary .FreeformTags , nodePoolSummary .DefinedTags ) {
215218 nodepool := & nodePool {}
216219 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 )
219223
220224 nodepool .manager = nodeGroup .manager
221225 nodepool .kubeClient = nodeGroup .kubeClient
222226
223227 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 )
225229 } else {
226230 klog .Warningf ("nodepool ignored as the tags do not satisfy the requirement : %s , %v, %v" , * nodePoolSummary .Id , nodePoolSummary .FreeformTags , nodePoolSummary .DefinedTags )
227231 }
228232 }
229233 return true , nil
230234}
231235
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+
232248func validateNodepoolTags (nodeGroupTags map [string ]string , freeFormTags map [string ]string , definedTags map [string ]map [string ]interface {}) bool {
233249 if nodeGroupTags != nil {
234250 for tagKey , tagValue := range nodeGroupTags {
0 commit comments