From 8c3672a0232200362c49b451546194c8af30d0ef Mon Sep 17 00:00:00 2001 From: Anthony Treuillier Date: Thu, 17 Oct 2024 15:22:31 +0200 Subject: [PATCH] fix: wrong field name on printcolumn (#32) Signed-off-by: Anthony TREUILLIER --- api/v1alpha1/rrset_types.go | 2 +- config/crd/bases/dns.cav.enablers.ob_rrsets.yaml | 2 +- internal/controller/rrset_controller_test.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/v1alpha1/rrset_types.go b/api/v1alpha1/rrset_types.go index b2348ef..954e5cc 100644 --- a/api/v1alpha1/rrset_types.go +++ b/api/v1alpha1/rrset_types.go @@ -42,7 +42,7 @@ type RRsetStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Zone",type="string",JSONPath=".spec.zoneIdRef.name" +// +kubebuilder:printcolumn:name="Zone",type="string",JSONPath=".spec.zoneRef.name" // +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type" // +kubebuilder:printcolumn:name="TTL",type="integer",JSONPath=".spec.ttl" // +kubebuilder:printcolumn:name="Records",type="string",JSONPath=".spec.records" diff --git a/config/crd/bases/dns.cav.enablers.ob_rrsets.yaml b/config/crd/bases/dns.cav.enablers.ob_rrsets.yaml index 49fa9f5..9b9ae2d 100644 --- a/config/crd/bases/dns.cav.enablers.ob_rrsets.yaml +++ b/config/crd/bases/dns.cav.enablers.ob_rrsets.yaml @@ -15,7 +15,7 @@ spec: scope: Namespaced versions: - additionalPrinterColumns: - - jsonPath: .spec.zoneIdRef.name + - jsonPath: .spec.zoneRef.name name: Zone type: string - jsonPath: .spec.type diff --git a/internal/controller/rrset_controller_test.go b/internal/controller/rrset_controller_test.go index 061c413..31015bb 100644 --- a/internal/controller/rrset_controller_test.go +++ b/internal/controller/rrset_controller_test.go @@ -41,7 +41,7 @@ var _ = Describe("RRset Controller", func() { resourceTTL = uint32(300) resourceType = "A" resourceComment = "Just a comment" - zoneIdRef = zoneName + zoneRef = zoneName testRecord1 = "127.0.0.1" testRecord2 = "127.0.0.2" @@ -108,7 +108,7 @@ var _ = Describe("RRset Controller", func() { _, err = controllerutil.CreateOrUpdate(ctx, k8sClient, resource, func() error { resource.Spec = dnsv1alpha1.RRsetSpec{ ZoneRef: dnsv1alpha1.ZoneRef{ - Name: zoneIdRef, + Name: zoneRef, }, Type: resourceType, TTL: resourceTTL, @@ -178,7 +178,7 @@ var _ = Describe("RRset Controller", func() { Expect(getMockedTTL(resourceName, resourceType)).To(Equal(resourceTTL)) Expect(getMockedComment(resourceName, resourceType)).To(Equal(resourceComment)) Expect(createdResource.GetOwnerReferences()).NotTo(BeEmpty(), "RRset should have setOwnerReference") - Expect(createdResource.GetOwnerReferences()[0].Name).To(Equal(zoneIdRef), "RRset should have setOwnerReference to Zone") + Expect(createdResource.GetOwnerReferences()[0].Name).To(Equal(zoneRef), "RRset should have setOwnerReference to Zone") Expect(createdResource.GetFinalizers()).To(ContainElement(FINALIZER_NAME), "RRset should contain the finalizer") }) })