From f6d4d03355ebc5d0fb2269fc2330d36053fbd7fd Mon Sep 17 00:00:00 2001 From: Irbe Krumina Date: Wed, 9 Oct 2024 13:23:00 +0100 Subject: [PATCH] cmd/k8s-operator: don't error out if ProxyClass for ProxyGroup not found. (#13736) We don't need to error out and continuously reconcile if ProxyClass has not (yet) been created, once it gets created the ProxyGroup reconciler will get triggered. Updates tailscale/tailscale#13406 Signed-off-by: Irbe Krumina --- cmd/k8s-operator/proxygroup.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/k8s-operator/proxygroup.go b/cmd/k8s-operator/proxygroup.go index b96641d68..1f9983aa9 100644 --- a/cmd/k8s-operator/proxygroup.go +++ b/cmd/k8s-operator/proxygroup.go @@ -146,7 +146,14 @@ func (r *ProxyGroupReconciler) Reconcile(ctx context.Context, req reconcile.Requ var proxyClass *tsapi.ProxyClass if proxyClassName != "" { proxyClass = new(tsapi.ProxyClass) - if err = r.Get(ctx, types.NamespacedName{Name: proxyClassName}, proxyClass); err != nil { + err := r.Get(ctx, types.NamespacedName{Name: proxyClassName}, proxyClass) + if apierrors.IsNotFound(err) { + err = nil + message := fmt.Sprintf("the ProxyGroup's ProxyClass %s does not (yet) exist", proxyClassName) + logger.Info(message) + return setStatusReady(pg, metav1.ConditionFalse, reasonProxyGroupCreating, message) + } + if err != nil { err = fmt.Errorf("error getting ProxyGroup's ProxyClass %s: %s", proxyClassName, err) r.recorder.Eventf(pg, corev1.EventTypeWarning, reasonProxyGroupCreationFailed, err.Error()) return setStatusReady(pg, metav1.ConditionFalse, reasonProxyGroupCreationFailed, err.Error())