From bb1e44c4d7dd1b7eae1a26d358fa4231c8ab129a Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Mon, 19 Apr 2021 11:23:46 +0100 Subject: [PATCH] Move API v1alpha1 to v1alpha2 The image automation part of the API has changed structure (see [1]), and had a version bump from `v1alpha1` to `v1alpha2`. Since the types here are also in `image.toolkit.fluxcd.io`, there will be less complication if they also get a version bump even though they aren't changing. For the automation types, leaving the old version `v1alpha1` definitions in place leads to Kubernetes trying to upgrade objects and dropping most fields (which have changed location), so they have been removed. That would not happen with the types here, but for consistency I am removing the old API version here too. [1] https://github.com/fluxcd/image-automation-controller/pull/139 Signed-off-by: Michael Bridgen --- Makefile | 2 +- PROJECT | 4 +-- api/{v1alpha1 => v1alpha2}/condition_types.go | 0 api/{v1alpha1 => v1alpha2}/doc.go | 0 .../groupversion_info.go | 0 .../imagepolicy_types.go | 0 .../imagerepository_types.go | 0 .../zz_generated.deepcopy.go | 0 controllers/imagepolicy_controller.go | 30 ++++++++-------- controllers/imagerepository_controller.go | 34 +++++++++---------- controllers/policy_test.go | 26 +++++++------- controllers/scan_test.go | 24 ++++++------- controllers/suite_test.go | 4 +-- controllers/tls_test.go | 2 +- internal/policy/factory.go | 2 +- internal/policy/factory_test.go | 2 +- main.go | 8 ++--- 17 files changed, 69 insertions(+), 69 deletions(-) rename api/{v1alpha1 => v1alpha2}/condition_types.go (100%) rename api/{v1alpha1 => v1alpha2}/doc.go (100%) rename api/{v1alpha1 => v1alpha2}/groupversion_info.go (100%) rename api/{v1alpha1 => v1alpha2}/imagepolicy_types.go (100%) rename api/{v1alpha1 => v1alpha2}/imagerepository_types.go (100%) rename api/{v1alpha1 => v1alpha2}/zz_generated.deepcopy.go (100%) diff --git a/Makefile b/Makefile index 1a2dcbcc..098d5eeb 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ manifests: controller-gen # Generate API reference documentation api-docs: gen-crd-api-reference-docs - $(API_REF_GEN) -api-dir=./api/v1alpha1 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/image-reflector.md + $(API_REF_GEN) -api-dir=./api/v1alpha2 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/image-reflector.md # Run go mod tidy tidy: diff --git a/PROJECT b/PROJECT index bdf4e444..4d2496da 100644 --- a/PROJECT +++ b/PROJECT @@ -3,8 +3,8 @@ repo: github.com/fluxcd/image-reflector-controller resources: - group: image kind: ImageRepository - version: v1alpha1 + version: v1alpha2 - group: image kind: ImagePolicy - version: v1alpha1 + version: v1alpha2 version: "2" diff --git a/api/v1alpha1/condition_types.go b/api/v1alpha2/condition_types.go similarity index 100% rename from api/v1alpha1/condition_types.go rename to api/v1alpha2/condition_types.go diff --git a/api/v1alpha1/doc.go b/api/v1alpha2/doc.go similarity index 100% rename from api/v1alpha1/doc.go rename to api/v1alpha2/doc.go diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha2/groupversion_info.go similarity index 100% rename from api/v1alpha1/groupversion_info.go rename to api/v1alpha2/groupversion_info.go diff --git a/api/v1alpha1/imagepolicy_types.go b/api/v1alpha2/imagepolicy_types.go similarity index 100% rename from api/v1alpha1/imagepolicy_types.go rename to api/v1alpha2/imagepolicy_types.go diff --git a/api/v1alpha1/imagerepository_types.go b/api/v1alpha2/imagerepository_types.go similarity index 100% rename from api/v1alpha1/imagerepository_types.go rename to api/v1alpha2/imagerepository_types.go diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha2/zz_generated.deepcopy.go similarity index 100% rename from api/v1alpha1/zz_generated.deepcopy.go rename to api/v1alpha2/zz_generated.deepcopy.go diff --git a/controllers/imagepolicy_controller.go b/controllers/imagepolicy_controller.go index 56decad4..754bded0 100644 --- a/controllers/imagepolicy_controller.go +++ b/controllers/imagepolicy_controller.go @@ -38,7 +38,7 @@ import ( "github.com/fluxcd/pkg/runtime/events" "github.com/fluxcd/pkg/runtime/metrics" - imagev1alpha1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" "github.com/fluxcd/image-reflector-controller/internal/policy" ) @@ -64,7 +64,7 @@ type ImagePolicyReconciler struct { func (r *ImagePolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { reconcileStart := time.Now() - var pol imagev1alpha1.ImagePolicy + var pol imagev1.ImagePolicy if err := r.Get(ctx, req.NamespacedName, &pol); err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) } @@ -81,13 +81,13 @@ func (r *ImagePolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) } defer r.recordReadinessMetric(ctx, &pol) - var repo imagev1alpha1.ImageRepository + var repo imagev1.ImageRepository if err := r.Get(ctx, types.NamespacedName{ Namespace: pol.Namespace, Name: pol.Spec.ImageRepositoryRef.Name, }, &repo); err != nil { if client.IgnoreNotFound(err) == nil { - imagev1alpha1.SetImagePolicyReadiness( + imagev1.SetImagePolicyReadiness( &pol, metav1.ConditionFalse, meta.DependencyNotReadyReason, @@ -105,7 +105,7 @@ func (r *ImagePolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) // if the image repo hasn't been scanned, don't bother if repo.Status.CanonicalImageName == "" { msg := "referenced ImageRepository has not been scanned yet" - imagev1alpha1.SetImagePolicyReadiness( + imagev1.SetImagePolicyReadiness( &pol, metav1.ConditionFalse, meta.DependencyNotReadyReason, @@ -142,7 +142,7 @@ func (r *ImagePolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) } } if err != nil { - imagev1alpha1.SetImagePolicyReadiness( + imagev1.SetImagePolicyReadiness( &pol, metav1.ConditionFalse, meta.ReconciliationFailedReason, @@ -158,7 +158,7 @@ func (r *ImagePolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) if latest == "" { msg := "no image found for policy" pol.Status.LatestImage = "" - imagev1alpha1.SetImagePolicyReadiness( + imagev1.SetImagePolicyReadiness( &pol, metav1.ConditionFalse, meta.ReconciliationFailedReason, @@ -174,7 +174,7 @@ func (r *ImagePolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) msg := fmt.Sprintf("Latest image tag for '%s' resolved to: %s", repo.Spec.Image, latest) pol.Status.LatestImage = repo.Spec.Image + ":" + latest - imagev1alpha1.SetImagePolicyReadiness( + imagev1.SetImagePolicyReadiness( &pol, metav1.ConditionTrue, meta.ReconciliationSucceededReason, @@ -192,17 +192,17 @@ func (r *ImagePolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) func (r *ImagePolicyReconciler) SetupWithManager(mgr ctrl.Manager) error { // index the policies by which image repo they point at, so that // it's easy to list those out when an image repo changes. - if err := mgr.GetFieldIndexer().IndexField(context.Background(), &imagev1alpha1.ImagePolicy{}, imageRepoKey, func(obj client.Object) []string { - pol := obj.(*imagev1alpha1.ImagePolicy) + if err := mgr.GetFieldIndexer().IndexField(context.Background(), &imagev1.ImagePolicy{}, imageRepoKey, func(obj client.Object) []string { + pol := obj.(*imagev1.ImagePolicy) return []string{pol.Spec.ImageRepositoryRef.Name} }); err != nil { return err } return ctrl.NewControllerManagedBy(mgr). - For(&imagev1alpha1.ImagePolicy{}). + For(&imagev1.ImagePolicy{}). Watches( - &source.Kind{Type: &imagev1alpha1.ImageRepository{}}, + &source.Kind{Type: &imagev1.ImageRepository{}}, handler.EnqueueRequestsFromMapFunc(r.imagePoliciesForRepository), ). Complete(r) @@ -212,7 +212,7 @@ func (r *ImagePolicyReconciler) SetupWithManager(mgr ctrl.Manager) error { func (r *ImagePolicyReconciler) imagePoliciesForRepository(obj client.Object) []reconcile.Request { ctx := context.Background() - var policies imagev1alpha1.ImagePolicyList + var policies imagev1.ImagePolicyList if err := r.List(ctx, &policies, client.InNamespace(obj.GetNamespace()), client.MatchingFields{imageRepoKey: obj.GetName()}); err != nil { return nil @@ -226,7 +226,7 @@ func (r *ImagePolicyReconciler) imagePoliciesForRepository(obj client.Object) [] } // event emits a Kubernetes event and forwards the event to notification controller if configured -func (r *ImagePolicyReconciler) event(ctx context.Context, policy imagev1alpha1.ImagePolicy, severity, msg string) { +func (r *ImagePolicyReconciler) event(ctx context.Context, policy imagev1.ImagePolicy, severity, msg string) { if r.EventRecorder != nil { r.EventRecorder.Event(&policy, "Normal", severity, msg) } @@ -242,7 +242,7 @@ func (r *ImagePolicyReconciler) event(ctx context.Context, policy imagev1alpha1. } } -func (r *ImagePolicyReconciler) recordReadinessMetric(ctx context.Context, policy *imagev1alpha1.ImagePolicy) { +func (r *ImagePolicyReconciler) recordReadinessMetric(ctx context.Context, policy *imagev1.ImagePolicy) { if r.MetricsRecorder == nil { return } diff --git a/controllers/imagerepository_controller.go b/controllers/imagerepository_controller.go index bcbc8e90..e4f533ce 100644 --- a/controllers/imagerepository_controller.go +++ b/controllers/imagerepository_controller.go @@ -49,7 +49,7 @@ import ( "github.com/fluxcd/pkg/runtime/metrics" "github.com/fluxcd/pkg/runtime/predicates" - imagev1alpha1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" ) // These are intended to match the keys used in e.g., @@ -90,7 +90,7 @@ func (r *ImageRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Requ // is usually made explicit by _also_ returning // `ctrl.Result{Requeue: true}`. - var imageRepo imagev1alpha1.ImageRepository + var imageRepo imagev1.ImageRepository if err := r.Get(ctx, req.NamespacedName, &imageRepo); err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) } @@ -101,7 +101,7 @@ func (r *ImageRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Requ if imageRepo.Spec.Suspend { msg := "ImageRepository is suspended, skipping reconciliation" - imagev1alpha1.SetImageRepositoryReadiness( + imagev1.SetImageRepositoryReadiness( &imageRepo, metav1.ConditionFalse, meta.SuspendedReason, @@ -128,10 +128,10 @@ func (r *ImageRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Requ ref, err := name.ParseReference(imageRepo.Spec.Image) if err != nil { - imagev1alpha1.SetImageRepositoryReadiness( + imagev1.SetImageRepositoryReadiness( &imageRepo, metav1.ConditionFalse, - imagev1alpha1.ImageURLInvalidReason, + imagev1.ImageURLInvalidReason, err.Error(), ) if err := r.Status().Update(ctx, &imageRepo); err != nil { @@ -177,7 +177,7 @@ func (r *ImageRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Requ return ctrl.Result{RequeueAfter: when}, nil } -func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1alpha1.ImageRepository, ref name.Reference) error { +func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1.ImageRepository, ref name.Reference) error { timeout := imageRepo.GetTimeout() ctx, cancel := context.WithTimeout(ctx, timeout) defer cancel() @@ -189,7 +189,7 @@ func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1 Namespace: imageRepo.GetNamespace(), Name: imageRepo.Spec.SecretRef.Name, }, &authSecret); err != nil { - imagev1alpha1.SetImageRepositoryReadiness( + imagev1.SetImageRepositoryReadiness( imageRepo, metav1.ConditionFalse, meta.ReconciliationFailedReason, @@ -199,7 +199,7 @@ func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1 } auth, err := authFromSecret(authSecret, ref) if err != nil { - imagev1alpha1.SetImageRepositoryReadiness( + imagev1.SetImageRepositoryReadiness( imageRepo, metav1.ConditionFalse, meta.ReconciliationFailedReason, @@ -219,7 +219,7 @@ func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1 Namespace: imageRepo.GetNamespace(), Name: imageRepo.Spec.CertSecretRef.Name, }, &certSecret); err != nil { - imagev1alpha1.SetImageRepositoryReadiness( + imagev1.SetImageRepositoryReadiness( imageRepo, metav1.ConditionFalse, meta.ReconciliationFailedReason, @@ -238,7 +238,7 @@ func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1 tags, err := remote.ListWithContext(ctx, ref.Context(), options...) if err != nil { - imagev1alpha1.SetImageRepositoryReadiness( + imagev1.SetImageRepositoryReadiness( imageRepo, metav1.ConditionFalse, meta.ReconciliationFailedReason, @@ -253,7 +253,7 @@ func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1 } scanTime := metav1.Now() - imageRepo.Status.LastScanResult = &imagev1alpha1.ScanResult{ + imageRepo.Status.LastScanResult = &imagev1.ScanResult{ TagCount: len(tags), ScanTime: scanTime, } @@ -265,7 +265,7 @@ func (r *ImageRepositoryReconciler) scan(ctx context.Context, imageRepo *imagev1 imageRepo.Status.SetLastHandledReconcileRequest(token) } - imagev1alpha1.SetImageRepositoryReadiness( + imagev1.SetImageRepositoryReadiness( imageRepo, metav1.ConditionTrue, meta.ReconciliationSucceededReason, @@ -311,7 +311,7 @@ func transportFromSecret(certSecret *corev1.Secret) (*http.Transport, error) { // shouldScan takes an image repo and the time now, and says whether // the repository should be scanned now, and how long to wait for the // next scan. -func (r *ImageRepositoryReconciler) shouldScan(repo imagev1alpha1.ImageRepository, now time.Time) (bool, time.Duration, error) { +func (r *ImageRepositoryReconciler) shouldScan(repo imagev1.ImageRepository, now time.Time) (bool, time.Duration, error) { scanInterval := repo.Spec.Interval.Duration // never scanned; do it now @@ -354,7 +354,7 @@ func (r *ImageRepositoryReconciler) shouldScan(repo imagev1alpha1.ImageRepositor func (r *ImageRepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&imagev1alpha1.ImageRepository{}). + For(&imagev1.ImageRepository{}). WithEventFilter(predicate.Or(predicate.GenerationChangedPredicate{}, predicates.ReconcileRequestedPredicate{})). Complete(r) } @@ -387,7 +387,7 @@ func authFromSecret(secret corev1.Secret, ref name.Reference) (authn.Authenticat } // event emits a Kubernetes event and forwards the event to notification controller if configured -func (r *ImageRepositoryReconciler) event(ctx context.Context, repo imagev1alpha1.ImageRepository, severity, msg string) { +func (r *ImageRepositoryReconciler) event(ctx context.Context, repo imagev1.ImageRepository, severity, msg string) { if r.EventRecorder != nil { r.EventRecorder.Eventf(&repo, "Normal", severity, msg) } @@ -405,7 +405,7 @@ func (r *ImageRepositoryReconciler) event(ctx context.Context, repo imagev1alpha } } -func (r *ImageRepositoryReconciler) recordReadinessMetric(ctx context.Context, repo *imagev1alpha1.ImageRepository) { +func (r *ImageRepositoryReconciler) recordReadinessMetric(ctx context.Context, repo *imagev1.ImageRepository) { if r.MetricsRecorder == nil { return } @@ -425,7 +425,7 @@ func (r *ImageRepositoryReconciler) recordReadinessMetric(ctx context.Context, r } } -func (r *ImageRepositoryReconciler) recordSuspension(ctx context.Context, imageRepo imagev1alpha1.ImageRepository) { +func (r *ImageRepositoryReconciler) recordSuspension(ctx context.Context, imageRepo imagev1.ImageRepository) { if r.MetricsRecorder == nil { return } diff --git a/controllers/policy_test.go b/controllers/policy_test.go index 26841bbe..77747645 100644 --- a/controllers/policy_test.go +++ b/controllers/policy_test.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - imagev1alpha1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" // +kubebuilder:scaffold:imports ) @@ -51,8 +51,8 @@ var _ = Describe("ImagePolicy controller", func() { versions := []string{"0.1.0", "0.1.1", "0.2.0", "1.0.0", "1.0.1", "1.0.2", "1.1.0-alpha"} imgRepo := loadImages(registryServer, "test-semver-policy-"+randStringRunes(5), versions) - repo := imagev1alpha1.ImageRepository{ - Spec: imagev1alpha1.ImageRepositorySpec{ + repo := imagev1.ImageRepository{ + Spec: imagev1.ImageRepositorySpec{ Interval: metav1.Duration{Duration: reconciliationInterval}, Image: imgRepo, }, @@ -81,13 +81,13 @@ var _ = Describe("ImagePolicy controller", func() { Name: "random-pol-" + randStringRunes(5), Namespace: imageObjectName.Namespace, } - pol := imagev1alpha1.ImagePolicy{ - Spec: imagev1alpha1.ImagePolicySpec{ + pol := imagev1.ImagePolicy{ + Spec: imagev1.ImagePolicySpec{ ImageRepositoryRef: meta.LocalObjectReference{ Name: imageObjectName.Name, }, - Policy: imagev1alpha1.ImagePolicyChoice{ - SemVer: &imagev1alpha1.SemVerPolicy{ + Policy: imagev1.ImagePolicyChoice{ + SemVer: &imagev1.SemVerPolicy{ Range: "1.0.x", }, }, @@ -116,8 +116,8 @@ var _ = Describe("ImagePolicy controller", func() { versions := []string{"xenial", "yakkety", "zesty", "artful", "bionic"} imgRepo := loadImages(registryServer, "test-alphabetical-policy-"+randStringRunes(5), versions) - repo := imagev1alpha1.ImageRepository{ - Spec: imagev1alpha1.ImageRepositorySpec{ + repo := imagev1.ImageRepository{ + Spec: imagev1.ImageRepositorySpec{ Interval: metav1.Duration{Duration: reconciliationInterval}, Image: imgRepo, }, @@ -146,13 +146,13 @@ var _ = Describe("ImagePolicy controller", func() { Name: "random-pol-" + randStringRunes(5), Namespace: imageObjectName.Namespace, } - pol := imagev1alpha1.ImagePolicy{ - Spec: imagev1alpha1.ImagePolicySpec{ + pol := imagev1.ImagePolicy{ + Spec: imagev1.ImagePolicySpec{ ImageRepositoryRef: meta.LocalObjectReference{ Name: imageObjectName.Name, }, - Policy: imagev1alpha1.ImagePolicyChoice{ - Alphabetical: &imagev1alpha1.AlphabeticalPolicy{}, + Policy: imagev1.ImagePolicyChoice{ + Alphabetical: &imagev1.AlphabeticalPolicy{}, }, }, } diff --git a/controllers/scan_test.go b/controllers/scan_test.go index bf7ecdc2..f28b2e6a 100644 --- a/controllers/scan_test.go +++ b/controllers/scan_test.go @@ -30,13 +30,13 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - imagev1alpha1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" // +kubebuilder:scaffold:imports ) var _ = Describe("ImageRepository controller", func() { const imageName = "alpine-image" - var repo imagev1alpha1.ImageRepository + var repo imagev1.ImageRepository var registryServer *httptest.Server @@ -53,8 +53,8 @@ var _ = Describe("ImageRepository controller", func() { // would be good to test this without needing to do the scanning, since // 1. better to not rely on external services being available // 2. probably going to want to have several test cases - repo = imagev1alpha1.ImageRepository{ - Spec: imagev1alpha1.ImageRepositorySpec{ + repo = imagev1.ImageRepository{ + Spec: imagev1.ImageRepositorySpec{ Interval: metav1.Duration{Duration: reconciliationInterval}, Image: "alpine", }, @@ -87,8 +87,8 @@ var _ = Describe("ImageRepository controller", func() { versions := []string{"0.1.0", "0.1.1", "0.2.0", "1.0.0", "1.0.1", "1.0.2", "1.1.0-alpha"} imgRepo := loadImages(registryServer, "test-fetch", versions) - repo = imagev1alpha1.ImageRepository{ - Spec: imagev1alpha1.ImageRepositorySpec{ + repo = imagev1.ImageRepository{ + Spec: imagev1.ImageRepositorySpec{ Interval: metav1.Duration{Duration: reconciliationInterval}, Image: imgRepo, }, @@ -117,8 +117,8 @@ var _ = Describe("ImageRepository controller", func() { Context("when the ImageRepository is suspended", func() { It("does not process the image", func() { - repo = imagev1alpha1.ImageRepository{ - Spec: imagev1alpha1.ImageRepositorySpec{ + repo = imagev1.ImageRepository{ + Spec: imagev1.ImageRepositorySpec{ Interval: metav1.Duration{Duration: reconciliationInterval}, Image: "alpine", Suspend: true, @@ -157,8 +157,8 @@ var _ = Describe("ImageRepository controller", func() { It("scans right away", func() { imgRepo := loadImages(registryServer, "test-fetch", []string{"1.0.0"}) - repo = imagev1alpha1.ImageRepository{ - Spec: imagev1alpha1.ImageRepositorySpec{ + repo = imagev1.ImageRepository{ + Spec: imagev1.ImageRepositorySpec{ Interval: metav1.Duration{Duration: reconciliationInterval}, Image: imgRepo, }, @@ -245,8 +245,8 @@ var _ = Describe("ImageRepository controller", func() { Password: password, })) - repo = imagev1alpha1.ImageRepository{ - Spec: imagev1alpha1.ImageRepositorySpec{ + repo = imagev1.ImageRepository{ + Spec: imagev1.ImageRepositorySpec{ Interval: metav1.Duration{Duration: reconciliationInterval}, Image: imgRepo, SecretRef: &meta.LocalObjectReference{ diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 03e23d59..c18fed9a 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -36,7 +36,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/envtest/printer" "sigs.k8s.io/controller-runtime/pkg/log/zap" - imagev1alpha1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" "github.com/fluxcd/image-reflector-controller/internal/database" // +kubebuilder:scaffold:imports ) @@ -85,7 +85,7 @@ var _ = BeforeSuite(func(done Done) { Expect(err).ToNot(HaveOccurred()) Expect(cfg).ToNot(BeNil()) - err = imagev1alpha1.AddToScheme(scheme.Scheme) + err = imagev1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) // +kubebuilder:scaffold:scheme diff --git a/controllers/tls_test.go b/controllers/tls_test.go index 6a8fb63b..ca8713b6 100644 --- a/controllers/tls_test.go +++ b/controllers/tls_test.go @@ -40,7 +40,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" "github.com/fluxcd/pkg/apis/meta" ) diff --git a/internal/policy/factory.go b/internal/policy/factory.go index 2aa4c01b..97d4eb9f 100644 --- a/internal/policy/factory.go +++ b/internal/policy/factory.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" ) // PolicerFromSpec constructs a new policy object based on diff --git a/internal/policy/factory_test.go b/internal/policy/factory_test.go index 866c2229..fc975bed 100644 --- a/internal/policy/factory_test.go +++ b/internal/policy/factory_test.go @@ -19,7 +19,7 @@ package policy import ( "testing" - imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" ) func TestFactory_PolicerFromSpec(t *testing.T) { diff --git a/main.go b/main.go index c3e5552f..3bcb56ab 100644 --- a/main.go +++ b/main.go @@ -36,7 +36,7 @@ import ( "github.com/fluxcd/pkg/runtime/pprof" "github.com/fluxcd/pkg/runtime/probes" - imagev1alpha1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha2" "github.com/fluxcd/image-reflector-controller/controllers" "github.com/fluxcd/image-reflector-controller/internal/database" // +kubebuilder:scaffold:imports @@ -52,7 +52,7 @@ var ( func init() { _ = clientgoscheme.AddToScheme(scheme) - _ = imagev1alpha1.AddToScheme(scheme) + _ = imagev1.AddToScheme(scheme) // +kubebuilder:scaffold:scheme } @@ -142,7 +142,7 @@ func main() { MetricsRecorder: metricsRecorder, Database: db, }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", imagev1alpha1.ImageRepositoryKind) + setupLog.Error(err, "unable to create controller", "controller", imagev1.ImageRepositoryKind) os.Exit(1) } if err = (&controllers.ImagePolicyReconciler{ @@ -153,7 +153,7 @@ func main() { MetricsRecorder: metricsRecorder, Database: db, }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", imagev1alpha1.ImagePolicyKind) + setupLog.Error(err, "unable to create controller", "controller", imagev1.ImagePolicyKind) os.Exit(1) } // +kubebuilder:scaffold:builder