Do not fail when pod is not found in K8sAttributesDetector

This commit is contained in:
Evgenii Domashenkin
2025-10-20 16:24:05 +03:00
committed by GitHub
parent 6e0012cb0a
commit b4847d74bc
4 changed files with 91 additions and 27 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ func (K8sAttributesDetector) Detect(ctx context.Context) (*resource.Resource, er
podNamespace := string(podNamespaceBytes)
pod, err := client.CoreV1().Pods(podNamespace).Get(ctx, podName, metav1.GetOptions{})
if err != nil && kerror.IsForbidden(err) {
if err != nil && (kerror.IsForbidden(err) || kerror.IsNotFound(err)) {
log.Error().Err(err).Msg("Unable to build K8s resource attributes for Traefik pod")
return resource.Empty(), nil
}