Skip to content

Commit

Permalink
Merge pull request #203 from openinfradev/release
Browse files Browse the repository at this point in the history
20231113 release to main ( v.3.1.2 )
  • Loading branch information
ktkfree authored Nov 13, 2023
2 parents c61ed35 + d3475c8 commit b9462b4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
3 changes: 3 additions & 0 deletions internal/mail/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func (s *SmtpMailer) SendMail() error {
s.client.SetBody("text/html", s.message.Body)

d := gomail.NewDialer(s.Host, s.Port, s.Username, s.Password)
if s.Port == 25 || s.Port == 587 || s.Port == 2587 {
d.SSL = false
}

if err := d.DialAndSend(s.client); err != nil {
log.Errorf("failed to send email, %v", err)
Expand Down
5 changes: 5 additions & 0 deletions internal/usecase/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ func (u *ClusterUsecase) GetClusterSiteValues(ctx context.Context, clusterId dom
log.ErrorWithContext(ctx, err)
}

if cluster.StackTemplate.CloudService == "AWS" && cluster.StackTemplate.KubeType == "AWS" {
out.TksUserNode = cluster.Conf.TksUserNode / domain.MAX_AZ_NUM
out.TksUserNodeMax = cluster.Conf.TksUserNodeMax / domain.MAX_AZ_NUM
}

if err := serializer.Map(cluster, &out); err != nil {
log.ErrorWithContext(ctx, err)
}
Expand Down
16 changes: 16 additions & 0 deletions internal/usecase/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ func (u *StackUsecase) Create(ctx context.Context, dto domain.Stack) (stackId do
if stackConf.TksCpNode == 0 {
stackConf.TksCpNode = 3
stackConf.TksCpNodeMax = 3
stackConf.TksInfraNode = 3
stackConf.TksInfraNodeMax = 3
}

// user 노드는 MAX_AZ_NUM의 배수로 요청한다.
if stackConf.TksUserNode%domain.MAX_AZ_NUM != 0 {
return "", httpErrors.NewInternalServerError(errors.Wrap(err, "Invalid node count"), "", "")
}
}

Expand Down Expand Up @@ -234,11 +240,21 @@ func (u *StackUsecase) Get(ctx context.Context, stackId domain.StackId) (out dom
return out, err
}

stackResources, _ := u.dashbordUsecase.GetStacks(ctx, cluster.OrganizationId)
out = reflectClusterToStack(cluster, appGroups)

if organization.PrimaryClusterId == cluster.ID.String() {
out.PrimaryCluster = true
}

for _, resource := range stackResources {
if resource.ID == domain.StackId(cluster.ID) {
if err := serializer.Map(resource, &out.Resource); err != nil {
log.Error(err)
}
}
}

appGroupsInPrimaryCluster, err := u.appGroupRepo.Fetch(domain.ClusterId(organization.PrimaryClusterId), nil)
if err != nil {
return out, err
Expand Down
1 change: 1 addition & 0 deletions pkg/domain/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
const NODE_TYPE_TKS_CP_NODE = "TKS_CP_NODE"
const NODE_TYPE_TKS_INFRA_NODE = "TKS_INFRA_NODE"
const NODE_TYPE_TKS_USER_NODE = "TKS_USER_NODE"
const MAX_AZ_NUM = 3

type ClusterId string

Expand Down
10 changes: 5 additions & 5 deletions pkg/domain/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ func (m StackStatus) FromString(s string) StackStatus {
return StackStatus_PENDING
}

const MAX_STEP_CLUSTER_CREATE = 15
const MAX_STEP_CLUSTER_REMOVE = 11
const MAX_STEP_LMA_CREATE_PRIMARY = 42
const MAX_STEP_LMA_CREATE_MEMBER = 27
const MAX_STEP_LMA_REMOVE = 11
const MAX_STEP_CLUSTER_CREATE = 24
const MAX_STEP_CLUSTER_REMOVE = 14
const MAX_STEP_LMA_CREATE_PRIMARY = 39
const MAX_STEP_LMA_CREATE_MEMBER = 29
const MAX_STEP_LMA_REMOVE = 12
const MAX_STEP_SM_CREATE = 22
const MAX_STEP_SM_REMOVE = 4

Expand Down

0 comments on commit b9462b4

Please sign in to comment.