{"record":{"id":"bc874cee2200c682","repo":"cilium/cilium","slug":"failed-to-get-existing-t-w","errorCode":null,"errorMessage":"failed to get existing %T: %w","messagePattern":"failed to get existing %T: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"operator/pkg/ingress/ingress_reconcile.go","lineNumber":433,"sourceCode":"\t}\n\n\treturn dst\n}\n\nfunc atLeastOnePrefixMatches(s string, prefixes []string) bool {\n\tfor _, p := range prefixes {\n\t\tif strings.HasPrefix(s, p) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\nfunc (r *ingressReconciler) tryDeletingResource(ctx context.Context, object client.Object, namespacedName types.NamespacedName) error {\n\tif err := r.client.Get(ctx, namespacedName, object); err != nil {\n\t\tif !k8serrors.IsNotFound(err) {\n\t\t\treturn fmt.Errorf(\"failed to get existing %T: %w\", object, err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err := r.client.Delete(ctx, object); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete existing %T: %w\", object, err)\n\t}\n\n\treturn nil\n}\n\nfunc (r *ingressReconciler) updateIngressLoadbalancerStatus(ctx context.Context, ingress *networkingv1.Ingress) error {\n\tserviceNamespacedName := types.NamespacedName{}\n\tif r.isEffectiveLoadbalancerModeDedicated(ingress) {\n\t\tserviceNamespacedName.Namespace = ingress.Namespace\n\t\tserviceNamespacedName.Name = shortener.ShortenK8sResourceName(fmt.Sprintf(\"%s-%s\", ciliumIngressPrefix, ingress.Name))\n\t} else {\n\t\tserviceNamespacedName.Namespace = r.ciliumNamespace","sourceCodeStart":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/operator/pkg/ingress/ingress_reconcile.go#L415-L451","documentation":"tryDeletingResource performs a Get before Delete during cleanup of dedicated ingress resources. If Get fails with anything other than NotFound, the error is wrapped as 'failed to get existing %T'. This is a pre-delete existence check failing, not the delete itself.","triggerScenarios":"tryCleanupDedicatedResources (ingress deletion / class change) calls tryDeletingResource for Service/Endpoints/CEC etc.; client.Get returns a non-NotFound error: API server connection failure, RBAC denial, timeout, or context cancellation.","commonSituations":"API server temporarily unreachable during cluster upgrade; operator lacks read permission on the object type being cleaned; context deadline exceeded during mass ingress deletions.","solutions":["Check operator logs for the wrapped cause (connection vs RBAC vs timeout)","Verify operator RBAC can 'get' every resource type used by the ingress class (Service, Endpoints, CEC, ConfigMap)","Check API server health: kubectl get --raw=/readyz","If it was a transient outage, re-trigger cleanup by updating the ingress or restarting the operator","If it happens with a specific %T only, inspect the CRD for that type"],"exampleFix":"// before: operator cannot get ciliumenvoyconfigs during cleanup\n// after: grant read access in operator ClusterRole\n- apiGroups: [\"cilium.io\"]\n  resources: [\"ciliumenvoyconfigs\"]\n  verbs: [\"get\", \"list\", \"watch\", \"delete\"]","handlingStrategy":"retry","validationCode":"kubectl auth can-i get services,endpoints,ciliumenvoyconfigs.cilium.io --as=system:serviceaccount:<ns>:cilium-operator","typeGuard":null,"tryCatchPattern":"err := tryDeletingResource(ctx, &corev1.Service{}, svcKey)\nif err != nil {\n    if apierrors.IsServerTimeout(err) || isTransient(err) {\n        return ctrl.Result{RequeueAfter: 5 * time.Second}, nil\n    }\n    if apierrors.IsForbidden(err) {\n        log.Error(err, \"RBAC blocks cleanup Get\")\n    }\n    return ctrl.Result{}, err\n}","preventionTips":["Grant read access to all resource types the ingress owns","Retry transient API server errors rather than failing cleanup","Watch API server health during cluster upgrades","Distinguish NotFound (fine) from other Get errors in tests"],"tags":["kubernetes","cleanup","delete","cilium"],"backgroundTag":"kubernetes-resource-get-failed","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}