1
0
Fork 0

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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 91 additions and 27 deletions

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
}