Skip to content

Commit

Permalink
Merge pull request #194 from openinfradev/fix_import_id
Browse files Browse the repository at this point in the history
feature. rollback to tks-admin
  • Loading branch information
cho4036 authored Nov 3, 2023
2 parents 1e5d1db + 20763aa commit 78f1af0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions internal/helper/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

var (
TKS_ADMIN = "tks-admin"
PREFIX_USER_ID = "u"
PREFIX_CLUSTER_ID = "c"
PREFIX_ORGANIZATION_ID = "o"
Expand All @@ -29,6 +30,9 @@ func GenerateApplicaionGroupId() string {
}

func ValidateClusterId(id string) bool {
if id == TKS_ADMIN {
return true
}
if !strings.HasPrefix(id, PREFIX_CLUSTER_ID) {
return false
}
Expand Down
4 changes: 2 additions & 2 deletions internal/usecase/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ func (u *ClusterUsecase) Import(ctx context.Context, dto domain.Cluster) (cluste
userId := user.GetUserId()
dto.CreatorId = &userId
if dto.ClusterType == domain.ClusterType_ADMIN {
dto.ID = "ctksadmin"
dto.Name = "ctksadmin"
dto.ID = "tks-admin"
dto.Name = "tks-admin"
}
clusterId, err = u.repo.Create(dto)
if err != nil {
Expand Down

0 comments on commit 78f1af0

Please sign in to comment.