From 91eb550b19d275b7471ef5e2040ac254f18c34b3 Mon Sep 17 00:00:00 2001 From: Sunny Date: Sun, 1 Aug 2021 03:37:56 +0530 Subject: [PATCH] Remove old util ObjectKey Replace old utility function ObjectKey with controller-runtime's client.ObjectKeyFromObject. Signed-off-by: Sunny --- controllers/helmrelease_controller.go | 4 ++-- internal/util/util.go | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/controllers/helmrelease_controller.go b/controllers/helmrelease_controller.go index 55a146bba..fb57eb26a 100644 --- a/controllers/helmrelease_controller.go +++ b/controllers/helmrelease_controller.go @@ -710,7 +710,7 @@ func (r *HelmReleaseReconciler) requestsForHelmChartChange(o client.Object) []re ctx := context.Background() var list v2.HelmReleaseList if err := r.List(ctx, &list, client.MatchingFields{ - v2.SourceIndexKey: util.ObjectKey(hc).String(), + v2.SourceIndexKey: client.ObjectKeyFromObject(hc).String(), }); err != nil { return nil } @@ -722,7 +722,7 @@ func (r *HelmReleaseReconciler) requestsForHelmChartChange(o client.Object) []re if hc.GetArtifact().Revision == i.Status.LastAttemptedRevision { continue } - reqs = append(reqs, reconcile.Request{NamespacedName: util.ObjectKey(&i)}) + reqs = append(reqs, reconcile.Request{NamespacedName: client.ObjectKeyFromObject(&i)}) } return reqs } diff --git a/internal/util/util.go b/internal/util/util.go index b15c1b185..5c2247b3d 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -22,8 +22,6 @@ import ( "helm.sh/helm/v3/pkg/chartutil" "helm.sh/helm/v3/pkg/release" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/controller-runtime/pkg/client" ) // ValuesChecksum calculates and returns the SHA1 checksum for the @@ -43,11 +41,3 @@ func ReleaseRevision(rel *release.Release) int { } return rel.Version } - -// ObjectKey returns client.ObjectKey for the object. -func ObjectKey(object metav1.Object) client.ObjectKey { - return client.ObjectKey{ - Namespace: object.GetNamespace(), - Name: object.GetName(), - } -}