Skip to content

Commit

Permalink
fix:修复javaagent默认properties文件的key名称
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun authored Feb 1, 2024
1 parent 89111f7 commit bdabec5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
app: sidecar-injector
data:
springcloud2020-default-properties: |+
spring-cloud2020-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -56,7 +56,7 @@ data:
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
springcloud2021-default-properties: |+
spring-cloud2021-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -106,7 +106,7 @@ data:
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
springcloudhoxton-default-properties: |+
spring-cloudhoxton-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -155,3 +155,4 @@ data:
spring.cloud.polaris.stat.port=0
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
7 changes: 4 additions & 3 deletions deploy/kubernetes_v1.21/kubernetes/javaagent-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
app: sidecar-injector
data:
springcloud2020-default-properties: |+
spring-cloud2020-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -56,7 +56,7 @@ data:
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
springcloud2021-default-properties: |+
spring-cloud2021-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -106,7 +106,7 @@ data:
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
springcloudhoxton-default-properties: |+
spring-cloudhoxton-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -155,3 +155,4 @@ data:
spring.cloud.polaris.stat.port=0
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
app: sidecar-injector
data:
springcloud2020-default-properties: |+
spring-cloud2020-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -56,7 +56,7 @@ data:
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
springcloud2021-default-properties: |+
spring-cloud2021-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -106,7 +106,7 @@ data:
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
springcloudhoxton-default-properties: |+
spring-cloudhoxton-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down
6 changes: 3 additions & 3 deletions deploy/kubernetes_v1.22/kubernetes/javaagent-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
app: sidecar-injector
data:
springcloud2020-default-properties: |+
spring-cloud2020-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -56,7 +56,7 @@ data:
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
springcloud2021-default-properties: |+
spring-cloud2021-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down Expand Up @@ -106,7 +106,7 @@ data:
# 指标上报暴露的 http path
spring.cloud.polaris.stat.path=/metrics
springcloudhoxton-default-properties: |+
spring-cloudhoxton-default-properties: |+
# 应用名称
spring.application.name={{ .MicroserviceName }}
# 配置北极星服务端地址
Expand Down
8 changes: 5 additions & 3 deletions pkg/inject/pkg/kube/inject/apply/javaagent/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ func (pb *PodPatchBuilder) PatchContainer(req *inject.OperateContainerRequest) (

func (pb *PodPatchBuilder) handleJavaAgentInit(opt *inject.PatchOptions, pod *corev1.Pod, add *corev1.Container) error {
annonations := pod.Annotations
log.InjectScope().Infof("handle polaris-javaagent-init inject for pod=[%s, %s] annonations: %#v",
pod.Namespace, pod.Name, pod.Annotations)
log.InjectScope().Infof("handle polaris-javaagent-init inject for pod=[%s, %s] annonations: %#v image: %s",
pod.Namespace, pod.Name, pod.Annotations, add.Image)
// 判断用户是否自定义了 javaagent 的版本
oldImageInfo := strings.Split(add.Image, ":")
opt.ExternalInfo[customJavaAgentVersion] = oldImageInfo[1]
if len(oldImageInfo) > 1 {
opt.ExternalInfo[customJavaAgentVersion] = oldImageInfo[1]
}
if val, ok := annonations[customJavaAgentVersion]; ok {
add.Image = fmt.Sprintf("%s:%s", oldImageInfo[0], val)
opt.ExternalInfo[customJavaAgentVersion] = val
Expand Down

0 comments on commit bdabec5

Please sign in to comment.