Do not fail when pod is not found in K8sAttributesDetector
This commit is contained in:
parent
6e0012cb0a
commit
b4847d74bc
4 changed files with 91 additions and 27 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue