Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
powerkimhub committed Nov 29, 2022
2 parents 68a3bdb + c83be63 commit cea4014
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
14 changes: 12 additions & 2 deletions api-runtime/common-runtime/ClusterManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,21 @@ defer clusterSPLock.Unlock(connectionName, reqInfo.IId.NameId)
driverIId := cres.IID{spUUID, ""}
reqInfo.IId = driverIId

providerName, err := ccm.GetProviderNameByConnectionName(connectionName)
if err != nil {
cblog.Error(err)
return nil, err
}

// Create SP-UUID for NodeGroup list
ngReqIIdList := []cres.IID{}
ngInfoList := []cres.NodeGroupInfo{}
for _, info := range reqInfo.NodeGroupList {
nodeGroupUUID, err := iidm.New(connectionName, rsNodeGroup, info.IId.NameId)
for idx, info := range reqInfo.NodeGroupList {
nodeGroupUUID := ""
if providerName == "NHNCLOUD" && idx == 0 {
nodeGroupUUID = "default-worker" // fixed name in NHN
}
nodeGroupUUID, err = iidm.New(connectionName, rsNodeGroup, info.IId.NameId)
if err != nil {
cblog.Error(err)
return nil, err
Expand Down
20 changes: 19 additions & 1 deletion cloud-control-manager/iid-manager/IIDManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,26 @@ func New(cloudConnectName string, rsType string, uid string) (string, error) {
return uid, nil
}

// MaxLength = 12, lower, number, Cannot use '-'
if cccInfo.ProviderName == "AZURE" && rsType == "nodegroup" {
return uid, nil
retUID := strings.ToLower(strings.ReplaceAll(uid, "-", ""))

if len(retUID) > 12 {
// #6 + #6 => #12
retUID = uid[:6] + xid.New().String()[0:6]
}
return retUID, nil
}

// MaxLenth = 20, lower, number, '-'
if cccInfo.ProviderName == "NHNCLOUD" && (rsType == "cluster" || rsType == "nodegroup") {
retUID := strings.ToLower(uid)

if len(retUID) > 20 {
// #10 + #10 => #20
retUID = uid[:10] + xid.New().String()[0:10]
}
return retUID, nil
}

// default length: 9 + 21 => 30 (NCP's ID Length, the shortest)
Expand Down

0 comments on commit cea4014

Please sign in to comment.