diff --git a/cmd/flux/build_kustomization.go b/cmd/flux/build_kustomization.go index 0c968ddf..516fadd8 100644 --- a/cmd/flux/build_kustomization.go +++ b/cmd/flux/build_kustomization.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "github.com/fluxcd/flux2/internal/build" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) var buildKsCmd = &cobra.Command{ diff --git a/cmd/flux/build_kustomization_test.go b/cmd/flux/build_kustomization_test.go index b4078195..5f134384 100644 --- a/cmd/flux/build_kustomization_test.go +++ b/cmd/flux/build_kustomization_test.go @@ -92,7 +92,7 @@ func TestBuildKustomization(t *testing.T) { } func TestBuildLocalKustomization(t *testing.T) { - podinfo := `apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 + podinfo := `apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: podinfo diff --git a/cmd/flux/create_alert.go b/cmd/flux/create_alert.go index 79a3bf3f..5f4e2164 100644 --- a/cmd/flux/create_alert.go +++ b/cmd/flux/create_alert.go @@ -28,7 +28,8 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" + notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2" "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/flux2/internal/utils" @@ -96,13 +97,13 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error { logger.Generatef("generating Alert") } - alert := notificationv1.Alert{ + alert := notificationv1b2.Alert{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: *kubeconfigArgs.Namespace, Labels: sourceLabels, }, - Spec: notificationv1.AlertSpec{ + Spec: notificationv1b2.AlertSpec{ ProviderRef: meta.LocalObjectReference{ Name: alertArgs.providerRef, }, @@ -140,13 +141,13 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error { } func upsertAlert(ctx context.Context, kubeClient client.Client, - alert *notificationv1.Alert) (types.NamespacedName, error) { + alert *notificationv1b2.Alert) (types.NamespacedName, error) { namespacedName := types.NamespacedName{ Namespace: alert.GetNamespace(), Name: alert.GetName(), } - var existing notificationv1.Alert + var existing notificationv1b2.Alert err := kubeClient.Get(ctx, namespacedName, &existing) if err != nil { if errors.IsNotFound(err) { @@ -171,7 +172,7 @@ func upsertAlert(ctx context.Context, kubeClient client.Client, } func isAlertReady(ctx context.Context, kubeClient client.Client, - namespacedName types.NamespacedName, alert *notificationv1.Alert) wait.ConditionFunc { + namespacedName types.NamespacedName, alert *notificationv1b2.Alert) wait.ConditionFunc { return func() (bool, error) { err := kubeClient.Get(ctx, namespacedName, alert) if err != nil { diff --git a/cmd/flux/create_image_update.go b/cmd/flux/create_image_update.go index 7bf6a28d..3a17ce06 100644 --- a/cmd/flux/create_image_update.go +++ b/cmd/flux/create_image_update.go @@ -23,7 +23,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var createImageUpdateCmd = &cobra.Command{ diff --git a/cmd/flux/create_kustomization.go b/cmd/flux/create_kustomization.go index 6da5365a..b88f243b 100644 --- a/cmd/flux/create_kustomization.go +++ b/cmd/flux/create_kustomization.go @@ -31,7 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/flux2/internal/flags" diff --git a/cmd/flux/create_receiver.go b/cmd/flux/create_receiver.go index f8669172..0114582e 100644 --- a/cmd/flux/create_receiver.go +++ b/cmd/flux/create_receiver.go @@ -28,7 +28,7 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/flux2/internal/utils" diff --git a/cmd/flux/create_source_git.go b/cmd/flux/create_source_git.go index e915268b..83d895dd 100644 --- a/cmd/flux/create_source_git.go +++ b/cmd/flux/create_source_git.go @@ -37,7 +37,7 @@ import ( "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/runtime/conditions" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" "github.com/fluxcd/flux2/internal/flags" "github.com/fluxcd/flux2/internal/utils" diff --git a/cmd/flux/create_source_git_test.go b/cmd/flux/create_source_git_test.go index 5517c811..27365990 100644 --- a/cmd/flux/create_source_git_test.go +++ b/cmd/flux/create_source_git_test.go @@ -24,14 +24,15 @@ import ( "testing" "time" - "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "k8s.io/apimachinery/pkg/api/errors" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "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/v1" ) var pollInterval = 50 * time.Millisecond @@ -176,6 +177,9 @@ func TestCreateSourceGit(t *testing.T) { repo.Status.Artifact = &sourcev1.Artifact{ Path: "some-path", Revision: "v1", + LastUpdateTime: metav1.Time{ + Time: time.Now(), + }, } }, }, { diff --git a/cmd/flux/delete_kustomization.go b/cmd/flux/delete_kustomization.go index 257d7362..699d4a87 100644 --- a/cmd/flux/delete_kustomization.go +++ b/cmd/flux/delete_kustomization.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) var deleteKsCmd = &cobra.Command{ diff --git a/cmd/flux/delete_receiver.go b/cmd/flux/delete_receiver.go index 42eb6ca6..8bdaab85 100644 --- a/cmd/flux/delete_receiver.go +++ b/cmd/flux/delete_receiver.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" ) var deleteReceiverCmd = &cobra.Command{ diff --git a/cmd/flux/delete_source_git.go b/cmd/flux/delete_source_git.go index c43398d5..78dec208 100644 --- a/cmd/flux/delete_source_git.go +++ b/cmd/flux/delete_source_git.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var deleteSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/diff_kustomization.go b/cmd/flux/diff_kustomization.go index 335717f6..8b406417 100644 --- a/cmd/flux/diff_kustomization.go +++ b/cmd/flux/diff_kustomization.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "github.com/fluxcd/flux2/internal/build" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) var diffKsCmd = &cobra.Command{ diff --git a/cmd/flux/events.go b/cmd/flux/events.go index ae25e0c3..3017a2db 100644 --- a/cmd/flux/events.go +++ b/cmd/flux/events.go @@ -42,9 +42,11 @@ import ( helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" + notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/internal/utils" "github.com/fluxcd/flux2/pkg/printers" @@ -390,18 +392,18 @@ var fluxKindMap = refMap{ gv: helmv2.GroupVersion, crossNamespaced: true, otherRefs: func(namespace, name string) []string { - return []string{fmt.Sprintf("%s/%s-%s", sourcev1.HelmChartKind, namespace, name)} + return []string{fmt.Sprintf("%s/%s-%s", sourcev1b2.HelmChartKind, namespace, name)} }, field: []string{"spec", "chart", "spec", "sourceRef"}, }, - notificationv1.AlertKind: { - gv: notificationv1.GroupVersion, - kind: notificationv1.ProviderKind, + notificationv1b2.AlertKind: { + gv: notificationv1b2.GroupVersion, + kind: notificationv1b2.ProviderKind, crossNamespaced: false, field: []string{"spec", "providerRef"}, }, - notificationv1.ReceiverKind: {gv: notificationv1.GroupVersion}, - notificationv1.ProviderKind: {gv: notificationv1.GroupVersion}, + notificationv1.ReceiverKind: {gv: notificationv1.GroupVersion}, + notificationv1b2.ProviderKind: {gv: notificationv1b2.GroupVersion}, imagev1.ImagePolicyKind: { gv: imagev1.GroupVersion, kind: imagev1.ImageRepositoryKind, @@ -409,10 +411,10 @@ var fluxKindMap = refMap{ field: []string{"spec", "imageRepositoryRef"}, }, sourcev1.GitRepositoryKind: {gv: sourcev1.GroupVersion}, - sourcev1.OCIRepositoryKind: {gv: sourcev1.GroupVersion}, - sourcev1.BucketKind: {gv: sourcev1.GroupVersion}, - sourcev1.HelmRepositoryKind: {gv: sourcev1.GroupVersion}, - sourcev1.HelmChartKind: {gv: sourcev1.GroupVersion}, + sourcev1b2.OCIRepositoryKind: {gv: sourcev1b2.GroupVersion}, + sourcev1b2.BucketKind: {gv: sourcev1b2.GroupVersion}, + sourcev1b2.HelmRepositoryKind: {gv: sourcev1b2.GroupVersion}, + sourcev1b2.HelmChartKind: {gv: sourcev1b2.GroupVersion}, autov1.ImageUpdateAutomationKind: {gv: autov1.GroupVersion}, imagev1.ImageRepositoryKind: {gv: imagev1.GroupVersion}, } diff --git a/cmd/flux/events_test.go b/cmd/flux/events_test.go index 12076c50..cbd098b9 100644 --- a/cmd/flux/events_test.go +++ b/cmd/flux/events_test.go @@ -23,15 +23,6 @@ import ( "strings" "testing" - "github.com/fluxcd/flux2/internal/utils" - helmv2beta1 "github.com/fluxcd/helm-controller/api/v2beta1" - autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" - imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" - eventv1 "github.com/fluxcd/pkg/apis/event/v1beta1" - "github.com/fluxcd/pkg/ssa" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,10 +31,23 @@ import ( cmdutil "k8s.io/kubectl/pkg/cmd/util" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" + + helmv2beta1 "github.com/fluxcd/helm-controller/api/v2beta1" + autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" + notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2" + eventv1 "github.com/fluxcd/pkg/apis/event/v1beta1" + "github.com/fluxcd/pkg/ssa" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" + + "github.com/fluxcd/flux2/internal/utils" ) var objects = ` -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: flux-system @@ -56,7 +60,7 @@ spec: kind: GitRepository name: flux-system --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: podinfo @@ -70,7 +74,7 @@ spec: name: flux-system namespace: flux-system --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: flux-system @@ -376,9 +380,11 @@ func getScheme() *runtime.Scheme { kustomizev1.AddToScheme(newscheme) helmv2beta1.AddToScheme(newscheme) notificationv1.AddToScheme(newscheme) + notificationv1b2.AddToScheme(newscheme) imagev1.AddToScheme(newscheme) autov1.AddToScheme(newscheme) sourcev1.AddToScheme(newscheme) + sourcev1b2.AddToScheme(newscheme) return newscheme } diff --git a/cmd/flux/export_kustomization.go b/cmd/flux/export_kustomization.go index ed613dcc..139f072b 100644 --- a/cmd/flux/export_kustomization.go +++ b/cmd/flux/export_kustomization.go @@ -20,7 +20,7 @@ import ( "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) var exportKsCmd = &cobra.Command{ diff --git a/cmd/flux/export_receiver.go b/cmd/flux/export_receiver.go index 22526f7e..1ef18282 100644 --- a/cmd/flux/export_receiver.go +++ b/cmd/flux/export_receiver.go @@ -20,7 +20,7 @@ import ( "github.com/spf13/cobra" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" ) var exportReceiverCmd = &cobra.Command{ @@ -44,7 +44,7 @@ func init() { } func exportReceiver(receiver *notificationv1.Receiver) interface{} { - gvk := notificationv1.GroupVersion.WithKind("Receiver") + gvk := notificationv1.GroupVersion.WithKind(notificationv1.ReceiverKind) export := notificationv1.Receiver{ TypeMeta: metav1.TypeMeta{ Kind: gvk.Kind, diff --git a/cmd/flux/export_source_git.go b/cmd/flux/export_source_git.go index f1af1659..57ab7e77 100644 --- a/cmd/flux/export_source_git.go +++ b/cmd/flux/export_source_git.go @@ -21,7 +21,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var exportSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/get_all.go b/cmd/flux/get_all.go index c4567f04..d3e88ccc 100644 --- a/cmd/flux/get_all.go +++ b/cmd/flux/get_all.go @@ -22,8 +22,9 @@ import ( "github.com/spf13/cobra" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" + notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2" ) var getAllCmd = &cobra.Command{ @@ -62,11 +63,11 @@ var getAllCmd = &cobra.Command{ }, { apiType: alertProviderType, - list: alertProviderListAdapter{¬ificationv1.ProviderList{}}, + list: alertProviderListAdapter{¬ificationv1b2.ProviderList{}}, }, { apiType: alertType, - list: &alertListAdapter{¬ificationv1.AlertList{}}, + list: &alertListAdapter{¬ificationv1b2.AlertList{}}, }, } diff --git a/cmd/flux/get_kustomization.go b/cmd/flux/get_kustomization.go index 0dc9f72d..9ce5381a 100644 --- a/cmd/flux/get_kustomization.go +++ b/cmd/flux/get_kustomization.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" "github.com/fluxcd/flux2/internal/utils" ) diff --git a/cmd/flux/get_receiver.go b/cmd/flux/get_receiver.go index 0123b664..b20cab9b 100644 --- a/cmd/flux/get_receiver.go +++ b/cmd/flux/get_receiver.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" ) var getReceiverCmd = &cobra.Command{ diff --git a/cmd/flux/get_source_all.go b/cmd/flux/get_source_all.go index ac6560fe..abae5ca8 100644 --- a/cmd/flux/get_source_all.go +++ b/cmd/flux/get_source_all.go @@ -21,7 +21,8 @@ import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) var getSourceAllCmd = &cobra.Command{ @@ -42,11 +43,11 @@ var getSourceAllCmd = &cobra.Command{ var allSourceCmd = []getCommand{ { apiType: ociRepositoryType, - list: &ociRepositoryListAdapter{&sourcev1.OCIRepositoryList{}}, + list: &ociRepositoryListAdapter{&sourcev1b2.OCIRepositoryList{}}, }, { apiType: bucketType, - list: &bucketListAdapter{&sourcev1.BucketList{}}, + list: &bucketListAdapter{&sourcev1b2.BucketList{}}, }, { apiType: gitRepositoryType, @@ -54,11 +55,11 @@ var getSourceAllCmd = &cobra.Command{ }, { apiType: helmRepositoryType, - list: &helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}}, + list: &helmRepositoryListAdapter{&sourcev1b2.HelmRepositoryList{}}, }, { apiType: helmChartType, - list: &helmChartListAdapter{&sourcev1.HelmChartList{}}, + list: &helmChartListAdapter{&sourcev1b2.HelmChartList{}}, }, } diff --git a/cmd/flux/get_source_git.go b/cmd/flux/get_source_git.go index 5df1b907..623da707 100644 --- a/cmd/flux/get_source_git.go +++ b/cmd/flux/get_source_git.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" "github.com/fluxcd/flux2/internal/utils" ) diff --git a/cmd/flux/kustomization.go b/cmd/flux/kustomization.go index 0c13f7f5..56e6abc5 100644 --- a/cmd/flux/kustomization.go +++ b/cmd/flux/kustomization.go @@ -19,7 +19,7 @@ package main import ( "sigs.k8s.io/controller-runtime/pkg/client" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) // kustomizev1.Kustomization diff --git a/cmd/flux/list_artifact.go b/cmd/flux/list_artifact.go index fc72c32b..f2b2f75c 100644 --- a/cmd/flux/list_artifact.go +++ b/cmd/flux/list_artifact.go @@ -20,13 +20,13 @@ import ( "context" "fmt" - "github.com/fluxcd/flux2/internal/flags" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/spf13/cobra" + "github.com/fluxcd/flux2/pkg/printers" oci "github.com/fluxcd/pkg/oci/client" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" - "github.com/fluxcd/flux2/pkg/printers" + "github.com/fluxcd/flux2/internal/flags" ) type listArtifactFlags struct { diff --git a/cmd/flux/receiver.go b/cmd/flux/receiver.go index f97bcb19..428f8378 100644 --- a/cmd/flux/receiver.go +++ b/cmd/flux/receiver.go @@ -19,7 +19,7 @@ package main import ( "sigs.k8s.io/controller-runtime/pkg/client" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" ) // notificationv1.Receiver diff --git a/cmd/flux/reconcile.go b/cmd/flux/reconcile.go index 7c41fee9..6221e117 100644 --- a/cmd/flux/reconcile.go +++ b/cmd/flux/reconcile.go @@ -30,7 +30,8 @@ import ( "k8s.io/client-go/util/retry" "sigs.k8s.io/controller-runtime/pkg/client" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" + notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2" "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/flux2/internal/utils" @@ -111,7 +112,7 @@ func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error { } logger.Successf("%s annotated", reconcile.kind) - if reconcile.kind == notificationv1.AlertKind || reconcile.kind == notificationv1.ReceiverKind { + if reconcile.kind == notificationv1b2.AlertKind || reconcile.kind == notificationv1.ReceiverKind { if err = wait.PollImmediate(rootArgs.pollInterval, rootArgs.timeout, isReconcileReady(ctx, kubeClient, namespacedName, reconcile.object)); err != nil { return err diff --git a/cmd/flux/reconcile_helmrelease.go b/cmd/flux/reconcile_helmrelease.go index 1a513369..2433dd09 100644 --- a/cmd/flux/reconcile_helmrelease.go +++ b/cmd/flux/reconcile_helmrelease.go @@ -21,7 +21,8 @@ import ( "k8s.io/apimachinery/pkg/types" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) var reconcileHrCmd = &cobra.Command{ @@ -65,20 +66,20 @@ func (obj helmReleaseAdapter) reconcileSource() bool { func (obj helmReleaseAdapter) getSource() (reconcileCommand, types.NamespacedName) { var cmd reconcileCommand switch obj.Spec.Chart.Spec.SourceRef.Kind { - case sourcev1.HelmRepositoryKind: + case sourcev1b2.HelmRepositoryKind: cmd = reconcileCommand{ apiType: helmRepositoryType, - object: helmRepositoryAdapter{&sourcev1.HelmRepository{}}, + object: helmRepositoryAdapter{&sourcev1b2.HelmRepository{}}, } case sourcev1.GitRepositoryKind: cmd = reconcileCommand{ apiType: gitRepositoryType, object: gitRepositoryAdapter{&sourcev1.GitRepository{}}, } - case sourcev1.BucketKind: + case sourcev1b2.BucketKind: cmd = reconcileCommand{ apiType: bucketType, - object: bucketAdapter{&sourcev1.Bucket{}}, + object: bucketAdapter{&sourcev1b2.Bucket{}}, } } diff --git a/cmd/flux/reconcile_kustomization.go b/cmd/flux/reconcile_kustomization.go index cdc6e7ac..7396091b 100644 --- a/cmd/flux/reconcile_kustomization.go +++ b/cmd/flux/reconcile_kustomization.go @@ -20,8 +20,9 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/types" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) var reconcileKsCmd = &cobra.Command{ @@ -65,20 +66,20 @@ func (obj kustomizationAdapter) reconcileSource() bool { func (obj kustomizationAdapter) getSource() (reconcileCommand, types.NamespacedName) { var cmd reconcileCommand switch obj.Spec.SourceRef.Kind { - case sourcev1.OCIRepositoryKind: + case sourcev1b2.OCIRepositoryKind: cmd = reconcileCommand{ apiType: ociRepositoryType, - object: ociRepositoryAdapter{&sourcev1.OCIRepository{}}, + object: ociRepositoryAdapter{&sourcev1b2.OCIRepository{}}, } case sourcev1.GitRepositoryKind: cmd = reconcileCommand{ apiType: gitRepositoryType, object: gitRepositoryAdapter{&sourcev1.GitRepository{}}, } - case sourcev1.BucketKind: + case sourcev1b2.BucketKind: cmd = reconcileCommand{ apiType: bucketType, - object: bucketAdapter{&sourcev1.Bucket{}}, + object: bucketAdapter{&sourcev1b2.Bucket{}}, } } diff --git a/cmd/flux/reconcile_receiver.go b/cmd/flux/reconcile_receiver.go index 4c43f80f..cb415627 100644 --- a/cmd/flux/reconcile_receiver.go +++ b/cmd/flux/reconcile_receiver.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/flux2/internal/utils" diff --git a/cmd/flux/reconcile_source_git.go b/cmd/flux/reconcile_source_git.go index 375291ed..a42cd7b9 100644 --- a/cmd/flux/reconcile_source_git.go +++ b/cmd/flux/reconcile_source_git.go @@ -21,7 +21,7 @@ import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var reconcileSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/resume_kustomization.go b/cmd/flux/resume_kustomization.go index b1ac2072..fb8da244 100644 --- a/cmd/flux/resume_kustomization.go +++ b/cmd/flux/resume_kustomization.go @@ -21,7 +21,7 @@ import ( "github.com/spf13/cobra" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) var resumeKsCmd = &cobra.Command{ diff --git a/cmd/flux/resume_receiver.go b/cmd/flux/resume_receiver.go index 1aa8993d..eef0d1e0 100644 --- a/cmd/flux/resume_receiver.go +++ b/cmd/flux/resume_receiver.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" ) var resumeReceiverCmd = &cobra.Command{ diff --git a/cmd/flux/resume_source_git.go b/cmd/flux/resume_source_git.go index 05a9a095..00655285 100644 --- a/cmd/flux/resume_source_git.go +++ b/cmd/flux/resume_source_git.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var resumeSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/source.go b/cmd/flux/source.go index 4177c159..7dc96fdf 100644 --- a/cmd/flux/source.go +++ b/cmd/flux/source.go @@ -19,7 +19,8 @@ package main import ( "sigs.k8s.io/controller-runtime/pkg/client" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) // These are general-purpose adapters for attaching methods to, for @@ -29,13 +30,13 @@ import ( // sourcev1.ociRepository var ociRepositoryType = apiType{ - kind: sourcev1.OCIRepositoryKind, + kind: sourcev1b2.OCIRepositoryKind, humanKind: "source oci", - groupVersion: sourcev1.GroupVersion, + groupVersion: sourcev1b2.GroupVersion, } type ociRepositoryAdapter struct { - *sourcev1.OCIRepository + *sourcev1b2.OCIRepository } func (a ociRepositoryAdapter) asClientObject() client.Object { @@ -46,10 +47,10 @@ func (a ociRepositoryAdapter) deepCopyClientObject() client.Object { return a.OCIRepository.DeepCopy() } -// sourcev1.OCIRepositoryList +// sourcev1b2.OCIRepositoryList type ociRepositoryListAdapter struct { - *sourcev1.OCIRepositoryList + *sourcev1b2.OCIRepositoryList } func (a ociRepositoryListAdapter) asClientList() client.ObjectList { @@ -60,16 +61,16 @@ func (a ociRepositoryListAdapter) len() int { return len(a.OCIRepositoryList.Items) } -// sourcev1.Bucket +// sourcev1b2.Bucket var bucketType = apiType{ - kind: sourcev1.BucketKind, + kind: sourcev1b2.BucketKind, humanKind: "source bucket", - groupVersion: sourcev1.GroupVersion, + groupVersion: sourcev1b2.GroupVersion, } type bucketAdapter struct { - *sourcev1.Bucket + *sourcev1b2.Bucket } func (a bucketAdapter) asClientObject() client.Object { @@ -80,10 +81,10 @@ func (a bucketAdapter) deepCopyClientObject() client.Object { return a.Bucket.DeepCopy() } -// sourcev1.BucketList +// sourcev1b2.BucketList type bucketListAdapter struct { - *sourcev1.BucketList + *sourcev1b2.BucketList } func (a bucketListAdapter) asClientList() client.ObjectList { @@ -94,16 +95,16 @@ func (a bucketListAdapter) len() int { return len(a.BucketList.Items) } -// sourcev1.HelmChart +// sourcev1b2.HelmChart var helmChartType = apiType{ - kind: sourcev1.HelmChartKind, + kind: sourcev1b2.HelmChartKind, humanKind: "source chart", - groupVersion: sourcev1.GroupVersion, + groupVersion: sourcev1b2.GroupVersion, } type helmChartAdapter struct { - *sourcev1.HelmChart + *sourcev1b2.HelmChart } func (a helmChartAdapter) asClientObject() client.Object { @@ -114,10 +115,10 @@ func (a helmChartAdapter) deepCopyClientObject() client.Object { return a.HelmChart.DeepCopy() } -// sourcev1.HelmChartList +// sourcev1b2.HelmChartList type helmChartListAdapter struct { - *sourcev1.HelmChartList + *sourcev1b2.HelmChartList } func (a helmChartListAdapter) asClientList() client.ObjectList { @@ -162,16 +163,16 @@ func (a gitRepositoryListAdapter) len() int { return len(a.GitRepositoryList.Items) } -// sourcev1.HelmRepository +// sourcev1b2.HelmRepository var helmRepositoryType = apiType{ - kind: sourcev1.HelmRepositoryKind, + kind: sourcev1b2.HelmRepositoryKind, humanKind: "source helm", - groupVersion: sourcev1.GroupVersion, + groupVersion: sourcev1b2.GroupVersion, } type helmRepositoryAdapter struct { - *sourcev1.HelmRepository + *sourcev1b2.HelmRepository } func (a helmRepositoryAdapter) asClientObject() client.Object { @@ -182,10 +183,10 @@ func (a helmRepositoryAdapter) deepCopyClientObject() client.Object { return a.HelmRepository.DeepCopy() } -// sourcev1.HelmRepositoryList +// sourcev1b2.HelmRepositoryList type helmRepositoryListAdapter struct { - *sourcev1.HelmRepositoryList + *sourcev1b2.HelmRepositoryList } func (a helmRepositoryListAdapter) asClientList() client.ObjectList { diff --git a/cmd/flux/stats.go b/cmd/flux/stats.go index fa6eb47f..78692fbe 100644 --- a/cmd/flux/stats.go +++ b/cmd/flux/stats.go @@ -19,20 +19,24 @@ package main import ( "context" "fmt" - "github.com/fluxcd/flux2/internal/utils" - "github.com/fluxcd/flux2/pkg/printers" - helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" - autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" - imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta1" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "sigs.k8s.io/cli-utils/pkg/kstatus/status" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/fluxcd/flux2/internal/utils" + "github.com/fluxcd/flux2/pkg/printers" + helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" + autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" + imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" + notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) var statsCmd = &cobra.Command{ @@ -76,24 +80,24 @@ func runStatsCmd(cmd *cobra.Command, args []string) error { Group: sourcev1.GroupVersion.Group, }, { - Kind: sourcev1.OCIRepositoryKind, - Version: sourcev1.GroupVersion.Version, - Group: sourcev1.GroupVersion.Group, + Kind: sourcev1b2.OCIRepositoryKind, + Version: sourcev1b2.GroupVersion.Version, + Group: sourcev1b2.GroupVersion.Group, }, { - Kind: sourcev1.HelmRepositoryKind, - Version: sourcev1.GroupVersion.Version, - Group: sourcev1.GroupVersion.Group, + Kind: sourcev1b2.HelmRepositoryKind, + Version: sourcev1b2.GroupVersion.Version, + Group: sourcev1b2.GroupVersion.Group, }, { - Kind: sourcev1.HelmChartKind, - Version: sourcev1.GroupVersion.Version, - Group: sourcev1.GroupVersion.Group, + Kind: sourcev1b2.HelmChartKind, + Version: sourcev1b2.GroupVersion.Version, + Group: sourcev1b2.GroupVersion.Group, }, { - Kind: sourcev1.BucketKind, - Version: sourcev1.GroupVersion.Version, - Group: sourcev1.GroupVersion.Group, + Kind: sourcev1b2.BucketKind, + Version: sourcev1b2.GroupVersion.Version, + Group: sourcev1b2.GroupVersion.Group, }, { Kind: kustomizev1.KustomizationKind, @@ -106,14 +110,14 @@ func runStatsCmd(cmd *cobra.Command, args []string) error { Group: helmv2.GroupVersion.Group, }, { - Kind: notificationv1.AlertKind, - Version: notificationv1.GroupVersion.Version, - Group: notificationv1.GroupVersion.Group, + Kind: notificationv1b2.AlertKind, + Version: notificationv1b2.GroupVersion.Version, + Group: notificationv1b2.GroupVersion.Group, }, { - Kind: notificationv1.ProviderKind, - Version: notificationv1.GroupVersion.Version, - Group: notificationv1.GroupVersion.Group, + Kind: notificationv1b2.ProviderKind, + Version: notificationv1b2.GroupVersion.Version, + Group: notificationv1b2.GroupVersion.Group, }, { Kind: notificationv1.ReceiverKind, diff --git a/cmd/flux/suspend_kustomization.go b/cmd/flux/suspend_kustomization.go index 46d12276..a054a88d 100644 --- a/cmd/flux/suspend_kustomization.go +++ b/cmd/flux/suspend_kustomization.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) var suspendKsCmd = &cobra.Command{ diff --git a/cmd/flux/suspend_receiver.go b/cmd/flux/suspend_receiver.go index fec5cc88..4480cc50 100644 --- a/cmd/flux/suspend_receiver.go +++ b/cmd/flux/suspend_receiver.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" ) var suspendReceiverCmd = &cobra.Command{ diff --git a/cmd/flux/suspend_source_git.go b/cmd/flux/suspend_source_git.go index 19490b10..cf955111 100644 --- a/cmd/flux/suspend_source_git.go +++ b/cmd/flux/suspend_source_git.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var suspendSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/tag_artifact.go b/cmd/flux/tag_artifact.go index 0763b697..f0ca6f5d 100644 --- a/cmd/flux/tag_artifact.go +++ b/cmd/flux/tag_artifact.go @@ -20,11 +20,12 @@ import ( "context" "fmt" - "github.com/fluxcd/flux2/internal/flags" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/spf13/cobra" oci "github.com/fluxcd/pkg/oci/client" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + + "github.com/fluxcd/flux2/internal/flags" ) var tagArtifactCmd = &cobra.Command{ diff --git a/cmd/flux/testdata/build-kustomization/podinfo-kustomization.yaml b/cmd/flux/testdata/build-kustomization/podinfo-kustomization.yaml index 72103efe..9f5e3ef3 100644 --- a/cmd/flux/testdata/build-kustomization/podinfo-kustomization.yaml +++ b/cmd/flux/testdata/build-kustomization/podinfo-kustomization.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: podinfo diff --git a/cmd/flux/testdata/build-kustomization/podinfo-source.yaml b/cmd/flux/testdata/build-kustomization/podinfo-source.yaml index 745dd650..409482dd 100644 --- a/cmd/flux/testdata/build-kustomization/podinfo-source.yaml +++ b/cmd/flux/testdata/build-kustomization/podinfo-source.yaml @@ -4,7 +4,7 @@ kind: Namespace metadata: name: {{ .fluxns }} --- -apiVersion: source.toolkit.fluxcd.io/v1beta1 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_git/export.golden b/cmd/flux/testdata/create_source_git/export.golden index c909bd25..b23aaaab 100644 --- a/cmd/flux/testdata/create_source_git/export.golden +++ b/cmd/flux/testdata/create_source_git/export.golden @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_git/source-git-branch-commit.yaml b/cmd/flux/testdata/create_source_git/source-git-branch-commit.yaml index e767a58d..d8ce277e 100644 --- a/cmd/flux/testdata/create_source_git/source-git-branch-commit.yaml +++ b/cmd/flux/testdata/create_source_git/source-git-branch-commit.yaml @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_git/source-git-branch.yaml b/cmd/flux/testdata/create_source_git/source-git-branch.yaml index 8d4ea097..ecf12ef2 100644 --- a/cmd/flux/testdata/create_source_git/source-git-branch.yaml +++ b/cmd/flux/testdata/create_source_git/source-git-branch.yaml @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_git/source-git-commit.yaml b/cmd/flux/testdata/create_source_git/source-git-commit.yaml index 4600b3cd..87e0a733 100644 --- a/cmd/flux/testdata/create_source_git/source-git-commit.yaml +++ b/cmd/flux/testdata/create_source_git/source-git-commit.yaml @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_git/source-git-refname.yaml b/cmd/flux/testdata/create_source_git/source-git-refname.yaml index ce45f216..0009c36b 100644 --- a/cmd/flux/testdata/create_source_git/source-git-refname.yaml +++ b/cmd/flux/testdata/create_source_git/source-git-refname.yaml @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_git/source-git-semver.yaml b/cmd/flux/testdata/create_source_git/source-git-semver.yaml index f5162811..3fdbb7e4 100644 --- a/cmd/flux/testdata/create_source_git/source-git-semver.yaml +++ b/cmd/flux/testdata/create_source_git/source-git-semver.yaml @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_git/source-git-tag.yaml b/cmd/flux/testdata/create_source_git/source-git-tag.yaml index b550fd84..6ea46324 100644 --- a/cmd/flux/testdata/create_source_git/source-git-tag.yaml +++ b/cmd/flux/testdata/create_source_git/source-git-tag.yaml @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/export/git-repo.yaml b/cmd/flux/testdata/export/git-repo.yaml index e3a12bcd..58743c74 100644 --- a/cmd/flux/testdata/export/git-repo.yaml +++ b/cmd/flux/testdata/export/git-repo.yaml @@ -1,11 +1,10 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: flux-system namespace: {{ .fluxns }} spec: - gitImplementation: go-git interval: 5m0s ref: branch: main diff --git a/cmd/flux/testdata/export/ks.yaml b/cmd/flux/testdata/export/ks.yaml index 891f76b5..5130ab8f 100644 --- a/cmd/flux/testdata/export/ks.yaml +++ b/cmd/flux/testdata/export/ks.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: flux-system diff --git a/cmd/flux/testdata/export/objects.yaml b/cmd/flux/testdata/export/objects.yaml index b052199d..aa1b6f19 100644 --- a/cmd/flux/testdata/export/objects.yaml +++ b/cmd/flux/testdata/export/objects.yaml @@ -71,7 +71,7 @@ spec: path: ./clusters/my-cluster strategy: Setters --- -apiVersion: source.toolkit.fluxcd.io/v1beta1 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: flux-system @@ -84,7 +84,7 @@ spec: interval: 5m url: ssh://git@github.com/example/repo --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta1 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: flux-system @@ -97,7 +97,7 @@ spec: interval: 5m prune: true --- -apiVersion: notification.toolkit.fluxcd.io/v1beta2 +apiVersion: notification.toolkit.fluxcd.io/v1 kind: Receiver metadata: name: flux-system @@ -114,7 +114,7 @@ spec: name: flux-system namespace: flux-system --- -apiVersion: source.toolkit.fluxcd.io/v1beta1 +apiVersion: source.toolkit.fluxcd.io/v1beta2 kind: HelmRepository metadata: name: flux-system @@ -139,7 +139,7 @@ spec: name: flux-systen namespace: {{ .fluxns }} --- -apiVersion: source.toolkit.fluxcd.io/v1beta1 +apiVersion: source.toolkit.fluxcd.io/v1beta2 kind: Bucket metadata: name: flux-system diff --git a/cmd/flux/testdata/export/receiver.yaml b/cmd/flux/testdata/export/receiver.yaml index e47add3d..2f221390 100644 --- a/cmd/flux/testdata/export/receiver.yaml +++ b/cmd/flux/testdata/export/receiver.yaml @@ -1,5 +1,5 @@ --- -apiVersion: notification.toolkit.fluxcd.io/v1beta2 +apiVersion: notification.toolkit.fluxcd.io/v1 kind: Receiver metadata: name: flux-system @@ -8,6 +8,7 @@ spec: events: - ping - push + interval: 10m0s resources: - kind: GitRepository name: flux-system diff --git a/cmd/flux/testdata/trace/deployment.yaml b/cmd/flux/testdata/trace/deployment.yaml index 32194506..55964a58 100644 --- a/cmd/flux/testdata/trace/deployment.yaml +++ b/cmd/flux/testdata/trace/deployment.yaml @@ -137,7 +137,7 @@ status: status: "True" type: Ready --- -apiVersion: source.toolkit.fluxcd.io/v1beta1 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: labels: @@ -146,7 +146,6 @@ metadata: name: flux-system namespace: {{ .fluxns }} spec: - gitImplementation: go-git ref: branch: main secretRef: diff --git a/cmd/flux/testdata/trace/helmrelease-oci.yaml b/cmd/flux/testdata/trace/helmrelease-oci.yaml index b6591960..da9d1d47 100644 --- a/cmd/flux/testdata/trace/helmrelease-oci.yaml +++ b/cmd/flux/testdata/trace/helmrelease-oci.yaml @@ -38,7 +38,7 @@ status: lastAttemptedRevision: 6.3.5 lastAttemptedValuesChecksum: c31db75d05b7515eba2eef47bd71038c74b2e531 --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: infrastructure diff --git a/cmd/flux/testdata/trace/helmrelease.yaml b/cmd/flux/testdata/trace/helmrelease.yaml index 8a48b9a5..9c626f4a 100644 --- a/cmd/flux/testdata/trace/helmrelease.yaml +++ b/cmd/flux/testdata/trace/helmrelease.yaml @@ -38,7 +38,7 @@ status: lastAttemptedRevision: 6.3.5 lastAttemptedValuesChecksum: c31db75d05b7515eba2eef47bd71038c74b2e531 --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta1 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: infrastructure @@ -60,7 +60,7 @@ status: type: Ready lastAppliedRevision: main@sha1:696f056df216eea4f9401adbee0ff744d4df390f --- -apiVersion: source.toolkit.fluxcd.io/v1beta1 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: labels: @@ -69,7 +69,6 @@ metadata: name: flux-system namespace: {{ .fluxns }} spec: - gitImplementation: go-git ref: branch: main secretRef: diff --git a/cmd/flux/testdata/tree/kustomizations.yaml b/cmd/flux/testdata/tree/kustomizations.yaml index 3c471b20..98a619e9 100644 --- a/cmd/flux/testdata/tree/kustomizations.yaml +++ b/cmd/flux/testdata/tree/kustomizations.yaml @@ -4,7 +4,7 @@ kind: Namespace metadata: name: {{ .fluxns }} --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: flux-system @@ -40,7 +40,7 @@ status: - id: {{ .fluxns }}_flux-system_source.toolkit.fluxcd.io_GitRepository v: v1beta1 --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: infrastructure @@ -66,7 +66,7 @@ status: - id: cert-manager_cert-manager_source.toolkit.fluxcd.io_HelmRepository v: v1beta1 --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: empty diff --git a/cmd/flux/trace.go b/cmd/flux/trace.go index 1a9e0acd..8a5dd02b 100644 --- a/cmd/flux/trace.go +++ b/cmd/flux/trace.go @@ -35,10 +35,11 @@ import ( "github.com/fluxcd/flux2/internal/utils" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" fluxmeta "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/oci" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) var traceCmd = &cobra.Command{ @@ -221,7 +222,7 @@ func traceKustomization(ctx context.Context, kubeClient client.Client, ksName ty ksReady := meta.FindStatusCondition(ks.Status.Conditions, fluxmeta.ReadyCondition) var gitRepository *sourcev1.GitRepository - var ociRepository *sourcev1.OCIRepository + var ociRepository *sourcev1b2.OCIRepository var ksRepositoryReady *metav1.Condition switch ks.Spec.SourceRef.Kind { case sourcev1.GitRepositoryKind: @@ -238,8 +239,8 @@ func traceKustomization(ctx context.Context, kubeClient client.Client, ksName ty return "", fmt.Errorf("failed to find GitRepository: %w", err) } ksRepositoryReady = meta.FindStatusCondition(gitRepository.Status.Conditions, fluxmeta.ReadyCondition) - case sourcev1.OCIRepositoryKind: - ociRepository = &sourcev1.OCIRepository{} + case sourcev1b2.OCIRepositoryKind: + ociRepository = &sourcev1b2.OCIRepository{} sourceNamespace := ks.Namespace if ks.Spec.SourceRef.Namespace != "" { sourceNamespace = ks.Spec.SourceRef.Namespace @@ -346,7 +347,7 @@ Status: Unknown Kustomization *kustomizev1.Kustomization KustomizationReady *metav1.Condition GitRepository *sourcev1.GitRepository - OCIRepository *sourcev1.OCIRepository + OCIRepository *sourcev1b2.OCIRepository RepositoryReady *metav1.Condition Annotations map[string]string }{ @@ -386,10 +387,10 @@ func traceHelm(ctx context.Context, kubeClient client.Client, hrName types.Names } hrReady := meta.FindStatusCondition(hr.Status.Conditions, fluxmeta.ReadyCondition) - var hrChart *sourcev1.HelmChart + var hrChart *sourcev1b2.HelmChart var hrChartReady *metav1.Condition if chart := hr.Status.HelmChart; chart != "" { - hrChart = &sourcev1.HelmChart{} + hrChart = &sourcev1b2.HelmChart{} err = kubeClient.Get(ctx, utils.ParseNamespacedName(chart), hrChart) if err != nil { return "", fmt.Errorf("failed to find HelmChart: %w", err) @@ -415,10 +416,10 @@ func traceHelm(ctx context.Context, kubeClient client.Client, hrName types.Names hrGitRepositoryReady = meta.FindStatusCondition(hrGitRepository.Status.Conditions, fluxmeta.ReadyCondition) } - var hrHelmRepository *sourcev1.HelmRepository + var hrHelmRepository *sourcev1b2.HelmRepository var hrHelmRepositoryReady *metav1.Condition - if hr.Spec.Chart.Spec.SourceRef.Kind == sourcev1.HelmRepositoryKind { - hrHelmRepository = &sourcev1.HelmRepository{} + if hr.Spec.Chart.Spec.SourceRef.Kind == sourcev1b2.HelmRepositoryKind { + hrHelmRepository = &sourcev1b2.HelmRepository{} sourceNamespace := hr.Namespace if hr.Spec.Chart.Spec.SourceRef.Namespace != "" { sourceNamespace = hr.Spec.Chart.Spec.SourceRef.Namespace @@ -520,11 +521,11 @@ Status: Unknown ObjectNamespace string HelmRelease *helmv2.HelmRelease HelmReleaseReady *metav1.Condition - HelmChart *sourcev1.HelmChart + HelmChart *sourcev1b2.HelmChart HelmChartReady *metav1.Condition GitRepository *sourcev1.GitRepository GitRepositoryReady *metav1.Condition - HelmRepository *sourcev1.HelmRepository + HelmRepository *sourcev1b2.HelmRepository HelmRepositoryReady *metav1.Condition }{ ObjectName: obj.GetKind() + "/" + obj.GetName(), diff --git a/cmd/flux/tree_kustomization.go b/cmd/flux/tree_kustomization.go index 3d9bc370..7fcae1c4 100644 --- a/cmd/flux/tree_kustomization.go +++ b/cmd/flux/tree_kustomization.go @@ -36,7 +36,7 @@ import ( "sigs.k8s.io/yaml" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" "github.com/fluxcd/pkg/ssa" "github.com/fluxcd/flux2/internal/tree" diff --git a/go.mod b/go.mod index fb0a6866..a2783499 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/fluxcd/pkg/apis/meta v1.0.0 github.com/fluxcd/pkg/git v0.11.0 github.com/fluxcd/pkg/git/gogit v0.8.1 - github.com/fluxcd/pkg/kustomize v0.13.2 + github.com/fluxcd/pkg/kustomize v0.14.0 github.com/fluxcd/pkg/oci v0.21.1 github.com/fluxcd/pkg/runtime v0.31.0 github.com/fluxcd/pkg/sourceignore v0.3.2 diff --git a/go.sum b/go.sum index c1d1f6f2..dca062b6 100644 --- a/go.sum +++ b/go.sum @@ -222,8 +222,8 @@ github.com/fluxcd/pkg/git v0.11.0/go.mod h1:VHRVlrZMHNoWBlaSAWxlGH6Vwlb9VRazUhPU github.com/fluxcd/pkg/git/gogit v0.8.1 h1:Q3EV2WBX6HiXSmsHyrwFzwl82gO4ZtFwb675iQPWwVc= github.com/fluxcd/pkg/git/gogit v0.8.1/go.mod h1:5M27gCl0gyo6l+ht9HwZSzimPY3LahKVIJ7/1vCCctg= github.com/fluxcd/pkg/gittestserver v0.8.1 h1:FMqnZBuS/11+9NhtLv9UAg+wm/v0Nf+hHeUOi2wJR3Q= -github.com/fluxcd/pkg/kustomize v0.13.2 h1:isA9yi+m7sSIxdTrFR1U7+LyS2BraG07ZkKLHw3bnGo= -github.com/fluxcd/pkg/kustomize v0.13.2/go.mod h1:1H9qednPxL/JvZE5at/f6wVHTH4WmxJYqfgVOZJ3uAk= +github.com/fluxcd/pkg/kustomize v0.14.0 h1:XsvGTRsTMlW5u3+ciNChzp3c755SXG5PiCozjyLQYX0= +github.com/fluxcd/pkg/kustomize v0.14.0/go.mod h1:1PmtFOgx3Rn7uoB5C1NVbb0DxXPdY3v0lBX3L9ozCZw= github.com/fluxcd/pkg/oci v0.21.1 h1:9kn19wkabE2xB77NRlOtMJlSYhZmUjdloZCzlHdAS6s= github.com/fluxcd/pkg/oci v0.21.1/go.mod h1:9E2DBlQII7YmeWt2ieTh38wwkiBqx3yg5NEJ51uefaA= github.com/fluxcd/pkg/runtime v0.31.0 h1:addyXaANHl/A68bEjCbiR4HzcFKgfXv1eaG7B7ZHxOo= diff --git a/internal/build/build.go b/internal/build/build.go index 04befbc0..0c6baf77 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -40,7 +40,7 @@ import ( "sigs.k8s.io/kustomize/api/resource" "sigs.k8s.io/kustomize/kyaml/yaml" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" "github.com/fluxcd/pkg/kustomize" runclient "github.com/fluxcd/pkg/runtime/client" "sigs.k8s.io/kustomize/kyaml/filesys" diff --git a/internal/build/diff.go b/internal/build/diff.go index 4acd98a9..d81e22b6 100644 --- a/internal/build/diff.go +++ b/internal/build/diff.go @@ -42,7 +42,7 @@ import ( "github.com/fluxcd/pkg/ssa" "github.com/fluxcd/flux2/pkg/printers" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" ) func (b *Builder) Manager() (*ssa.ResourceManager, error) { diff --git a/internal/build/testdata/local-kustomization/different-name.yaml b/internal/build/testdata/local-kustomization/different-name.yaml index d2c675e8..03ea661f 100644 --- a/internal/build/testdata/local-kustomization/different-name.yaml +++ b/internal/build/testdata/local-kustomization/different-name.yaml @@ -1,4 +1,4 @@ -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: infra diff --git a/internal/build/testdata/local-kustomization/multi-doc-valid.yaml b/internal/build/testdata/local-kustomization/multi-doc-valid.yaml index d5928463..0fb89db9 100644 --- a/internal/build/testdata/local-kustomization/multi-doc-valid.yaml +++ b/internal/build/testdata/local-kustomization/multi-doc-valid.yaml @@ -1,5 +1,5 @@ --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: infra-namespace @@ -11,7 +11,7 @@ spec: prune: true --- --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: GitRepository metadata: name: podinfo @@ -22,11 +22,11 @@ spec: branch: master url: https://github.com/stefanprodan/podinfo --- -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: podinfo namespace: flux-system spec: path: "./clusters/test-build" ---- \ No newline at end of file +--- diff --git a/internal/build/testdata/local-kustomization/no-ns.yaml b/internal/build/testdata/local-kustomization/no-ns.yaml index d7292d24..0253fdd6 100644 --- a/internal/build/testdata/local-kustomization/no-ns.yaml +++ b/internal/build/testdata/local-kustomization/no-ns.yaml @@ -1,4 +1,4 @@ -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: podinfo diff --git a/internal/build/testdata/local-kustomization/valid.yaml b/internal/build/testdata/local-kustomization/valid.yaml index 41adab26..48cddf4d 100644 --- a/internal/build/testdata/local-kustomization/valid.yaml +++ b/internal/build/testdata/local-kustomization/valid.yaml @@ -1,4 +1,4 @@ -apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 +apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: name: podinfo diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 8b876bdf..8f25730c 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -44,12 +44,14 @@ import ( helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" imageautov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" imagereflectv1 "github.com/fluxcd/image-reflector-controller/api/v1beta2" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" + notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2" "github.com/fluxcd/pkg/apis/meta" runclient "github.com/fluxcd/pkg/runtime/client" "github.com/fluxcd/pkg/version" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/pkg/manifestgen/install" ) @@ -126,10 +128,12 @@ func NewScheme() *apiruntime.Scheme { _ = rbacv1.AddToScheme(scheme) _ = appsv1.AddToScheme(scheme) _ = networkingv1.AddToScheme(scheme) + _ = sourcev1b2.AddToScheme(scheme) _ = sourcev1.AddToScheme(scheme) _ = kustomizev1.AddToScheme(scheme) _ = helmv2.AddToScheme(scheme) _ = notificationv1.AddToScheme(scheme) + _ = notificationv1b2.AddToScheme(scheme) _ = imagereflectv1.AddToScheme(scheme) _ = imageautov1.AddToScheme(scheme) return scheme diff --git a/pkg/bootstrap/bootstrap.go b/pkg/bootstrap/bootstrap.go index e1224d36..ae6a792c 100644 --- a/pkg/bootstrap/bootstrap.go +++ b/pkg/bootstrap/bootstrap.go @@ -30,7 +30,7 @@ import ( "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" "github.com/fluxcd/pkg/apis/meta" sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" diff --git a/pkg/bootstrap/bootstrap_plain_git.go b/pkg/bootstrap/bootstrap_plain_git.go index 17ec48ec..7239ac3e 100644 --- a/pkg/bootstrap/bootstrap_plain_git.go +++ b/pkg/bootstrap/bootstrap_plain_git.go @@ -36,7 +36,7 @@ import ( "sigs.k8s.io/kustomize/api/konfig" "sigs.k8s.io/yaml" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" "github.com/fluxcd/pkg/kustomize/filesys" runclient "github.com/fluxcd/pkg/runtime/client" diff --git a/pkg/manifestgen/sync/sync.go b/pkg/manifestgen/sync/sync.go index 6b7953fc..b24e6085 100644 --- a/pkg/manifestgen/sync/sync.go +++ b/pkg/manifestgen/sync/sync.go @@ -26,9 +26,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" "github.com/fluxcd/flux2/pkg/manifestgen" ) diff --git a/pkg/manifestgen/sync/sync_test.go b/pkg/manifestgen/sync/sync_test.go index 2c22d407..1ac3b133 100644 --- a/pkg/manifestgen/sync/sync_test.go +++ b/pkg/manifestgen/sync/sync_test.go @@ -24,8 +24,8 @@ import ( "strings" "testing" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) func TestGenerate(t *testing.T) { diff --git a/pkg/uninstall/uninstall.go b/pkg/uninstall/uninstall.go index ce32328b..497e1a72 100644 --- a/pkg/uninstall/uninstall.go +++ b/pkg/uninstall/uninstall.go @@ -33,9 +33,11 @@ import ( helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1" imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - notificationv1 "github.com/fluxcd/notification-controller/api/v1beta2" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + notificationv1 "github.com/fluxcd/notification-controller/api/v1" + notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) // Components removes all Kubernetes components that are part of Flux excluding the CRDs and namespace. @@ -144,7 +146,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client } } { - var list sourcev1.OCIRepositoryList + var list sourcev1b2.OCIRepositoryList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { for _, r := range list.Items { r.Finalizers = []string{} @@ -158,7 +160,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client } } { - var list sourcev1.HelmRepositoryList + var list sourcev1b2.HelmRepositoryList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { for _, r := range list.Items { r.Finalizers = []string{} @@ -172,7 +174,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client } } { - var list sourcev1.HelmChartList + var list sourcev1b2.HelmChartList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { for _, r := range list.Items { r.Finalizers = []string{} @@ -186,7 +188,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client } } { - var list sourcev1.BucketList + var list sourcev1b2.BucketList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { for _, r := range list.Items { r.Finalizers = []string{} @@ -228,7 +230,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client } } { - var list notificationv1.AlertList + var list notificationv1b2.AlertList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { for _, r := range list.Items { r.Finalizers = []string{} @@ -242,7 +244,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client } } { - var list notificationv1.ProviderList + var list notificationv1b2.ProviderList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { for _, r := range list.Items { r.Finalizers = []string{} diff --git a/tests/azure/azure_test.go b/tests/azure/azure_test.go index 5a20e94a..781ef77d 100644 --- a/tests/azure/azure_test.go +++ b/tests/azure/azure_test.go @@ -51,8 +51,9 @@ import ( "github.com/fluxcd/go-git/v5/plumbing" automationv1beta1 "github.com/fluxcd/image-automation-controller/api/v1beta1" reflectorv1beta2 "github.com/fluxcd/image-reflector-controller/api/v1beta2" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - notiv1beta1 "github.com/fluxcd/notification-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + notiv1 "github.com/fluxcd/notification-controller/api/v1" + notiv1beta2 "github.com/fluxcd/notification-controller/api/v1beta2" eventv1 "github.com/fluxcd/pkg/apis/event/v1beta1" "github.com/fluxcd/pkg/apis/meta" sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" @@ -678,14 +679,14 @@ func TestAzureDevOpsCommitStatus(t *testing.T) { } return nil }) - provider := notiv1beta1.Provider{ + provider := notiv1beta2.Provider{ ObjectMeta: metav1.ObjectMeta{ Name: "azuredevops", Namespace: name, }, } _, err = controllerutil.CreateOrUpdate(ctx, cfg.kubeClient, &provider, func() error { - provider.Spec = notiv1beta1.ProviderSpec{ + provider.Spec = notiv1beta2.ProviderSpec{ Type: "azuredevops", Address: repoUrl, SecretRef: &meta.LocalObjectReference{ @@ -695,18 +696,18 @@ func TestAzureDevOpsCommitStatus(t *testing.T) { return nil }) require.NoError(t, err) - alert := notiv1beta1.Alert{ + alert := notiv1beta2.Alert{ ObjectMeta: metav1.ObjectMeta{ Name: "azuredevops", Namespace: name, }, } _, err = controllerutil.CreateOrUpdate(ctx, cfg.kubeClient, &alert, func() error { - alert.Spec = notiv1beta1.AlertSpec{ + alert.Spec = notiv1beta2.AlertSpec{ ProviderRef: meta.LocalObjectReference{ Name: provider.Name, }, - EventSources: []notiv1beta1.CrossNamespaceObjectReference{ + EventSources: []notiv1.CrossNamespaceObjectReference{ { Kind: "Kustomization", Name: name, @@ -806,14 +807,14 @@ func TestEventHubNotification(t *testing.T) { } return nil }) - provider := notiv1beta1.Provider{ + provider := notiv1beta2.Provider{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: name, }, } _, err = controllerutil.CreateOrUpdate(ctx, cfg.kubeClient, &provider, func() error { - provider.Spec = notiv1beta1.ProviderSpec{ + provider.Spec = notiv1beta2.ProviderSpec{ Type: "azureeventhub", Address: repoUrl, SecretRef: &meta.LocalObjectReference{ @@ -823,18 +824,18 @@ func TestEventHubNotification(t *testing.T) { return nil }) require.NoError(t, err) - alert := notiv1beta1.Alert{ + alert := notiv1beta2.Alert{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: name, }, } _, err = controllerutil.CreateOrUpdate(ctx, cfg.kubeClient, &alert, func() error { - alert.Spec = notiv1beta1.AlertSpec{ + alert.Spec = notiv1beta2.AlertSpec{ ProviderRef: meta.LocalObjectReference{ Name: provider.Name, }, - EventSources: []notiv1beta1.CrossNamespaceObjectReference{ + EventSources: []notiv1.CrossNamespaceObjectReference{ { Kind: "Kustomization", Name: name, diff --git a/tests/azure/go.mod b/tests/azure/go.mod index 719c0ebe..841711bb 100644 --- a/tests/azure/go.mod +++ b/tests/azure/go.mod @@ -8,23 +8,23 @@ require ( github.com/fluxcd/helm-controller/api v0.31.2 github.com/fluxcd/image-automation-controller/api v0.31.0 github.com/fluxcd/image-reflector-controller/api v0.26.1 - github.com/fluxcd/kustomize-controller/api v0.35.1 - github.com/fluxcd/notification-controller/api v0.33.0 + github.com/fluxcd/kustomize-controller/api v1.0.0-rc.1 + github.com/fluxcd/notification-controller/api v1.0.0-rc.1 github.com/fluxcd/pkg/apis/event v0.4.1 - github.com/fluxcd/pkg/apis/meta v0.19.1 + github.com/fluxcd/pkg/apis/meta v1.0.0 github.com/fluxcd/pkg/git v0.11.0 github.com/fluxcd/pkg/git/gogit v0.8.1 - github.com/fluxcd/source-controller/api v0.36.1 + github.com/fluxcd/source-controller/api v1.0.0-rc.1 github.com/hashicorp/hc-install v0.5.0 github.com/hashicorp/terraform-exec v0.18.1 github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5 github.com/stretchr/testify v1.8.2 github.com/whilp/git-urls v1.0.0 go.uber.org/multierr v1.10.0 - k8s.io/api v0.26.2 - k8s.io/apimachinery v0.26.2 - k8s.io/client-go v0.26.2 - sigs.k8s.io/controller-runtime v0.14.5 + k8s.io/api v0.26.3 + k8s.io/apimachinery v0.26.3 + k8s.io/client-go v0.26.3 + sigs.k8s.io/controller-runtime v0.14.6 ) // Fix CVE-2022-28948 @@ -55,7 +55,7 @@ require ( github.com/emirpasic/gods v1.18.1 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/fluxcd/pkg/apis/acl v0.1.0 // indirect - github.com/fluxcd/pkg/apis/kustomize v0.8.1 // indirect + github.com/fluxcd/pkg/apis/kustomize v1.0.0 // indirect github.com/fluxcd/pkg/ssh v0.7.3 // indirect github.com/fluxcd/pkg/version v0.2.1 // indirect github.com/go-git/gcfg v1.5.0 // indirect @@ -110,7 +110,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.26.2 // indirect + k8s.io/apiextensions-apiserver v0.26.3 // indirect k8s.io/klog/v2 v2.80.1 // indirect k8s.io/kube-openapi v0.0.0-20221110221610-a28e98eb7c70 // indirect k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect diff --git a/tests/azure/go.sum b/tests/azure/go.sum index 8c37b628..2c2308d3 100644 --- a/tests/azure/go.sum +++ b/tests/azure/go.sum @@ -142,18 +142,18 @@ github.com/fluxcd/image-automation-controller/api v0.31.0 h1:xA2MXbVpXWAFBCmlaOq github.com/fluxcd/image-automation-controller/api v0.31.0/go.mod h1:kNQ/g5TK0Epwguma2+Y1binRMRZ1d6E2VmZLg2iGkqw= github.com/fluxcd/image-reflector-controller/api v0.26.1 h1:AKfqabDlcouGilX0y+/Wa1R9qwMb6ZlTHD1ELEkK9tw= github.com/fluxcd/image-reflector-controller/api v0.26.1/go.mod h1:xZILku1/O6higkHTW/D3dvte4Ld7kRuZH9r+Rm4p1B0= -github.com/fluxcd/kustomize-controller/api v0.35.1 h1:l7AndDJXVLZcCHmEIRXU9ksWInlP6SjFtHQH1SC7++c= -github.com/fluxcd/kustomize-controller/api v0.35.1/go.mod h1:hrxVOUss0om4mg+ykMYtH4CgLuM2RReSPf0hG9e0b18= -github.com/fluxcd/notification-controller/api v0.33.0 h1:iVnIGDfkpVuzcILSGwi//Q3devCg7E7G4lfDx8vuvsA= -github.com/fluxcd/notification-controller/api v0.33.0/go.mod h1:0IyWy0J6+z1TbijVQjFx1gWQDOzXaRfzV2NClfjHZPk= +github.com/fluxcd/kustomize-controller/api v1.0.0-rc.1 h1:HnPpGw9RhVyE4LsvOOMUcCo4jA+gSfnkM2Xe/vjlpHg= +github.com/fluxcd/kustomize-controller/api v1.0.0-rc.1/go.mod h1:ql/HdV+pGzqnHaU5oNyvYR7lHPWc/me3HUPd4g7A9BI= +github.com/fluxcd/notification-controller/api v1.0.0-rc.1 h1:L6xM9Nvm2icc7SqcUSXYiIY8bTiV73kss5KleaUewts= +github.com/fluxcd/notification-controller/api v1.0.0-rc.1/go.mod h1:bfZCGyWq1SPmZSQSCuHRum5Z1olidWp8UbZkO5kcato= github.com/fluxcd/pkg/apis/acl v0.1.0 h1:EoAl377hDQYL3WqanWCdifauXqXbMyFuK82NnX6pH4Q= github.com/fluxcd/pkg/apis/acl v0.1.0/go.mod h1:zfEZzz169Oap034EsDhmCAGgnWlcWmIObZjYMusoXS8= github.com/fluxcd/pkg/apis/event v0.4.1 h1:63wP8NM/uA4680F4Ft8q8/0rJivX90i7FmMkRvUI8Is= github.com/fluxcd/pkg/apis/event v0.4.1/go.mod h1:LHT1ZsbMrcHwCHQCaFtQviQBZwhMOAbTUPK6+KgBkFo= -github.com/fluxcd/pkg/apis/kustomize v0.8.1 h1:uRH9xVDJfSBGIiL6PIhkguHvf2Nme6uTWX+RX1iZznc= -github.com/fluxcd/pkg/apis/kustomize v0.8.1/go.mod h1:TBem+2mHp6Ib7XD1fmzDkoUnBzx07wSzIYo6BVx3XAc= -github.com/fluxcd/pkg/apis/meta v0.19.1 h1:fCI5CnTXpAqr67UlaI9q0H+OztMKB5kDTr6xV6vlAo0= -github.com/fluxcd/pkg/apis/meta v0.19.1/go.mod h1:ZPPMYrPnWwPQYNEGM/Uc0N4SurUPS3xNI3IIpCQEfuM= +github.com/fluxcd/pkg/apis/kustomize v1.0.0 h1:5T2b/mRZiGWtP7fvSU8gZOApIc06H6SdLX3MlsE6LRo= +github.com/fluxcd/pkg/apis/kustomize v1.0.0/go.mod h1:XaDYlKxrf9D2zZWcZ0BnSIqGtcm8mdNtJGzZWYjCnQo= +github.com/fluxcd/pkg/apis/meta v1.0.0 h1:i9IGHd/VNEZELX7mepkiYFbJxs2J5znaB4cN9z2nPm8= +github.com/fluxcd/pkg/apis/meta v1.0.0/go.mod h1:04ZdpZYm1x+aL93K4daNHW1UX6E8K7Gyf5za9OhrE+U= github.com/fluxcd/pkg/git v0.11.0 h1:GvB+3QOB8xbF5WNjVrkskseOnsZBuqSOzW3VxfsHuX4= github.com/fluxcd/pkg/git v0.11.0/go.mod h1:VHRVlrZMHNoWBlaSAWxlGH6Vwlb9VRazUhPUykviHwY= github.com/fluxcd/pkg/git/gogit v0.8.1 h1:Q3EV2WBX6HiXSmsHyrwFzwl82gO4ZtFwb675iQPWwVc= @@ -163,8 +163,8 @@ github.com/fluxcd/pkg/ssh v0.7.3 h1:Dhs+nXdp806lBriUJtPyRi0SVIVWbJafJGD/qQ71GiY= github.com/fluxcd/pkg/ssh v0.7.3/go.mod h1:/z5ZNgQz+h9s/2nNFKAcZDHtZRMA1nj5YcriGDUOoLY= github.com/fluxcd/pkg/version v0.2.1 h1:RRH7+6qiWHdTvRNwpoBmilnubJ2C4FZYGgy5wTDVKVc= github.com/fluxcd/pkg/version v0.2.1/go.mod h1:UmUYHDz4BxHQMesMUx3gYVrT2Wf66H49JpTg/PW+/OY= -github.com/fluxcd/source-controller/api v0.36.1 h1:/ul69kJNEwrFG1Cwk2P/GwgraIxOETCL+tP+zMtxTu8= -github.com/fluxcd/source-controller/api v0.36.1/go.mod h1:GktZmd5Dfxo84vPFBdLDl0bBtiJRODfd47uugK0romU= +github.com/fluxcd/source-controller/api v1.0.0-rc.1 h1:MZaP5utClMG95Aw/AVu1l05WEfmpEw/RIlCLnkCQl14= +github.com/fluxcd/source-controller/api v1.0.0-rc.1/go.mod h1:CvGNdS8g/MqwpERUK6aJp4lndsrm+JBzGpoyyZ4u0c8= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -778,14 +778,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.26.2 h1:dM3cinp3PGB6asOySalOZxEG4CZ0IAdJsrYZXE/ovGQ= -k8s.io/api v0.26.2/go.mod h1:1kjMQsFE+QHPfskEcVNgL3+Hp88B80uj0QtSOlj8itU= -k8s.io/apiextensions-apiserver v0.26.2 h1:/yTG2B9jGY2Q70iGskMf41qTLhL9XeNN2KhI0uDgwko= -k8s.io/apiextensions-apiserver v0.26.2/go.mod h1:Y7UPgch8nph8mGCuVk0SK83LnS8Esf3n6fUBgew8SH8= -k8s.io/apimachinery v0.26.2 h1:da1u3D5wfR5u2RpLhE/ZtZS2P7QvDgLZTi9wrNZl/tQ= -k8s.io/apimachinery v0.26.2/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= -k8s.io/client-go v0.26.2 h1:s1WkVujHX3kTp4Zn4yGNFK+dlDXy1bAAkIl+cFAiuYI= -k8s.io/client-go v0.26.2/go.mod h1:u5EjOuSyBa09yqqyY7m3abZeovO/7D/WehVVlZ2qcqU= +k8s.io/api v0.26.3 h1:emf74GIQMTik01Aum9dPP0gAypL8JTLl/lHa4V9RFSU= +k8s.io/api v0.26.3/go.mod h1:PXsqwPMXBSBcL1lJ9CYDKy7kIReUydukS5JiRlxC3qE= +k8s.io/apiextensions-apiserver v0.26.3 h1:5PGMm3oEzdB1W/FTMgGIDmm100vn7IaUP5er36dB+YE= +k8s.io/apiextensions-apiserver v0.26.3/go.mod h1:jdA5MdjNWGP+njw1EKMZc64xAT5fIhN6VJrElV3sfpQ= +k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k= +k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= +k8s.io/client-go v0.26.3 h1:k1UY+KXfkxV2ScEL3gilKcF7761xkYsSD6BC9szIu8s= +k8s.io/client-go v0.26.3/go.mod h1:ZPNu9lm8/dbRIPAgteN30RSXea6vrCpFvq+MateTUuQ= k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20221110221610-a28e98eb7c70 h1:zfqQc1V6/ZgGpvrOVvr62OjiqQX4lZjfznK34NQwkqw= @@ -795,8 +795,8 @@ k8s.io/utils v0.0.0-20221128185143-99ec85e7a448/go.mod h1:OLgZIPagt7ERELqWJFomSt rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/controller-runtime v0.14.5 h1:6xaWFqzT5KuAQ9ufgUaj1G/+C4Y1GRkhrxl+BJ9i+5s= -sigs.k8s.io/controller-runtime v0.14.5/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= +sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA= +sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= diff --git a/tests/azure/util_test.go b/tests/azure/util_test.go index f2e8cc31..3ad9a9b7 100644 --- a/tests/azure/util_test.go +++ b/tests/azure/util_test.go @@ -43,14 +43,15 @@ import ( helmv2beta1 "github.com/fluxcd/helm-controller/api/v2beta1" automationv1beta1 "github.com/fluxcd/image-automation-controller/api/v1beta1" reflectorv1beta2 "github.com/fluxcd/image-reflector-controller/api/v1beta2" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - notiv1beta1 "github.com/fluxcd/notification-controller/api/v1beta2" + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" + notiv1 "github.com/fluxcd/notification-controller/api/v1" + notiv1beta2 "github.com/fluxcd/notification-controller/api/v1beta2" "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/git" "github.com/fluxcd/pkg/git/gogit" "github.com/fluxcd/pkg/git/repository" - - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) const defaultBranch = "main" @@ -71,6 +72,10 @@ func getKubernetesCredentials(kubeconfig, aksHost, aksCert, aksKey, aksCa string CAData: []byte(aksCa), }, } + err = sourcev1b2.AddToScheme(scheme.Scheme) + if err != nil { + return "", nil, err + } err = sourcev1.AddToScheme(scheme.Scheme) if err != nil { return "", nil, err @@ -91,7 +96,11 @@ func getKubernetesCredentials(kubeconfig, aksHost, aksCert, aksKey, aksCa string if err != nil { return "", nil, err } - err = notiv1beta1.AddToScheme(scheme.Scheme) + err = notiv1beta2.AddToScheme(scheme.Scheme) + if err != nil { + return "", nil, err + } + err = notiv1.AddToScheme(scheme.Scheme) if err != nil { return "", nil, err } @@ -251,7 +260,6 @@ func setupNamespace(ctx context.Context, kubeClient client.Client, repoUrl, pass Interval: metav1.Duration{ Duration: 1 * time.Minute, }, - GitImplementation: sourcev1.LibGit2Implementation, Reference: &sourcev1.GitRepositoryRef{ Branch: name, },