Skip to content

Commit

Permalink
Fix pod name in the webhook (open-telemetry#3027)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
  • Loading branch information
pavolloffay authored Jun 11, 2024
1 parent 5dd3388 commit f4fad8c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/instrumentation/podmutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ func NewMutator(logger logr.Logger, client client.Client, recorder record.EventR
}

func (pm *instPodMutator) Mutate(ctx context.Context, ns corev1.Namespace, pod corev1.Pod) (corev1.Pod, error) {
logger := pm.Logger.WithValues("namespace", pod.Namespace, "name", pod.Name)
logger := pm.Logger.WithValues("namespace", pod.Namespace)
if pod.Name != "" {
logger = logger.WithValues("name", pod.Name)
} else if pod.GenerateName != "" {
logger = logger.WithValues("generateName", pod.GenerateName)
}

// We check if Pod is already instrumented.
if isAutoInstrumentationInjected(pod) {
Expand Down

0 comments on commit f4fad8c

Please sign in to comment.