From b6a252def38075f0bdae038ace993128496ce767 Mon Sep 17 00:00:00 2001 From: cuisongliu Date: Fri, 14 Jan 2022 18:12:02 +0800 Subject: [PATCH] feat(main): add owner to endpoint (#24) --- controllers/sync.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/sync.go b/controllers/sync.go index e36da11..63fb549 100644 --- a/controllers/sync.go +++ b/controllers/sync.go @@ -83,6 +83,9 @@ func (c *Reconciler) syncEndpoint(ctx context.Context, cep *v1beta1.ClusterEndpo ep.SetNamespace(cep.Namespace) _, err := controllerutil.CreateOrUpdate(ctx, c.Client, ep, func() error { ep.Labels = map[string]string{} + if err := controllerutil.SetControllerReference(cep, ep, c.scheme); err != nil { + return err + } healthyHosts := make([]healthyHostAndPort, 0) e := make([]error, 0) for _, h := range cep.Spec.Hosts {