Skip to content

Commit

Permalink
fix:修复java-agent注入时plugin.enable格式不对 (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun authored Feb 1, 2024
1 parent 3ec5645 commit 12fc741
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/inject/pkg/kube/inject/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ func validateBool(value string) error {
func (wh *Webhook) getSidecarMode(namespace string, pod *corev1.Pod) utils.SidecarMode {
// 这里主要是处理北极星 sidecar, 优先级: pod.annotations > namespace.labels > configmap
if val, ok := pod.Annotations["polarismesh.cn/javaagent"]; ok && val == "true" {
log.InjectScope().Infof("inject pod namespace %q mode is java agent", namespace)
return utils.SidecarForJavaAgent
}
sidecarMode := ""
Expand Down
4 changes: 4 additions & 0 deletions pkg/inject/pkg/kube/inject/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,10 @@ func (wh *Webhook) injectV1(ar *v1.AdmissionReview) *v1.AdmissionResponse {
config = wh.sidecarDnsConfig
tempVersion = wh.sidecarDnsTemplateVersion
}
if sidecarMode == utils.SidecarForJavaAgent {
config = wh.sidecarJavaAgentConfig
tempVersion = wh.sidecarJavaAgentTemplateVersion
}

if !wh.injectRequired(ignoredNamespaces, config, &pod.Spec, &pod.ObjectMeta) {
log.InjectScope().Infof("[Webhook] skipping %s/%s due to policy check", pod.ObjectMeta.Namespace, podName)
Expand Down

0 comments on commit 12fc741

Please sign in to comment.