@@ -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 ()
@@ -212,21 +215,34 @@ func autoDiscoverNodeGroups(m *ociManagerImpl, okeClient okeClient, nodeGroup no
212215 if validateNodepoolTags (nodeGroup .tags , nodePoolSummary .FreeformTags , nodePoolSummary .DefinedTags ) {
213216 nodepool := & nodePool {}
214217 nodepool .id = * nodePoolSummary .Id
215- nodepool .minSize = nodeGroup .minSize
216- nodepool .maxSize = nodeGroup .maxSize
218+ // set minSize-maxSize from nodepool free form tags, or else use nodeGroupAutoDiscovery configuration
219+ nodepool .minSize = getIntFromMap (nodePoolSummary .FreeformTags , "minSize" , nodeGroup .minSize )
220+ nodepool .maxSize = getIntFromMap (nodePoolSummary .FreeformTags , "maxSize" , nodeGroup .maxSize )
217221
218222 nodepool .manager = nodeGroup .manager
219223 nodepool .kubeClient = nodeGroup .kubeClient
220224
221225 m .staticNodePools [nodepool .id ] = nodepool
222- klog .V (5 ).Infof ("auto discovered nodepool in compartment : %s , nodepoolid: %s" , nodeGroup .compartmentId , nodepool .id )
226+ klog .V (4 ).Infof ("auto discovered nodepool in compartment : %s , nodepoolid: %s ,minSize: %d, maxSize:%d " , nodeGroup .compartmentId , nodepool .id , nodepool . minSize , nodepool . maxSize )
223227 } else {
224228 klog .Warningf ("nodepool ignored as the tags do not satisfy the requirement : %s , %v, %v" , * nodePoolSummary .Id , nodePoolSummary .FreeformTags , nodePoolSummary .DefinedTags )
225229 }
226230 }
227231 return true , nil
228232}
229233
234+ func getIntFromMap (m map [string ]string , key string , defaultValue int ) int {
235+ value , ok := m [key ]
236+ if ! ok {
237+ return defaultValue
238+ }
239+ i , err := strconv .Atoi (value )
240+ if err != nil {
241+ return defaultValue
242+ }
243+ return i
244+ }
245+
230246func validateNodepoolTags (nodeGroupTags map [string ]string , freeFormTags map [string ]string , definedTags map [string ]map [string ]interface {}) bool {
231247 if nodeGroupTags != nil {
232248 for tagKey , tagValue := range nodeGroupTags {
0 commit comments