Skip to content

Commit

Permalink
Merge pull request #531 from openinfradev/domains
Browse files Browse the repository at this point in the history
trivial. minor fixes
  • Loading branch information
ktkfree authored Jul 11, 2024
2 parents 53a19bf + 2a8bd68 commit 747c792
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/repository/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 6 additions & 0 deletions internal/usecase/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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 {
Expand Down

0 comments on commit 747c792

Please sign in to comment.