diff --git a/cmd/flux/create_image_update.go b/cmd/flux/create_image_update.go index a67f6bc3..7bf6a28d 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/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var createImageUpdateCmd = &cobra.Command{ diff --git a/cmd/flux/create_source_bucket.go b/cmd/flux/create_source_bucket.go index 31279799..89616451 100644 --- a/cmd/flux/create_source_bucket.go +++ b/cmd/flux/create_source_bucket.go @@ -30,7 +30,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/internal/flags" "github.com/fluxcd/flux2/internal/utils" diff --git a/cmd/flux/create_source_git.go b/cmd/flux/create_source_git.go index b8e4d6ae..7e730fe2 100644 --- a/cmd/flux/create_source_git.go +++ b/cmd/flux/create_source_git.go @@ -24,7 +24,7 @@ import ( "os" "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/manifoldco/promptui" "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" diff --git a/cmd/flux/create_source_git_test.go b/cmd/flux/create_source_git_test.go index 73c1724a..b6b9961f 100644 --- a/cmd/flux/create_source_git_test.go +++ b/cmd/flux/create_source_git_test.go @@ -21,15 +21,17 @@ package main import ( "context" + "testing" + "time" + "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + 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" - "testing" - "time" ) var pollInterval = 50 * time.Millisecond @@ -103,7 +105,13 @@ func TestCreateSourceGit(t *testing.T) { command, assertGoldenFile("testdata/create_source_git/success.golden"), func(repo *sourcev1.GitRepository) { - meta.SetResourceCondition(repo, meta.ReadyCondition, metav1.ConditionTrue, sourcev1.GitOperationSucceedReason, "succeeded message") + newCondition := metav1.Condition{ + Type: meta.ReadyCondition, + Status: metav1.ConditionTrue, + Reason: sourcev1.GitOperationSucceedReason, + Message: "succeeded message", + } + apimeta.SetStatusCondition(&repo.Status.Conditions, newCondition) repo.Status.Artifact = &sourcev1.Artifact{ Path: "some-path", Revision: "v1", @@ -114,7 +122,13 @@ func TestCreateSourceGit(t *testing.T) { command, assertError("failed message"), func(repo *sourcev1.GitRepository) { - meta.SetResourceCondition(repo, meta.ReadyCondition, metav1.ConditionFalse, sourcev1.URLInvalidReason, "failed message") + newCondition := metav1.Condition{ + Type: meta.ReadyCondition, + Status: metav1.ConditionFalse, + Reason: sourcev1.URLInvalidReason, + Message: "failed message", + } + apimeta.SetStatusCondition(&repo.Status.Conditions, newCondition) }, }, { "NoArtifact", @@ -122,7 +136,13 @@ func TestCreateSourceGit(t *testing.T) { assertError("GitRepository source reconciliation completed but no artifact was found"), func(repo *sourcev1.GitRepository) { // Updated with no artifact - meta.SetResourceCondition(repo, meta.ReadyCondition, metav1.ConditionTrue, sourcev1.GitOperationSucceedReason, "succeeded message") + newCondition := metav1.Condition{ + Type: meta.ReadyCondition, + Status: metav1.ConditionTrue, + Reason: sourcev1.GitOperationSucceedReason, + Message: "succeeded message", + } + apimeta.SetStatusCondition(&repo.Status.Conditions, newCondition) }, }, } diff --git a/cmd/flux/create_source_helm.go b/cmd/flux/create_source_helm.go index 2d3f2513..f20b4658 100644 --- a/cmd/flux/create_source_helm.go +++ b/cmd/flux/create_source_helm.go @@ -33,7 +33,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/yaml" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/internal/utils" "github.com/fluxcd/flux2/pkg/manifestgen/sourcesecret" diff --git a/cmd/flux/delete_source_bucket.go b/cmd/flux/delete_source_bucket.go index 56d9bdf8..a032dfcc 100644 --- a/cmd/flux/delete_source_bucket.go +++ b/cmd/flux/delete_source_bucket.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var deleteSourceBucketCmd = &cobra.Command{ diff --git a/cmd/flux/delete_source_git.go b/cmd/flux/delete_source_git.go index 5c521a5b..c43398d5 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/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var deleteSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/delete_source_helm.go b/cmd/flux/delete_source_helm.go index 87b708ad..a5956d87 100644 --- a/cmd/flux/delete_source_helm.go +++ b/cmd/flux/delete_source_helm.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var deleteSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/export_source_bucket.go b/cmd/flux/export_source_bucket.go index 33e36ebd..93d1d87d 100644 --- a/cmd/flux/export_source_bucket.go +++ b/cmd/flux/export_source_bucket.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/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var exportSourceBucketCmd = &cobra.Command{ diff --git a/cmd/flux/export_source_git.go b/cmd/flux/export_source_git.go index c93e0fd1..f1af1659 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/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var exportSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/export_source_helm.go b/cmd/flux/export_source_helm.go index d2215335..f5f7ef8c 100644 --- a/cmd/flux/export_source_helm.go +++ b/cmd/flux/export_source_helm.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/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var exportSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/get_source_all.go b/cmd/flux/get_source_all.go index 08c12de1..b9b62555 100644 --- a/cmd/flux/get_source_all.go +++ b/cmd/flux/get_source_all.go @@ -21,7 +21,7 @@ import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var getSourceAllCmd = &cobra.Command{ diff --git a/cmd/flux/get_source_bucket.go b/cmd/flux/get_source_bucket.go index 87c7f86b..4eed78e1 100644 --- a/cmd/flux/get_source_bucket.go +++ b/cmd/flux/get_source_bucket.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var getSourceBucketCmd = &cobra.Command{ diff --git a/cmd/flux/get_source_chart.go b/cmd/flux/get_source_chart.go index 5179dad3..6f5ccecd 100644 --- a/cmd/flux/get_source_chart.go +++ b/cmd/flux/get_source_chart.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var getSourceHelmChartCmd = &cobra.Command{ diff --git a/cmd/flux/get_source_git.go b/cmd/flux/get_source_git.go index 9690ee3a..4b4f7c43 100644 --- a/cmd/flux/get_source_git.go +++ b/cmd/flux/get_source_git.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var getSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/get_source_helm.go b/cmd/flux/get_source_helm.go index d23ecd32..7b4eb8e8 100644 --- a/cmd/flux/get_source_helm.go +++ b/cmd/flux/get_source_helm.go @@ -24,7 +24,7 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/runtime" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var getSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/reconcile.go b/cmd/flux/reconcile.go index 5c56ea63..4ce8cc2c 100644 --- a/cmd/flux/reconcile.go +++ b/cmd/flux/reconcile.go @@ -60,13 +60,22 @@ type reconcilable interface { GetAnnotations() map[string]string SetAnnotations(map[string]string) - // this is usually implemented by GOTK types, since it's used for meta.SetResourceCondition - GetStatusConditions() *[]metav1.Condition - lastHandledReconcileRequest() string // what was the last handled reconcile request? successMessage() string // what do you want to tell people when successfully reconciled? } +func reconcilableConditions(object reconcilable) []metav1.Condition { + if s, ok := object.(meta.ObjectWithConditions); ok { + return s.GetConditions() + } + + if s, ok := object.(oldConditions); ok { + return *s.GetStatusConditions() + } + + return []metav1.Condition{} +} + func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error { if len(args) < 1 { return fmt.Errorf("%s name is required", reconcile.kind) @@ -118,7 +127,7 @@ func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error { reconciliationHandled(ctx, kubeClient, namespacedName, reconcile.object, lastHandledReconcileAt)); err != nil { return err } - readyCond := apimeta.FindStatusCondition(*reconcile.object.GetStatusConditions(), meta.ReadyCondition) + readyCond := apimeta.FindStatusCondition(reconcilableConditions(reconcile.object), meta.ReadyCondition) if readyCond == nil { return fmt.Errorf("status can't be determined") } @@ -137,7 +146,7 @@ func reconciliationHandled(ctx context.Context, kubeClient client.Client, if err != nil { return false, err } - isProgressing := apimeta.IsStatusConditionPresentAndEqual(*obj.GetStatusConditions(), + isProgressing := apimeta.IsStatusConditionPresentAndEqual(reconcilableConditions(obj), meta.ReadyCondition, metav1.ConditionUnknown) return obj.lastHandledReconcileRequest() != lastHandledReconcileAt && !isProgressing, nil } @@ -174,7 +183,7 @@ func isReconcileReady(ctx context.Context, kubeClient client.Client, return false, err } - if c := apimeta.FindStatusCondition(*obj.GetStatusConditions(), meta.ReadyCondition); c != nil { + if c := apimeta.FindStatusCondition(reconcilableConditions(obj), meta.ReadyCondition); c != nil { switch c.Status { case metav1.ConditionTrue: return true, nil diff --git a/cmd/flux/reconcile_helmrelease.go b/cmd/flux/reconcile_helmrelease.go index 38558a0f..1a513369 100644 --- a/cmd/flux/reconcile_helmrelease.go +++ b/cmd/flux/reconcile_helmrelease.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/types" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var reconcileHrCmd = &cobra.Command{ diff --git a/cmd/flux/reconcile_kustomization.go b/cmd/flux/reconcile_kustomization.go index fd8e3f8b..05035a50 100644 --- a/cmd/flux/reconcile_kustomization.go +++ b/cmd/flux/reconcile_kustomization.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/types" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var reconcileKsCmd = &cobra.Command{ diff --git a/cmd/flux/reconcile_source_bucket.go b/cmd/flux/reconcile_source_bucket.go index 768071da..3ede1c50 100644 --- a/cmd/flux/reconcile_source_bucket.go +++ b/cmd/flux/reconcile_source_bucket.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var reconcileSourceBucketCmd = &cobra.Command{ diff --git a/cmd/flux/reconcile_source_git.go b/cmd/flux/reconcile_source_git.go index 9b5a75be..375291ed 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/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var reconcileSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/reconcile_source_helm.go b/cmd/flux/reconcile_source_helm.go index e0836259..be27cf82 100644 --- a/cmd/flux/reconcile_source_helm.go +++ b/cmd/flux/reconcile_source_helm.go @@ -21,7 +21,7 @@ import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var reconcileSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/reconcile_with_source.go b/cmd/flux/reconcile_with_source.go index 6186d5d6..55361372 100644 --- a/cmd/flux/reconcile_with_source.go +++ b/cmd/flux/reconcile_with_source.go @@ -10,9 +10,8 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "github.com/fluxcd/pkg/apis/meta" - "github.com/fluxcd/flux2/internal/utils" + "github.com/fluxcd/pkg/apis/meta" ) type reconcileWithSource interface { @@ -83,7 +82,7 @@ func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []strin return err } - readyCond := apimeta.FindStatusCondition(*reconcile.object.GetStatusConditions(), meta.ReadyCondition) + readyCond := apimeta.FindStatusCondition(reconcilableConditions(reconcile.object), meta.ReadyCondition) if readyCond == nil { return fmt.Errorf("status can't be determined") } diff --git a/cmd/flux/resume_source_bucket.go b/cmd/flux/resume_source_bucket.go index c16d2090..a4a3b689 100644 --- a/cmd/flux/resume_source_bucket.go +++ b/cmd/flux/resume_source_bucket.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var resumeSourceBucketCmd = &cobra.Command{ diff --git a/cmd/flux/resume_source_chart.go b/cmd/flux/resume_source_chart.go index 6da61eed..bbe895c1 100644 --- a/cmd/flux/resume_source_chart.go +++ b/cmd/flux/resume_source_chart.go @@ -21,7 +21,7 @@ import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var resumeSourceHelmChartCmd = &cobra.Command{ diff --git a/cmd/flux/resume_source_git.go b/cmd/flux/resume_source_git.go index 31784281..05a9a095 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/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var resumeSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/resume_source_helm.go b/cmd/flux/resume_source_helm.go index 674a81b1..6e80895f 100644 --- a/cmd/flux/resume_source_helm.go +++ b/cmd/flux/resume_source_helm.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var resumeSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/source.go b/cmd/flux/source.go index d5c721bc..b6c9077c 100644 --- a/cmd/flux/source.go +++ b/cmd/flux/source.go @@ -19,7 +19,7 @@ package main import ( "sigs.k8s.io/controller-runtime/pkg/client" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) // These are general-purpose adapters for attaching methods to, for diff --git a/cmd/flux/status.go b/cmd/flux/status.go index 3c7bb253..e6c4b5fc 100644 --- a/cmd/flux/status.go +++ b/cmd/flux/status.go @@ -20,6 +20,7 @@ import ( "context" "fmt" + "github.com/fluxcd/pkg/apis/meta" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" @@ -27,8 +28,6 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/cli-utils/pkg/object" "sigs.k8s.io/controller-runtime/pkg/client" - - "github.com/fluxcd/pkg/apis/meta" ) // statusable is used to see if a resource is considered ready in the usual way @@ -37,10 +36,26 @@ type statusable interface { // this is implemented by ObjectMeta GetGeneration() int64 getObservedGeneration() int64 +} + +// oldConditions represents the deprecated API which is sunsetting. +type oldConditions interface { // this is usually implemented by GOTK API objects because it's used by pkg/apis/meta GetStatusConditions() *[]metav1.Condition } +func statusableConditions(object statusable) []metav1.Condition { + if s, ok := object.(meta.ObjectWithConditions); ok { + return s.GetConditions() + } + + if s, ok := object.(oldConditions); ok { + return *s.GetStatusConditions() + } + + return []metav1.Condition{} +} + func isReady(ctx context.Context, kubeClient client.Client, namespacedName types.NamespacedName, object statusable) wait.ConditionFunc { return func() (bool, error) { @@ -54,7 +69,7 @@ func isReady(ctx context.Context, kubeClient client.Client, return false, nil } - if c := apimeta.FindStatusCondition(*object.GetStatusConditions(), meta.ReadyCondition); c != nil { + if c := apimeta.FindStatusCondition(statusableConditions(object), meta.ReadyCondition); c != nil { switch c.Status { case metav1.ConditionTrue: return true, nil diff --git a/cmd/flux/suspend_source_bucket.go b/cmd/flux/suspend_source_bucket.go index e452b9dc..32dab414 100644 --- a/cmd/flux/suspend_source_bucket.go +++ b/cmd/flux/suspend_source_bucket.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var suspendSourceBucketCmd = &cobra.Command{ diff --git a/cmd/flux/suspend_source_chart.go b/cmd/flux/suspend_source_chart.go index 750e65ff..2befdbc4 100644 --- a/cmd/flux/suspend_source_chart.go +++ b/cmd/flux/suspend_source_chart.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var suspendSourceHelmChartCmd = &cobra.Command{ diff --git a/cmd/flux/suspend_source_git.go b/cmd/flux/suspend_source_git.go index 16ebd0a6..19490b10 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/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var suspendSourceGitCmd = &cobra.Command{ diff --git a/cmd/flux/suspend_source_helm.go b/cmd/flux/suspend_source_helm.go index 0b29a2dc..73bc1250 100644 --- a/cmd/flux/suspend_source_helm.go +++ b/cmd/flux/suspend_source_helm.go @@ -19,7 +19,7 @@ package main import ( "github.com/spf13/cobra" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var suspendSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/testdata/export/bucket.yaml b/cmd/flux/testdata/export/bucket.yaml index c998daf4..2e94a38e 100644 --- a/cmd/flux/testdata/export/bucket.yaml +++ b/cmd/flux/testdata/export/bucket.yaml @@ -1,5 +1,5 @@ --- -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/git-repo.yaml b/cmd/flux/testdata/export/git-repo.yaml index ed590afd..ee74c4b0 100644 --- a/cmd/flux/testdata/export/git-repo.yaml +++ b/cmd/flux/testdata/export/git-repo.yaml @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta1 +apiVersion: source.toolkit.fluxcd.io/v1beta2 kind: GitRepository metadata: name: flux-system diff --git a/cmd/flux/testdata/export/helm-repo.yaml b/cmd/flux/testdata/export/helm-repo.yaml index 1503ebf8..6467d6ce 100644 --- a/cmd/flux/testdata/export/helm-repo.yaml +++ b/cmd/flux/testdata/export/helm-repo.yaml @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta1 +apiVersion: source.toolkit.fluxcd.io/v1beta2 kind: HelmRepository metadata: name: flux-system diff --git a/cmd/flux/trace.go b/cmd/flux/trace.go index b5805ffd..27227f88 100644 --- a/cmd/flux/trace.go +++ b/cmd/flux/trace.go @@ -37,7 +37,7 @@ import ( helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" fluxmeta "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var traceCmd = &cobra.Command{ diff --git a/cmd/flux/uninstall.go b/cmd/flux/uninstall.go index 15d271b8..c26cbf00 100644 --- a/cmd/flux/uninstall.go +++ b/cmd/flux/uninstall.go @@ -34,7 +34,7 @@ import ( "github.com/fluxcd/flux2/pkg/manifestgen" helmv2 "github.com/fluxcd/helm-controller/api/v2beta1" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var uninstallCmd = &cobra.Command{ diff --git a/internal/flags/git_implementation.go b/internal/flags/git_implementation.go index b6896303..77512c2e 100644 --- a/internal/flags/git_implementation.go +++ b/internal/flags/git_implementation.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/internal/utils" ) diff --git a/internal/flags/git_implementation_test.go b/internal/flags/git_implementation_test.go index 22048f2e..9af8cfe2 100644 --- a/internal/flags/git_implementation_test.go +++ b/internal/flags/git_implementation_test.go @@ -22,7 +22,7 @@ package flags import ( "testing" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) func TestGitImplementation_Set(t *testing.T) { diff --git a/internal/flags/helm_chart_source.go b/internal/flags/helm_chart_source.go index c085d21f..f257f199 100644 --- a/internal/flags/helm_chart_source.go +++ b/internal/flags/helm_chart_source.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/internal/utils" ) diff --git a/internal/flags/helm_chart_source_test.go b/internal/flags/helm_chart_source_test.go index 726581ed..4590c3e9 100644 --- a/internal/flags/helm_chart_source_test.go +++ b/internal/flags/helm_chart_source_test.go @@ -23,7 +23,7 @@ import ( "fmt" "testing" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) func TestHelmChartSource_Set(t *testing.T) { diff --git a/internal/flags/kustomization_source.go b/internal/flags/kustomization_source.go index ca0b9f8e..b506230d 100644 --- a/internal/flags/kustomization_source.go +++ b/internal/flags/kustomization_source.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/internal/utils" ) diff --git a/internal/flags/kustomization_source_test.go b/internal/flags/kustomization_source_test.go index 2d1ba7e0..f2a398c4 100644 --- a/internal/flags/kustomization_source_test.go +++ b/internal/flags/kustomization_source_test.go @@ -23,7 +23,7 @@ import ( "fmt" "testing" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) func TestKustomizationSource_Set(t *testing.T) { diff --git a/internal/flags/source_bucket_provider.go b/internal/flags/source_bucket_provider.go index 87e26977..f5c62c71 100644 --- a/internal/flags/source_bucket_provider.go +++ b/internal/flags/source_bucket_provider.go @@ -21,7 +21,7 @@ import ( "strings" "github.com/fluxcd/flux2/internal/utils" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) var supportedSourceBucketProviders = []string{sourcev1.GenericBucketProvider, sourcev1.AmazonBucketProvider} diff --git a/internal/flags/source_bucket_provider_test.go b/internal/flags/source_bucket_provider_test.go index 244a7ac6..2f3192fd 100644 --- a/internal/flags/source_bucket_provider_test.go +++ b/internal/flags/source_bucket_provider_test.go @@ -22,7 +22,7 @@ package flags import ( "testing" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) func TestSourceBucketProvider_Set(t *testing.T) { diff --git a/internal/utils/utils.go b/internal/utils/utils.go index cdadeaa4..cc24354d 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -46,9 +46,9 @@ import ( imagereflectv1 "github.com/fluxcd/image-reflector-controller/api/v1beta1" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" notificationv1 "github.com/fluxcd/notification-controller/api/v1beta1" - "github.com/fluxcd/pkg/runtime/dependency" + "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/version" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/pkg/manifestgen/install" ) @@ -226,8 +226,8 @@ func ParseObjectKindNameNamespace(input string) (kind, name, namespace string) { return kind, name, namespace } -func MakeDependsOn(deps []string) []dependency.CrossNamespaceDependencyReference { - refs := []dependency.CrossNamespaceDependencyReference{} +func MakeDependsOn(deps []string) []meta.NamespacedObjectReference { + refs := []meta.NamespacedObjectReference{} for _, dep := range deps { parts := strings.Split(dep, "/") depNamespace := "" @@ -238,7 +238,7 @@ func MakeDependsOn(deps []string) []dependency.CrossNamespaceDependencyReference } else { depName = parts[0] } - refs = append(refs, dependency.CrossNamespaceDependencyReference{ + refs = append(refs, meta.NamespacedObjectReference{ Namespace: depNamespace, Name: depName, }) diff --git a/internal/utils/utils_test.go b/internal/utils/utils_test.go index 516423e6..c51e3e3c 100644 --- a/internal/utils/utils_test.go +++ b/internal/utils/utils_test.go @@ -25,7 +25,7 @@ import ( "reflect" "testing" - "github.com/fluxcd/pkg/runtime/dependency" + "github.com/fluxcd/pkg/apis/meta" ) func TestCompatibleVersion(t *testing.T) { @@ -88,7 +88,7 @@ func TestMakeDependsOn(t *testing.T) { "someNSD/", "", } - want := []dependency.CrossNamespaceDependencyReference{ + want := []meta.NamespacedObjectReference{ {Namespace: "someNSA", Name: "someNameA"}, {Namespace: "someNSB", Name: "someNameB"}, {Namespace: "", Name: "someNameC"}, diff --git a/pkg/manifestgen/sync/sync.go b/pkg/manifestgen/sync/sync.go index 757d6bef..818c11f4 100644 --- a/pkg/manifestgen/sync/sync.go +++ b/pkg/manifestgen/sync/sync.go @@ -28,7 +28,7 @@ import ( kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/flux2/pkg/manifestgen" ) diff --git a/pkg/manifestgen/sync/sync_test.go b/pkg/manifestgen/sync/sync_test.go index 3ab0a743..2c22d407 100644 --- a/pkg/manifestgen/sync/sync_test.go +++ b/pkg/manifestgen/sync/sync_test.go @@ -25,7 +25,7 @@ import ( "testing" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) func TestGenerate(t *testing.T) { diff --git a/tests/azure/azure_test.go b/tests/azure/azure_test.go index ce4c2937..ed701baa 100644 --- a/tests/azure/azure_test.go +++ b/tests/azure/azure_test.go @@ -51,7 +51,7 @@ import ( notiv1beta1 "github.com/fluxcd/notification-controller/api/v1beta1" "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/runtime/events" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) const ( diff --git a/tests/azure/go.mod b/tests/azure/go.mod index 0f0ff70c..59981ec6 100644 --- a/tests/azure/go.mod +++ b/tests/azure/go.mod @@ -9,9 +9,9 @@ require ( github.com/fluxcd/image-reflector-controller/api v0.16.0 github.com/fluxcd/kustomize-controller/api v0.20.2 github.com/fluxcd/notification-controller/api v0.21.0 - github.com/fluxcd/pkg/apis/meta v0.10.2 + github.com/fluxcd/pkg/apis/meta v0.12.1 github.com/fluxcd/pkg/runtime v0.12.4 - github.com/fluxcd/source-controller/api v0.21.2 + github.com/fluxcd/source-controller/api v0.22.0 github.com/hashicorp/terraform-exec v0.14.0 github.com/libgit2/git2go/v31 v31.6.1 github.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5 @@ -19,9 +19,9 @@ require ( github.com/whilp/git-urls v1.0.0 go.uber.org/multierr v1.6.0 k8s.io/api v0.23.1 - k8s.io/apimachinery v0.23.1 + k8s.io/apimachinery v0.23.4 k8s.io/client-go v0.23.1 - sigs.k8s.io/controller-runtime v0.11.0 + sigs.k8s.io/controller-runtime v0.11.1 ) require ( @@ -103,7 +103,7 @@ require ( k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect k8s.io/utils v0.0.0-20211208161948-7d6a63dca704 // indirect sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/tests/azure/go.sum b/tests/azure/go.sum index 125d7610..9582fe29 100644 --- a/tests/azure/go.sum +++ b/tests/azure/go.sum @@ -212,14 +212,15 @@ github.com/fluxcd/pkg/apis/acl v0.0.3 h1:Lw0ZHdpnO4G7Zy9KjrzwwBmDZQuy4qEjaU/RvA6 github.com/fluxcd/pkg/apis/acl v0.0.3/go.mod h1:XPts6lRJ9C9fIF9xVWofmQwftvhY25n1ps7W9xw0XLU= github.com/fluxcd/pkg/apis/kustomize v0.3.1 h1:wmb5D9e1+Rr3/5O3235ERuj+h2VKUArVfYYk68QKP+w= github.com/fluxcd/pkg/apis/kustomize v0.3.1/go.mod h1:k2HSRd68UwgNmOYBPOd6WbX6a2MH2X/Jeh7e3s3PFPc= -github.com/fluxcd/pkg/apis/meta v0.10.2 h1:pnDBBEvfs4HaKiVAYgz+e/AQ8dLvcgmVfSeBroZ/KKI= github.com/fluxcd/pkg/apis/meta v0.10.2/go.mod h1:KQ2er9xa6koy7uoPMZjIjNudB5p4tXs+w0GO6fRcy7I= +github.com/fluxcd/pkg/apis/meta v0.12.1 h1:m5PfKAqbqWBvGp9+JRj1sv+xNkGsHwUVf+3rJ8wm6SE= +github.com/fluxcd/pkg/apis/meta v0.12.1/go.mod h1:f8YVt70/KAhqzZ7xxhjvqyzKubOYx2pAbakb/FfCEg8= github.com/fluxcd/pkg/runtime v0.12.3/go.mod h1:imJ2xYy/d4PbSinX2IefmZk+iS2c1P5fY0js8mCE4SM= github.com/fluxcd/pkg/runtime v0.12.4 h1:gA27RG/+adN2/7Qe03PB46Iwmye/MusPCpuS4zQ2fW0= github.com/fluxcd/pkg/runtime v0.12.4/go.mod h1:gspNvhAqodZgSmK1ZhMtvARBf/NGAlxmaZaIOHkJYsc= github.com/fluxcd/source-controller/api v0.21.0/go.mod h1:Ab2qDmAUz6ZCp8UaHYLYzxyFrC1FQqEqjxiROb/Rdiw= -github.com/fluxcd/source-controller/api v0.21.2 h1:J0S5NN4V8FPLrkSMXIUoUvj1X/RuTpVJSjIRF414wmc= -github.com/fluxcd/source-controller/api v0.21.2/go.mod h1:Ab2qDmAUz6ZCp8UaHYLYzxyFrC1FQqEqjxiROb/Rdiw= +github.com/fluxcd/source-controller/api v0.22.0 h1:WF0xsrlyUaRLWS4u5un3yfzlvER86sZx/qiV6l7Ay6Q= +github.com/fluxcd/source-controller/api v0.22.0/go.mod h1:Vb13q9Pq+1IW/sJUZn/RSb7IU5WT86Er6uCFPCFm9L4= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c= @@ -1121,8 +1122,9 @@ k8s.io/apiextensions-apiserver v0.23.0/go.mod h1:xIFAEEDlAZgpVBl/1VSjGDmLoXAWRG4 k8s.io/apiextensions-apiserver v0.23.1 h1:xxE0q1vLOVZiWORu1KwNRQFsGWtImueOrqSl13sS5EU= k8s.io/apiextensions-apiserver v0.23.1/go.mod h1:0qz4fPaHHsVhRApbtk3MGXNn2Q9M/cVWWhfHdY2SxiM= k8s.io/apimachinery v0.23.0/go.mod h1:fFCTTBKvKcwTPFzjlcxp91uPFZr+JA0FubU4fLzzFYc= -k8s.io/apimachinery v0.23.1 h1:sfBjlDFwj2onG0Ijx5C+SrAoeUscPrmghm7wHP+uXlo= k8s.io/apimachinery v0.23.1/go.mod h1:SADt2Kl8/sttJ62RRsi9MIV4o8f5S3coArm0Iu3fBno= +k8s.io/apimachinery v0.23.4 h1:fhnuMd/xUL3Cjfl64j5ULKZ1/J9n8NuQEgNL+WXWfdM= +k8s.io/apimachinery v0.23.4/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= k8s.io/apiserver v0.23.0/go.mod h1:Cec35u/9zAepDPPFyT+UMrgqOCjgJ5qtfVJDxjZYmt4= k8s.io/apiserver v0.23.1/go.mod h1:Bqt0gWbeM2NefS8CjWswwd2VNAKN6lUKR85Ft4gippY= k8s.io/client-go v0.23.0/go.mod h1:hrDnpnK1mSr65lHHcUuIZIXDgEbzc7/683c6hyG4jTA= @@ -1141,21 +1143,24 @@ k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 h1:E3J9oCLlaobFUqsjG9DfKb k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk= k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20211208161948-7d6a63dca704 h1:ZKMMxTvduyf5WUtREOqg5LiXaN1KO/+0oOQPRFrClpo= k8s.io/utils v0.0.0-20211208161948-7d6a63dca704/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= 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/apiserver-network-proxy/konnectivity-client v0.0.25/go.mod h1:Mlj9PNLmG9bZ6BHFwFKDo5afkpWyUISkb9Me0GnK66I= -sigs.k8s.io/controller-runtime v0.11.0 h1:DqO+c8mywcZLFJWILq4iktoECTyn30Bkj0CwgqMpZWQ= sigs.k8s.io/controller-runtime v0.11.0/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA= +sigs.k8s.io/controller-runtime v0.11.1 h1:7YIHT2QnHJArj/dk9aUkYhfqfK5cIxPOX5gPECfdZLU= +sigs.k8s.io/controller-runtime v0.11.1/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA= sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs= sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y= sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY= sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= -sigs.k8s.io/structured-merge-diff/v4 v4.2.0 h1:kDvPBbnPk+qYmkHmSo8vKGp438IASWofnbbUKDE/bv0= sigs.k8s.io/structured-merge-diff/v4 v4.2.0/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/tests/azure/util_test.go b/tests/azure/util_test.go index 958b40fd..c49b28d7 100644 --- a/tests/azure/util_test.go +++ b/tests/azure/util_test.go @@ -41,7 +41,7 @@ import ( kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2" notiv1beta1 "github.com/fluxcd/notification-controller/api/v1beta1" "github.com/fluxcd/pkg/apis/meta" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta1" + sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) const defaultBranch = "main"