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

Merged
merged 1 commit into from
Oct 11, 2024

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 渲染

@@ -575,6 +598,18 @@ func (t *TemplateAction) DeployTemplateFile(ctx context.Context, req *clusterRes
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.

同上

@LidolLxf LidolLxf force-pushed the feat_template_helm branch 2 times, most recently from 7f1e1b3 to 272d703 Compare October 10, 2024 01:56
@ifooth ifooth merged commit f7aa0ad into TencentBlueKing:master Oct 11, 2024
13 of 14 checks passed
evanlixin added a commit that referenced this pull request Oct 14, 2024
* github-bk-bcs/master:
  feat: 配置示例新增windows路径需求--story=119618143 (#3549)
  fix: 修复客户端事件列表接口 (#3568)
  fix: 客户端事件列表过滤跳过的事件数据 (#3558)
  feat: HTTP接口拉取文件支持设置labels (#3567)
  feat: 资源视图表单 cronjob 表达式支持正则 (#3540)
  feat: 模板文件支持 Helm 语法模式 (#3494)
  feat: cmd命令行缺少空格问题--story=119697737 (#3566)
  feat: 1.配置示例-配置文件筛选体验优化--story=119697737 (#3565)
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.

3 participants