Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 模板文件支持 Helm 语法模式 #3494

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LidolLxf
Copy link
Contributor

@LidolLxf LidolLxf commented Sep 5, 2024

feat: 模板文件支持 Helm 语法模式

@@ -3409,6 +3409,12 @@ message DeployTemplateFileReq {
string namespace = 5 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {
title: "命名空间"
}, (validate.rules).string = {min_len : 1, max_len : 64}];
string grammarMode = 6 [(grpc.gateway.protoc_gen_swagger.options.openapiv2_field) = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

templatefile 版本创建出来就已经有语法模式了,部署这里不用传

@@ -575,6 +595,19 @@ func (t *TemplateAction) DeployTemplateFile(ctx context.Context, req *clusterRes
return nil, err
}

// helm 语法模式
if req.GrammarMode == "Helm" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

语法模式放在 templatefile 里面,类似于 editFormat 一样,前端可以根据语法模式不同展现形式不同。
部署的时候自动从 templatefile 里面读取语法模式

@@ -517,6 +524,19 @@ func (t *TemplateAction) PreviewTemplateFile(ctx context.Context, req *clusterRe
return nil, err
}

// helm 语法模式
if req.GrammarMode == "Helm" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改成 RenderMode

const (
// HelmRenderMode helm 语法模式
HelmRenderMode RenderMode = "Helm"
// SimpleRenderMode 单一语法模式,默认
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

简单语法模式,使用字符串替换渲染

@@ -517,6 +528,16 @@ func (t *TemplateAction) PreviewTemplateFile(ctx context.Context, req *clusterRe
return nil, err
}

// helm 语法模式 模板文件内容进行helm template 渲染
content, errRender := renderHelmTemplate(templates, req.GetValues())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非 helm 语法模式为什么也要用 helm 渲染

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants