From 1bca31f32ce6eb0839c53785fb3e1e207d4ffe58 Mon Sep 17 00:00:00 2001 From: fluxcdbot Date: Fri, 22 Jan 2021 16:07:19 +0000 Subject: [PATCH 1/2] Update toolkit components --- go.mod | 16 +++++----- go.sum | 32 +++++++++---------- .../bases/helm-controller/kustomization.yaml | 4 +-- .../kustomization.yaml | 4 +-- .../kustomization.yaml | 4 +-- .../kustomize-controller/kustomization.yaml | 4 +-- .../kustomization.yaml | 4 +-- .../source-controller/kustomization.yaml | 4 +-- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index 7d36c91f..be73fda1 100644 --- a/go.mod +++ b/go.mod @@ -5,17 +5,17 @@ go 1.15 require ( github.com/blang/semver/v4 v4.0.0 github.com/cyphar/filepath-securejoin v0.2.2 - github.com/fluxcd/helm-controller/api v0.5.2 - github.com/fluxcd/image-automation-controller/api v0.3.1 - github.com/fluxcd/image-reflector-controller/api v0.3.0 - github.com/fluxcd/kustomize-controller/api v0.6.3 - github.com/fluxcd/notification-controller/api v0.6.2 - github.com/fluxcd/pkg/apis/meta v0.6.0 + github.com/fluxcd/helm-controller/api v0.6.0 + github.com/fluxcd/image-automation-controller/api v0.4.0 + github.com/fluxcd/image-reflector-controller/api v0.4.1 + github.com/fluxcd/kustomize-controller/api v0.7.0 + github.com/fluxcd/notification-controller/api v0.7.0 + github.com/fluxcd/pkg/apis/meta v0.7.0 github.com/fluxcd/pkg/git v0.2.3 - github.com/fluxcd/pkg/runtime v0.7.0 + github.com/fluxcd/pkg/runtime v0.8.0 github.com/fluxcd/pkg/ssh v0.0.5 github.com/fluxcd/pkg/untar v0.0.5 - github.com/fluxcd/source-controller/api v0.6.3 + github.com/fluxcd/source-controller/api v0.7.0 github.com/google/go-containerregistry v0.2.0 github.com/manifoldco/promptui v0.7.0 github.com/olekukonko/tablewriter v0.0.4 diff --git a/go.sum b/go.sum index 8bfab09d..534eda43 100644 --- a/go.sum +++ b/go.sum @@ -191,32 +191,32 @@ github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi github.com/evanphx/json-patch v4.9.0+incompatible h1:kLcOMZeuLAJvL2BPWLMIj5oaZQobrkAqrL+WFZwQses= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fluxcd/helm-controller/api v0.5.2 h1:Ait1te6ZuUF2qq5HldEhe/a1ZY8Qt0MbV5Cgyet0YRc= -github.com/fluxcd/helm-controller/api v0.5.2/go.mod h1:ZEj0OwpEeJB7GHD/snN5Geik7sA803Qh/v3uyMXJc38= -github.com/fluxcd/image-automation-controller/api v0.3.1 h1:opRkBInI40r5TYznDJ4we+ORAp7CrSIz+6ycNbe9y9M= -github.com/fluxcd/image-automation-controller/api v0.3.1/go.mod h1:DvkU6Leqdj6j0p8k7fn0YXAVAsdsMY85D8DgOkAiCK0= -github.com/fluxcd/image-reflector-controller/api v0.3.0 h1:ZG/gb+XUQWX6FSvuzpvxz4kgdRp1mfRJIQyaHx4XMrQ= -github.com/fluxcd/image-reflector-controller/api v0.3.0/go.mod h1:tE+oSbiM0bXDhmt1Jrg5o9pdFmXCBxlpPn1GQSCzXv0= -github.com/fluxcd/kustomize-controller/api v0.6.3 h1:D9VUckaNf/j3uOjJVEGRwD1DNkATwr6n+1FZhl3RtHU= -github.com/fluxcd/kustomize-controller/api v0.6.3/go.mod h1:2mDr9WmZKd+m9Dg81tXDnQ8U0wh/9CiSdfT/4H68HCk= -github.com/fluxcd/notification-controller/api v0.6.2 h1:1wxHzHefzS27RzFeFA9c0IkGPA8lfEbV4+Fx0WI6GBA= -github.com/fluxcd/notification-controller/api v0.6.2/go.mod h1:Lfi/sZsVSxQh+bcep+NkY6xWeggffxp25iAqKB0Ylwc= +github.com/fluxcd/helm-controller/api v0.6.0 h1:ZeSwFZy00D2YlI2lkvmG2DwDODQZNvEnEd70SS7PvQQ= +github.com/fluxcd/helm-controller/api v0.6.0/go.mod h1:vd4Nt6ZZlDkXwJLkmHRgvNc1bvBPMEIZ0o1qFyEWglo= +github.com/fluxcd/image-automation-controller/api v0.4.0 h1:WMPVYfPQTLMvoINdoBDp5u26PJLO1EUZLyeQ95yHKgA= +github.com/fluxcd/image-automation-controller/api v0.4.0/go.mod h1:lHGxbFJNIwgK32YWx9uNf4WR/Z92Hdrl8cn6TzixfUI= +github.com/fluxcd/image-reflector-controller/api v0.4.1 h1:D1gJL6m7NYE8833eBoLT0qAJZ5Q2Yic3UtAEI10fiWg= +github.com/fluxcd/image-reflector-controller/api v0.4.1/go.mod h1:MS3mGjZLnzZsfSqVLGbp0WNJr/k8XRFpw4G6ApLFTbc= +github.com/fluxcd/kustomize-controller/api v0.7.0 h1:IyP6nSw1UOiQSCpOzfsw9INaLMmmVaR7pSdy6y1QSrs= +github.com/fluxcd/kustomize-controller/api v0.7.0/go.mod h1:GMdry0llCMT50hDcQ70ujmtd3vOXUWCJMTggPpGNM+I= +github.com/fluxcd/notification-controller/api v0.7.0 h1:/AIzEgjnOaCGcMVHP6TVqWfnFpkNvdlMdk8r6e3yWes= +github.com/fluxcd/notification-controller/api v0.7.0/go.mod h1:n1ow7Mxdcedrio5pf/HhBbaVp/4yGTFACPgfCtiyWoU= github.com/fluxcd/pkg/apis/meta v0.5.0 h1:FaU++mQY0g4sVVl+hG+vk0CXBLbb4EVfRuzs3IjLXvo= github.com/fluxcd/pkg/apis/meta v0.5.0/go.mod h1:aEUuZIawboAAFLlYz/juVJ7KNmlWbBtJFYkOWWmGUR4= -github.com/fluxcd/pkg/apis/meta v0.6.0 h1:3ETc/Yz4qXGKLj+Iti6vKFwVE024WX+Jr+jIHlxj7zs= -github.com/fluxcd/pkg/apis/meta v0.6.0/go.mod h1:yHuY8kyGHYz22I0jQzqMMGCcHViuzC/WPdo9Gisk8Po= +github.com/fluxcd/pkg/apis/meta v0.7.0 h1:5e8gm4OLqjuKWdrOIY5DEEsjcwzyJFK8rCDesJ+V8IY= +github.com/fluxcd/pkg/apis/meta v0.7.0/go.mod h1:yHuY8kyGHYz22I0jQzqMMGCcHViuzC/WPdo9Gisk8Po= github.com/fluxcd/pkg/git v0.2.3 h1:EodoXWrOywqY2aZlgddwRTnnWZc9m1J1e5kuX2Lu5P4= github.com/fluxcd/pkg/git v0.2.3/go.mod h1:8v0QVumu1ugMG3nJL0KMYPZgmLjzesJHA2sOtXAHLPA= github.com/fluxcd/pkg/runtime v0.6.2 h1:sWnSv6AhMY30fexRQ37lv2Q9Rvdu05zbiqMSldw+MjQ= github.com/fluxcd/pkg/runtime v0.6.2/go.mod h1:RuqYOYCvBJwo4rg83d28WOt2vfSaemuZCVpUagAjWQc= -github.com/fluxcd/pkg/runtime v0.7.0 h1:AMzqHGae0zqDQAmKwa1htjStk2wphwWF0xQw/zD3FY4= -github.com/fluxcd/pkg/runtime v0.7.0/go.mod h1:1dzGFwtowST5AIW5i9f0Pn0fMhCmOHFyBizuPJSKX+s= +github.com/fluxcd/pkg/runtime v0.8.0 h1:cnSBZJLcXlKgjXpFFFExu+4ZncIxmPgNIx+ErLcCLnA= +github.com/fluxcd/pkg/runtime v0.8.0/go.mod h1:tQwEN+RESjJmtwSSv7I+6bkNM9raIXpGsCjruaIVX6A= github.com/fluxcd/pkg/ssh v0.0.5 h1:rnbFZ7voy2JBlUfMbfyqArX2FYaLNpDhccGFC3qW83A= github.com/fluxcd/pkg/ssh v0.0.5/go.mod h1:7jXPdXZpc0ttMNz2kD9QuMi3RNn/e0DOFbj0Tij/+Hs= github.com/fluxcd/pkg/untar v0.0.5 h1:UGI3Ch1UIEIaqQvMicmImL1s9npQa64DJ/ozqHKB7gk= github.com/fluxcd/pkg/untar v0.0.5/go.mod h1:O6V9+rtl8c1mHBafgqFlJN6zkF1HS5SSYn7RpQJ/nfw= -github.com/fluxcd/source-controller/api v0.6.3 h1:i/NF0zXHp03gB9895LW0opNvW1QnNr3bFcANqHZJL64= -github.com/fluxcd/source-controller/api v0.6.3/go.mod h1:LzLXD6RfQ+4Es+gUuIZE4NCSW2WkWIK91EnVBCMvbQw= +github.com/fluxcd/source-controller/api v0.7.0 h1:QDpr6ZjHtTxw+mc+mZ1p9qRujHb+PzPdoQP3YgWlqOA= +github.com/fluxcd/source-controller/api v0.7.0/go.mod h1:u2sdc/QDm0tzXHL7mZVj928hc3MMU+4mKCuAQg+94Bk= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= diff --git a/manifests/bases/helm-controller/kustomization.yaml b/manifests/bases/helm-controller/kustomization.yaml index fc4e6089..f65ffd0f 100644 --- a/manifests/bases/helm-controller/kustomization.yaml +++ b/manifests/bases/helm-controller/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/helm-controller/archive/v0.5.2.zip//helm-controller-0.5.2/config/crd -- https://github.com/fluxcd/helm-controller/archive/v0.5.2.zip//helm-controller-0.5.2/config/manager +- https://github.com/fluxcd/helm-controller/archive/v0.6.0.zip//helm-controller-0.6.0/config/crd +- https://github.com/fluxcd/helm-controller/archive/v0.6.0.zip//helm-controller-0.6.0/config/manager patchesJson6902: - target: group: apps diff --git a/manifests/bases/image-automation-controller/kustomization.yaml b/manifests/bases/image-automation-controller/kustomization.yaml index ab0672e3..12803d42 100644 --- a/manifests/bases/image-automation-controller/kustomization.yaml +++ b/manifests/bases/image-automation-controller/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/image-automation-controller/archive/v0.3.1.zip//image-automation-controller-0.3.1/config/crd -- https://github.com/fluxcd/image-automation-controller/archive/v0.3.1.zip//image-automation-controller-0.3.1/config/manager +- https://github.com/fluxcd/image-automation-controller/archive/v0.4.0.zip//image-automation-controller-0.4.0/config/crd +- https://github.com/fluxcd/image-automation-controller/archive/v0.4.0.zip//image-automation-controller-0.4.0/config/manager patchesJson6902: - target: group: apps diff --git a/manifests/bases/image-reflector-controller/kustomization.yaml b/manifests/bases/image-reflector-controller/kustomization.yaml index ba3c5b28..9c1f49f1 100644 --- a/manifests/bases/image-reflector-controller/kustomization.yaml +++ b/manifests/bases/image-reflector-controller/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/image-reflector-controller/archive/v0.3.0.zip//image-reflector-controller-0.3.0/config/crd -- https://github.com/fluxcd/image-reflector-controller/archive/v0.3.0.zip//image-reflector-controller-0.3.0/config/manager +- https://github.com/fluxcd/image-reflector-controller/archive/v0.4.1.zip//image-reflector-controller-0.4.1/config/crd +- https://github.com/fluxcd/image-reflector-controller/archive/v0.4.1.zip//image-reflector-controller-0.4.1/config/manager patchesJson6902: - target: group: apps diff --git a/manifests/bases/kustomize-controller/kustomization.yaml b/manifests/bases/kustomize-controller/kustomization.yaml index bad6f791..964c0c80 100644 --- a/manifests/bases/kustomize-controller/kustomization.yaml +++ b/manifests/bases/kustomize-controller/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/kustomize-controller/archive/v0.6.3.zip//kustomize-controller-0.6.3/config/crd -- https://github.com/fluxcd/kustomize-controller/archive/v0.6.3.zip//kustomize-controller-0.6.3/config/manager +- https://github.com/fluxcd/kustomize-controller/archive/v0.7.0.zip//kustomize-controller-0.7.0/config/crd +- https://github.com/fluxcd/kustomize-controller/archive/v0.7.0.zip//kustomize-controller-0.7.0/config/manager patchesJson6902: - target: group: apps diff --git a/manifests/bases/notification-controller/kustomization.yaml b/manifests/bases/notification-controller/kustomization.yaml index d0174b0f..83d112b4 100644 --- a/manifests/bases/notification-controller/kustomization.yaml +++ b/manifests/bases/notification-controller/kustomization.yaml @@ -1,5 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/notification-controller/archive/v0.6.2.zip//notification-controller-0.6.2/config/crd -- https://github.com/fluxcd/notification-controller/archive/v0.6.2.zip//notification-controller-0.6.2/config/manager +- https://github.com/fluxcd/notification-controller/archive/v0.7.0.zip//notification-controller-0.7.0/config/crd +- https://github.com/fluxcd/notification-controller/archive/v0.7.0.zip//notification-controller-0.7.0/config/manager diff --git a/manifests/bases/source-controller/kustomization.yaml b/manifests/bases/source-controller/kustomization.yaml index dc60b42f..325c61cf 100644 --- a/manifests/bases/source-controller/kustomization.yaml +++ b/manifests/bases/source-controller/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/source-controller/archive/v0.6.3.zip//source-controller-0.6.3/config/crd -- https://github.com/fluxcd/source-controller/archive/v0.6.3.zip//source-controller-0.6.3/config/manager +- https://github.com/fluxcd/source-controller/archive/v0.7.0.zip//source-controller-0.7.0/config/crd +- https://github.com/fluxcd/source-controller/archive/v0.7.0.zip//source-controller-0.7.0/config/manager patchesJson6902: - target: group: apps From ac6c6e3a30409c58b48e4bbddb23c2d3c92f69e5 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 22 Jan 2021 17:17:00 +0100 Subject: [PATCH 2/2] Incorporate required API changes * Use `LocalObjectReference` and `NamespacedObjectKindReference` from `meta` package, as required by controller API changes. * Remove `Update` field from created `ImageUpdateAutomation`, as the API changed and the default is now defined in the Custom Resource Definition. Signed-off-by: Hidde Beydals --- cmd/flux/create_alert.go | 9 ++++----- cmd/flux/create_alertprovider.go | 6 +++--- cmd/flux/create_image_policy.go | 5 +++-- cmd/flux/create_image_repository.go | 5 +++-- cmd/flux/create_image_updateauto.go | 8 +++----- cmd/flux/create_kustomization.go | 12 ++++++------ cmd/flux/create_receiver.go | 6 +++--- cmd/flux/create_source_bucket.go | 8 +++++--- cmd/flux/create_source_git.go | 9 +++++---- cmd/flux/create_source_helm.go | 7 ++++--- pkg/manifestgen/sync/sync.go | 4 ++-- 11 files changed, 41 insertions(+), 38 deletions(-) diff --git a/cmd/flux/create_alert.go b/cmd/flux/create_alert.go index fb3d234b..8dbeb807 100644 --- a/cmd/flux/create_alert.go +++ b/cmd/flux/create_alert.go @@ -20,11 +20,7 @@ import ( "context" "fmt" - "github.com/fluxcd/flux2/internal/utils" - "github.com/fluxcd/pkg/apis/meta" - "github.com/spf13/cobra" - corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -33,6 +29,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1" + "github.com/fluxcd/pkg/apis/meta" + + "github.com/fluxcd/flux2/internal/utils" ) var createAlertCmd = &cobra.Command{ @@ -107,7 +106,7 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error { Labels: sourceLabels, }, Spec: notificationv1.AlertSpec{ - ProviderRef: corev1.LocalObjectReference{ + ProviderRef: meta.LocalObjectReference{ Name: alertArgs.providerRef, }, EventSeverity: alertArgs.eventSeverity, diff --git a/cmd/flux/create_alertprovider.go b/cmd/flux/create_alertprovider.go index d5b79d8c..dc7164cf 100644 --- a/cmd/flux/create_alertprovider.go +++ b/cmd/flux/create_alertprovider.go @@ -21,7 +21,6 @@ import ( "fmt" "github.com/spf13/cobra" - corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -29,9 +28,10 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/fluxcd/flux2/internal/utils" notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1" "github.com/fluxcd/pkg/apis/meta" + + "github.com/fluxcd/flux2/internal/utils" ) var createAlertProviderCmd = &cobra.Command{ @@ -107,7 +107,7 @@ func createAlertProviderCmdRun(cmd *cobra.Command, args []string) error { } if alertProviderArgs.secretRef != "" { - provider.Spec.SecretRef = &corev1.LocalObjectReference{ + provider.Spec.SecretRef = &meta.LocalObjectReference{ Name: alertProviderArgs.secretRef, } } diff --git a/cmd/flux/create_image_policy.go b/cmd/flux/create_image_policy.go index 3262c1e9..a53ac319 100644 --- a/cmd/flux/create_image_policy.go +++ b/cmd/flux/create_image_policy.go @@ -20,9 +20,10 @@ import ( "fmt" "github.com/spf13/cobra" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/fluxcd/pkg/apis/meta" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" ) @@ -82,7 +83,7 @@ func createImagePolicyRun(cmd *cobra.Command, args []string) error { Labels: labels, }, Spec: imagev1.ImagePolicySpec{ - ImageRepositoryRef: corev1.LocalObjectReference{ + ImageRepositoryRef: meta.LocalObjectReference{ Name: imagePolicyArgs.imageRef, }, }, diff --git a/cmd/flux/create_image_repository.go b/cmd/flux/create_image_repository.go index e82aeb49..d7f32cbd 100644 --- a/cmd/flux/create_image_repository.go +++ b/cmd/flux/create_image_repository.go @@ -22,9 +22,10 @@ import ( "github.com/google/go-containerregistry/pkg/name" "github.com/spf13/cobra" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/fluxcd/pkg/apis/meta" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1alpha1" ) @@ -89,7 +90,7 @@ func createImageRepositoryRun(cmd *cobra.Command, args []string) error { repo.Spec.Timeout = &metav1.Duration{Duration: imageRepoArgs.timeout} } if imageRepoArgs.secretRef != "" { - repo.Spec.SecretRef = &corev1.LocalObjectReference{ + repo.Spec.SecretRef = &meta.LocalObjectReference{ Name: imageRepoArgs.secretRef, } } diff --git a/cmd/flux/create_image_updateauto.go b/cmd/flux/create_image_updateauto.go index 871b64f2..83a2ec2f 100644 --- a/cmd/flux/create_image_updateauto.go +++ b/cmd/flux/create_image_updateauto.go @@ -20,9 +20,10 @@ import ( "fmt" "github.com/spf13/cobra" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/fluxcd/pkg/apis/meta" + autov1 "github.com/fluxcd/image-automation-controller/api/v1alpha1" ) @@ -85,15 +86,12 @@ func createImageUpdateRun(cmd *cobra.Command, args []string) error { }, Spec: autov1.ImageUpdateAutomationSpec{ Checkout: autov1.GitCheckoutSpec{ - GitRepositoryRef: corev1.LocalObjectReference{ + GitRepositoryRef: meta.LocalObjectReference{ Name: imageUpdateArgs.gitRepoRef, }, Branch: imageUpdateArgs.branch, }, Interval: metav1.Duration{Duration: createArgs.interval}, - Update: autov1.UpdateStrategy{ - Setters: &autov1.SettersStrategy{}, - }, Commit: autov1.CommitSpec{ AuthorName: imageUpdateArgs.authorName, AuthorEmail: imageUpdateArgs.authorEmail, diff --git a/cmd/flux/create_kustomization.go b/cmd/flux/create_kustomization.go index a16d3787..3f53528a 100644 --- a/cmd/flux/create_kustomization.go +++ b/cmd/flux/create_kustomization.go @@ -23,7 +23,6 @@ import ( "time" "github.com/spf13/cobra" - corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -31,11 +30,12 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/fluxcd/flux2/internal/flags" - "github.com/fluxcd/flux2/internal/utils" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1" "github.com/fluxcd/pkg/apis/meta" + + "github.com/fluxcd/flux2/internal/flags" + "github.com/fluxcd/flux2/internal/utils" ) var createKsCmd = &cobra.Command{ @@ -155,7 +155,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error { } if len(kustomizationArgs.healthCheck) > 0 { - healthChecks := make([]kustomizev1.CrossNamespaceObjectReference, 0) + healthChecks := make([]meta.NamespacedObjectKindReference, 0) for _, w := range kustomizationArgs.healthCheck { kindObj := strings.Split(w, "/") if len(kindObj) != 2 { @@ -178,7 +178,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error { return fmt.Errorf("invalid health check '%s' must be in the format 'kind/name.namespace'", w) } - check := kustomizev1.CrossNamespaceObjectReference{ + check := meta.NamespacedObjectKindReference{ Kind: kind, Name: nameNs[0], Namespace: nameNs[1], @@ -205,7 +205,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error { } if kustomizationArgs.decryptionSecret != "" { - kustomization.Spec.Decryption.SecretRef = &corev1.LocalObjectReference{Name: kustomizationArgs.decryptionSecret} + kustomization.Spec.Decryption.SecretRef = &meta.LocalObjectReference{Name: kustomizationArgs.decryptionSecret} } } diff --git a/cmd/flux/create_receiver.go b/cmd/flux/create_receiver.go index 62bba90c..49ab3b80 100644 --- a/cmd/flux/create_receiver.go +++ b/cmd/flux/create_receiver.go @@ -21,7 +21,6 @@ import ( "fmt" "github.com/spf13/cobra" - corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -29,9 +28,10 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/fluxcd/flux2/internal/utils" notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1" "github.com/fluxcd/pkg/apis/meta" + + "github.com/fluxcd/flux2/internal/utils" ) var createReceiverCmd = &cobra.Command{ @@ -117,7 +117,7 @@ func createReceiverCmdRun(cmd *cobra.Command, args []string) error { Type: receiverArgs.receiverType, Events: receiverArgs.events, Resources: resources, - SecretRef: corev1.LocalObjectReference{ + SecretRef: meta.LocalObjectReference{ Name: receiverArgs.secretRef, }, Suspend: false, diff --git a/cmd/flux/create_source_bucket.go b/cmd/flux/create_source_bucket.go index f6bae667..212dc685 100644 --- a/cmd/flux/create_source_bucket.go +++ b/cmd/flux/create_source_bucket.go @@ -30,9 +30,11 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/fluxcd/pkg/apis/meta" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + "github.com/fluxcd/flux2/internal/flags" "github.com/fluxcd/flux2/internal/utils" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" ) var createSourceBucketCmd = &cobra.Command{ @@ -136,7 +138,7 @@ func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error { }, } if sourceHelmArgs.secretRef != "" { - bucket.Spec.SecretRef = &corev1.LocalObjectReference{ + bucket.Spec.SecretRef = &meta.LocalObjectReference{ Name: sourceBucketArgs.secretRef, } } @@ -177,7 +179,7 @@ func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error { if err := upsertSecret(ctx, kubeClient, secret); err != nil { return err } - bucket.Spec.SecretRef = &corev1.LocalObjectReference{ + bucket.Spec.SecretRef = &meta.LocalObjectReference{ Name: secretName, } logger.Successf("authentication configured") diff --git a/cmd/flux/create_source_git.go b/cmd/flux/create_source_git.go index 0243e206..4b63b2ba 100644 --- a/cmd/flux/create_source_git.go +++ b/cmd/flux/create_source_git.go @@ -34,10 +34,11 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/fluxcd/flux2/internal/flags" - "github.com/fluxcd/flux2/internal/utils" "github.com/fluxcd/pkg/apis/meta" sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + + "github.com/fluxcd/flux2/internal/flags" + "github.com/fluxcd/flux2/internal/utils" ) type SourceGitFlags struct { @@ -180,7 +181,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error { if createArgs.export { if sourceArgs.GitSecretRef != "" { - gitRepository.Spec.SecretRef = &corev1.LocalObjectReference{ + gitRepository.Spec.SecretRef = &meta.LocalObjectReference{ Name: sourceArgs.GitSecretRef, } } @@ -269,7 +270,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error { if sourceArgs.GitSecretRef != "" { secretName = sourceArgs.GitSecretRef } - gitRepository.Spec.SecretRef = &corev1.LocalObjectReference{ + gitRepository.Spec.SecretRef = &meta.LocalObjectReference{ Name: secretName, } } diff --git a/cmd/flux/create_source_helm.go b/cmd/flux/create_source_helm.go index 0570604d..4c22b985 100644 --- a/cmd/flux/create_source_helm.go +++ b/cmd/flux/create_source_helm.go @@ -33,8 +33,9 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/fluxcd/flux2/internal/utils" sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + + "github.com/fluxcd/flux2/internal/utils" ) var createSourceHelmCmd = &cobra.Command{ @@ -128,7 +129,7 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error { } if sourceHelmArgs.secretRef != "" { - helmRepository.Spec.SecretRef = &corev1.LocalObjectReference{ + helmRepository.Spec.SecretRef = &meta.LocalObjectReference{ Name: sourceHelmArgs.secretRef, } } @@ -190,7 +191,7 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error { if err := upsertSecret(ctx, kubeClient, secret); err != nil { return err } - helmRepository.Spec.SecretRef = &corev1.LocalObjectReference{ + helmRepository.Spec.SecretRef = &meta.LocalObjectReference{ Name: secretName, } logger.Successf("authentication configured") diff --git a/pkg/manifestgen/sync/sync.go b/pkg/manifestgen/sync/sync.go index d112f6dd..e602b8b9 100644 --- a/pkg/manifestgen/sync/sync.go +++ b/pkg/manifestgen/sync/sync.go @@ -23,11 +23,11 @@ import ( "strings" "time" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1" + "github.com/fluxcd/pkg/apis/meta" sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" "github.com/fluxcd/flux2/pkg/manifestgen" @@ -52,7 +52,7 @@ func Generate(options Options) (*manifestgen.Manifest, error) { Reference: &sourcev1.GitRepositoryRef{ Branch: options.Branch, }, - SecretRef: &corev1.LocalObjectReference{ + SecretRef: &meta.LocalObjectReference{ Name: options.Name, }, GitImplementation: options.GitImplementation,