Skip to content

Commit

Permalink
fix:修复javaagent注入配置存在问题 (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun authored Jun 26, 2024
1 parent 1591c2d commit 53ac951
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/inject/pkg/kube/inject/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,11 +613,11 @@ func parseTemplate(tmplStr string, funcMap map[string]interface{}, data SidecarT
temp := template.New("inject")
t, err := temp.Funcs(funcMap).Parse(tmplStr)
if err != nil {
log.InjectScope().Infof("Failed to parse template: %v %v\n", err, tmplStr)
log.InjectScope().Errorf("Failed to parse template: %v %v\n", err, tmplStr)
return bytes.Buffer{}, err
}
if err := t.Execute(&tmpl, &data); err != nil {
log.InjectScope().Infof("Invalid template: %v %v\n", err, tmplStr)
log.InjectScope().Errorf("Invalid template: %v %v\n", err, tmplStr)
return bytes.Buffer{}, err
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/inject/pkg/kube/inject/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ func (wh *Webhook) Run(stop <-chan struct{}) {

sidecarMeshConfig := injectConf.MeshInjectConf
sidecarDnsConfig := injectConf.DnsInjectConf
sidecarJavaagentConfig := injectConf.JavaAgentInjectConf
meshConfig := injectConf.MeshConf
valuesConfig := injectConf.ValuesConf

Expand All @@ -348,8 +349,8 @@ func (wh *Webhook) Run(stop <-chan struct{}) {
wh.sidecarMeshTemplateVersion = sidecarTemplateVersionHash(sidecarMeshConfig.Template)
wh.sidecarDnsConfig = sidecarDnsConfig
wh.sidecarDnsTemplateVersion = sidecarTemplateVersionHash(sidecarDnsConfig.Template)
wh.sidecarJavaAgentConfig = sidecarDnsConfig
wh.sidecarJavaAgentTemplateVersion = sidecarTemplateVersionHash(sidecarDnsConfig.Template)
wh.sidecarJavaAgentConfig = sidecarJavaagentConfig
wh.sidecarJavaAgentTemplateVersion = sidecarTemplateVersionHash(sidecarJavaagentConfig.Template)

wh.valuesConfig = valuesConfig
wh.meshConfig = meshConfig
Expand Down

0 comments on commit 53ac951

Please sign in to comment.