From 2a8bd68b36e9e8313e3fdde609ce8ed44baa78ab Mon Sep 17 00:00:00 2001 From: "taekyu.kang" Date: Thu, 11 Jul 2024 13:45:59 +0900 Subject: [PATCH] trivial. minor fixes --- internal/repository/cluster.go | 2 +- internal/usecase/stack.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/repository/cluster.go b/internal/repository/cluster.go index 07a7610a..20f3db55 100644 --- a/internal/repository/cluster.go +++ b/internal/repository/cluster.go @@ -142,7 +142,7 @@ func (r *ClusterRepository) Create(ctx context.Context, dto model.Cluster) (clus } func (r *ClusterRepository) Delete(ctx context.Context, clusterId domain.ClusterId) error { - res := r.db.WithContext(ctx).Unscoped().Delete(&model.Cluster{}, "id = ?", clusterId) + res := r.db.WithContext(ctx).Delete(&model.Cluster{}, "id = ?", clusterId) if res.Error != nil { return fmt.Errorf("could not delete cluster for clusterId %s", clusterId) } diff --git a/internal/usecase/stack.go b/internal/usecase/stack.go index c57f3683..a7590832 100644 --- a/internal/usecase/stack.go +++ b/internal/usecase/stack.go @@ -132,6 +132,11 @@ func (u *StackUsecase) Create(ctx context.Context, dto model.Stack) (stackId dom return "", httpErrors.NewInternalServerError(errors.Wrap(err, "Invalid node conf"), "", "") } + domains := make([]string, len(dto.Domains)) + for i, domain := range dto.Domains { + domains[i] = domain.DomainType + "_" + domain.Url + } + workflow := "tks-stack-create" workflowId, err := u.argo.SumbitWorkflowFromWftpl(ctx, workflow, argowf.SubmitOptions{ Parameters: []string{ @@ -147,6 +152,7 @@ func (u *StackUsecase) Create(ctx context.Context, dto model.Stack) (stackId dom "cloud_service=" + dto.CloudService, "cluster_endpoint=" + dto.ClusterEndpoint, "policy_ids=" + strings.Join(dto.PolicyIds, ","), + "cluster_domains=" + strings.Join(domains, ","), }, }) if err != nil {