Skip to content

Commit

Permalink
attempt injecting apm-ssi v2 injector only once (#30843)
Browse files Browse the repository at this point in the history
  • Loading branch information
adel121 authored Nov 7, 2024
1 parent daf4c35 commit 8ab1984
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,13 @@ func (w *Webhook) injectAutoInstruConfig(pod *corev1.Pod, config extractedPodLib
return err
}

if err := injector.mutatePod(pod); err != nil {
// setting the language tag to `injector` because this injection is not related to a specific supported language
metrics.LibInjectionErrors.Inc("injector", strconv.FormatBool(autoDetected), injectionType)
lastError = err
log.Errorf("Cannot inject library injector into pod %s: %s", mutatecommon.PodString(pod), err)
}

for _, lib := range config.libs {
injected := false
langStr := string(lib.lang)
Expand All @@ -712,7 +719,7 @@ func (w *Webhook) injectAutoInstruConfig(pod *corev1.Pod, config extractedPodLib
if err := lib.podMutator(w.config.version, libRequirementOptions{
containerMutators: containerMutators,
initContainerMutators: initContainerMutators,
podMutators: []podMutator{configInjector.podMutator(lib.lang), injector},
podMutators: []podMutator{configInjector.podMutator(lib.lang)},
}).mutatePod(pod); err != nil {
metrics.LibInjectionErrors.Inc(langStr, strconv.FormatBool(autoDetected), injectionType)
lastError = err
Expand Down

0 comments on commit 8ab1984

Please sign in to comment.