From 89038b7300ad9fcba8d452caf1ecff2bdaf2a128 Mon Sep 17 00:00:00 2001 From: fluxcdbot Date: Mon, 6 May 2024 09:12:31 +0000 Subject: [PATCH 1/6] Update toolkit components - kustomize-controller to v1.3.0 https://github.com/fluxcd/kustomize-controller/blob/v1.3.0/CHANGELOG.md - source-controller to v1.3.0 https://github.com/fluxcd/source-controller/blob/v1.3.0/CHANGELOG.md Signed-off-by: GitHub --- go.mod | 6 +++--- go.sum | 12 ++++++------ .../bases/kustomize-controller/kustomization.yaml | 4 ++-- manifests/bases/source-controller/kustomization.yaml | 4 ++-- manifests/crds/kustomization.yaml | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index f4ef45d95b..e2c3a46d90 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/fluxcd/helm-controller/api v0.37.4 github.com/fluxcd/image-automation-controller/api v0.37.1 github.com/fluxcd/image-reflector-controller/api v0.31.2 - github.com/fluxcd/kustomize-controller/api v1.2.2 + github.com/fluxcd/kustomize-controller/api v1.3.0 github.com/fluxcd/notification-controller/api v1.2.4 github.com/fluxcd/pkg/apis/event v0.9.0 github.com/fluxcd/pkg/apis/meta v1.5.0 @@ -30,7 +30,7 @@ require ( github.com/fluxcd/pkg/ssh v0.13.0 github.com/fluxcd/pkg/tar v0.7.0 github.com/fluxcd/pkg/version v0.4.0 - github.com/fluxcd/source-controller/api v1.2.4 + github.com/fluxcd/source-controller/api v1.3.0 github.com/go-git/go-git/v5 v5.12.0 github.com/go-logr/logr v1.4.1 github.com/gonvenience/bunt v1.3.5 @@ -58,7 +58,7 @@ require ( k8s.io/cli-runtime v0.30.0 k8s.io/client-go v0.30.0 k8s.io/kubectl v0.30.0 - sigs.k8s.io/controller-runtime v0.18.0 + sigs.k8s.io/controller-runtime v0.18.1 sigs.k8s.io/kustomize/api v0.17.1 sigs.k8s.io/kustomize/kyaml v0.17.0 sigs.k8s.io/yaml v1.4.0 diff --git a/go.sum b/go.sum index ba6d49373e..a118862677 100644 --- a/go.sum +++ b/go.sum @@ -163,8 +163,8 @@ github.com/fluxcd/image-automation-controller/api v0.37.1 h1:zi1VfPoGuHsNtyTpueK github.com/fluxcd/image-automation-controller/api v0.37.1/go.mod h1:7p0woxB275YzhdctzbxVMck0/hZt45bm0K12A0ABldo= github.com/fluxcd/image-reflector-controller/api v0.31.2 h1:s16ewwfuLBYuh8hENuVgU8SYsSNxRaA4f+AD60/+les= github.com/fluxcd/image-reflector-controller/api v0.31.2/go.mod h1:tV7g+KXQL3W8w5+fRJU7ubVGc4QAfx1C7XI5qrQvA3U= -github.com/fluxcd/kustomize-controller/api v1.2.2 h1:LXRa2181usLsDkAJ86i/CnvCyPwhLcFUw9jBnXxTFJ4= -github.com/fluxcd/kustomize-controller/api v1.2.2/go.mod h1:dfAaPQuuoWfExyWaeO7Kj2ZtfKQ4nDcJrt7AeAFlLZs= +github.com/fluxcd/kustomize-controller/api v1.3.0 h1:IwXkU48lQ/YhU6XULlPXDgQlnpNyQdCNbUvhLdWVIbE= +github.com/fluxcd/kustomize-controller/api v1.3.0/go.mod h1:kg/WM9Uye5NOqGVW/F3jnkjrlgFZHHa84+4lnzOV8fI= github.com/fluxcd/notification-controller/api v1.2.4 h1:H/C8XW5boncf8rzJjSe/MCr186Hgvw+arPat9XOaRlw= github.com/fluxcd/notification-controller/api v1.2.4/go.mod h1:LeHtKKTI3ew+FXY0oYtYqM68UYOArfBa/cy4pxAzN4M= github.com/fluxcd/pkg/apis/acl v0.3.0 h1:UOrKkBTOJK+OlZX7n8rWt2rdBmDCoTK+f5TY2LcZi8A= @@ -199,8 +199,8 @@ github.com/fluxcd/pkg/tar v0.7.0 h1:xdg95f4DlzMgd4m+xPRXrX4NLb8P8b5SAqB19sDOLIs= github.com/fluxcd/pkg/tar v0.7.0/go.mod h1:KLg1zMZF7sEncGA9LEsfkskbCMyLSEgrjBRXqFK++VE= github.com/fluxcd/pkg/version v0.4.0 h1:3F6oeIZ+ug/f7pALIBhcUhfURel37EPPOn7nsGfsnOg= github.com/fluxcd/pkg/version v0.4.0/go.mod h1:izVsSDxac81qWRmpOL9qcxZYx+zAN1ajoP5SidGP6PA= -github.com/fluxcd/source-controller/api v1.2.4 h1:XjKTWhSSeLGsogWnTcLl5sUnyMlC5TKDbbBgP9SyJ5c= -github.com/fluxcd/source-controller/api v1.2.4/go.mod h1:j3QSHpIPBP5sjaGIkVtsgWCx8JcOmcsutRmdJmRMOZg= +github.com/fluxcd/source-controller/api v1.3.0 h1:Z5Lq0aJY87yg0cQDEuwGLKS60GhdErCHtsi546HUt10= +github.com/fluxcd/source-controller/api v1.3.0/go.mod h1:+tfd0vltjcVs/bbnq9AlYR9AAHSVfM/Z4v4TpQmdJf4= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE= @@ -727,8 +727,8 @@ k8s.io/kubectl v0.30.0 h1:xbPvzagbJ6RNYVMVuiHArC1grrV5vSmmIcSZuCdzRyk= k8s.io/kubectl v0.30.0/go.mod h1:zgolRw2MQXLPwmic2l/+iHs239L49fhSeICuMhQQXTI= k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY= k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.18.0 h1:Z7jKuX784TQSUL1TIyeuF7j8KXZ4RtSX0YgtjKcSTME= -sigs.k8s.io/controller-runtime v0.18.0/go.mod h1:tuAt1+wbVsXIT8lPtk5RURxqAnq7xkpv2Mhttslg7Hw= +sigs.k8s.io/controller-runtime v0.18.1 h1:RpWbigmuiylbxOCLy0tGnq1cU1qWPwNIQzoJk+QeJx4= +sigs.k8s.io/controller-runtime v0.18.1/go.mod h1:tuAt1+wbVsXIT8lPtk5RURxqAnq7xkpv2Mhttslg7Hw= 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/kustomize/api v0.17.1 h1:MYJBOP/yQ3/5tp4/sf6HiiMfNNyO97LmtnirH9SLNr4= diff --git a/manifests/bases/kustomize-controller/kustomization.yaml b/manifests/bases/kustomize-controller/kustomization.yaml index 6fb1a2d238..8104b199d0 100644 --- a/manifests/bases/kustomize-controller/kustomization.yaml +++ b/manifests/bases/kustomize-controller/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/kustomize-controller/releases/download/v1.2.2/kustomize-controller.crds.yaml -- https://github.com/fluxcd/kustomize-controller/releases/download/v1.2.2/kustomize-controller.deployment.yaml +- https://github.com/fluxcd/kustomize-controller/releases/download/v1.3.0/kustomize-controller.crds.yaml +- https://github.com/fluxcd/kustomize-controller/releases/download/v1.3.0/kustomize-controller.deployment.yaml - account.yaml transformers: - labels.yaml diff --git a/manifests/bases/source-controller/kustomization.yaml b/manifests/bases/source-controller/kustomization.yaml index 13195e8784..040e367a0b 100644 --- a/manifests/bases/source-controller/kustomization.yaml +++ b/manifests/bases/source-controller/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/source-controller/releases/download/v1.2.4/source-controller.crds.yaml -- https://github.com/fluxcd/source-controller/releases/download/v1.2.4/source-controller.deployment.yaml +- https://github.com/fluxcd/source-controller/releases/download/v1.3.0/source-controller.crds.yaml +- https://github.com/fluxcd/source-controller/releases/download/v1.3.0/source-controller.deployment.yaml - account.yaml transformers: - labels.yaml diff --git a/manifests/crds/kustomization.yaml b/manifests/crds/kustomization.yaml index a376de1a17..d6ab39e2c5 100644 --- a/manifests/crds/kustomization.yaml +++ b/manifests/crds/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- https://github.com/fluxcd/source-controller/releases/download/v1.2.4/source-controller.crds.yaml -- https://github.com/fluxcd/kustomize-controller/releases/download/v1.2.2/kustomize-controller.crds.yaml +- https://github.com/fluxcd/source-controller/releases/download/v1.3.0/source-controller.crds.yaml +- https://github.com/fluxcd/kustomize-controller/releases/download/v1.3.0/kustomize-controller.crds.yaml - https://github.com/fluxcd/helm-controller/releases/download/v0.37.4/helm-controller.crds.yaml - https://github.com/fluxcd/notification-controller/releases/download/v1.2.4/notification-controller.crds.yaml - https://github.com/fluxcd/image-reflector-controller/releases/download/v0.31.2/image-reflector-controller.crds.yaml From 1aaa48fa097f4abc04ba2d25e9004d6f409d2169 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Mon, 6 May 2024 12:28:34 +0300 Subject: [PATCH 2/6] Update Helm Source APIs to v1 (GA) Signed-off-by: Stefan Prodan --- cmd/flux/create_source_helm.go | 2 +- cmd/flux/create_source_oci.go | 15 ++++++------ cmd/flux/export_source_helm.go | 2 +- cmd/flux/get_source_all.go | 4 ++-- cmd/flux/get_source_chart.go | 2 +- cmd/flux/get_source_helm.go | 2 +- cmd/flux/reconcile_helmrelease.go | 4 ++-- cmd/flux/reconcile_source_chart.go | 8 +++---- cmd/flux/reconcile_source_helm.go | 2 +- cmd/flux/resume_source_chart.go | 2 +- cmd/flux/resume_source_helm.go | 2 +- cmd/flux/source.go | 24 +++++++++---------- cmd/flux/suspend_source_chart.go | 2 +- cmd/flux/suspend_source_helm.go | 2 +- .../testdata/create_source_helm/https.golden | 2 +- .../create_source_helm/oci-with-secret.golden | 2 +- .../testdata/create_source_helm/oci.golden | 2 +- cmd/flux/testdata/export/helm-repo.yaml | 2 +- 18 files changed, 41 insertions(+), 40 deletions(-) diff --git a/cmd/flux/create_source_helm.go b/cmd/flux/create_source_helm.go index 522e980fe7..b4f6130928 100644 --- a/cmd/flux/create_source_helm.go +++ b/cmd/flux/create_source_helm.go @@ -32,7 +32,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/yaml" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" "github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/flux2/v2/pkg/manifestgen/sourcesecret" diff --git a/cmd/flux/create_source_oci.go b/cmd/flux/create_source_oci.go index cf58dcf823..4713334a57 100644 --- a/cmd/flux/create_source_oci.go +++ b/cmd/flux/create_source_oci.go @@ -30,7 +30,8 @@ import ( "github.com/fluxcd/pkg/apis/meta" - 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/v2/internal/flags" "github.com/fluxcd/flux2/v2/internal/utils" @@ -79,7 +80,7 @@ var sourceOCIRepositoryArgs = newSourceOCIFlags() func newSourceOCIFlags() sourceOCIRepositoryFlags { return sourceOCIRepositoryFlags{ - provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider), + provider: flags.SourceOCIProvider(sourcev1b2.GenericOCIProvider), } } @@ -124,20 +125,20 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error { ignorePaths = &ignorePathsStr } - repository := &sourcev1.OCIRepository{ + repository := &sourcev1b2.OCIRepository{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: *kubeconfigArgs.Namespace, Labels: sourceLabels, }, - Spec: sourcev1.OCIRepositorySpec{ + Spec: sourcev1b2.OCIRepositorySpec{ Provider: sourceOCIRepositoryArgs.provider.String(), URL: sourceOCIRepositoryArgs.url, Insecure: sourceOCIRepositoryArgs.insecure, Interval: metav1.Duration{ Duration: createArgs.interval, }, - Reference: &sourcev1.OCIRepositoryRef{}, + Reference: &sourcev1b2.OCIRepositoryRef{}, Ignore: ignorePaths, }, } @@ -228,13 +229,13 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error { } func upsertOCIRepository(ctx context.Context, kubeClient client.Client, - ociRepository *sourcev1.OCIRepository) (types.NamespacedName, error) { + ociRepository *sourcev1b2.OCIRepository) (types.NamespacedName, error) { namespacedName := types.NamespacedName{ Namespace: ociRepository.GetNamespace(), Name: ociRepository.GetName(), } - var existing sourcev1.OCIRepository + var existing sourcev1b2.OCIRepository err := kubeClient.Get(ctx, namespacedName, &existing) if err != nil { if errors.IsNotFound(err) { diff --git a/cmd/flux/export_source_helm.go b/cmd/flux/export_source_helm.go index f52e5010ce..f15d7b540c 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/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var exportSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/get_source_all.go b/cmd/flux/get_source_all.go index c6736c7497..5dfb9f97c2 100644 --- a/cmd/flux/get_source_all.go +++ b/cmd/flux/get_source_all.go @@ -54,11 +54,11 @@ var getSourceAllCmd = &cobra.Command{ }, { apiType: helmRepositoryType, - list: &helmRepositoryListAdapter{&sourcev1b2.HelmRepositoryList{}}, + list: &helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}}, }, { apiType: helmChartType, - list: &helmChartListAdapter{&sourcev1b2.HelmChartList{}}, + list: &helmChartListAdapter{&sourcev1.HelmChartList{}}, }, } diff --git a/cmd/flux/get_source_chart.go b/cmd/flux/get_source_chart.go index b82bdd7841..c4a455ef32 100644 --- a/cmd/flux/get_source_chart.go +++ b/cmd/flux/get_source_chart.go @@ -25,7 +25,7 @@ import ( "golang.org/x/text/language" "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/v2/internal/utils" ) diff --git a/cmd/flux/get_source_helm.go b/cmd/flux/get_source_helm.go index ec131714ab..913276bed2 100644 --- a/cmd/flux/get_source_helm.go +++ b/cmd/flux/get_source_helm.go @@ -26,7 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "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/v2/internal/utils" ) diff --git a/cmd/flux/reconcile_helmrelease.go b/cmd/flux/reconcile_helmrelease.go index 1a1a576922..7d4449e92d 100644 --- a/cmd/flux/reconcile_helmrelease.go +++ b/cmd/flux/reconcile_helmrelease.go @@ -19,11 +19,11 @@ package main import ( "fmt" + sourcev1 "github.com/fluxcd/source-controller/api/v1" "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/types" helmv2 "github.com/fluxcd/helm-controller/api/v2beta2" - sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" ) var reconcileHrCmd = &cobra.Command{ @@ -70,7 +70,7 @@ func (obj helmReleaseAdapter) reconcileSource() bool { func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName) { cmd := reconcileWithSourceCommand{ apiType: helmChartType, - object: helmChartAdapter{&sourcev1b2.HelmChart{}}, + object: helmChartAdapter{&sourcev1.HelmChart{}}, force: true, } diff --git a/cmd/flux/reconcile_source_chart.go b/cmd/flux/reconcile_source_chart.go index ead4fa7663..7db4208798 100644 --- a/cmd/flux/reconcile_source_chart.go +++ b/cmd/flux/reconcile_source_chart.go @@ -33,10 +33,10 @@ var reconcileSourceHelmChartCmd = &cobra.Command{ # Trigger a reconciliation of the HelmCharts's source and apply changes flux reconcile helmchart podinfo --with-source`, - ValidArgsFunction: resourceNamesCompletionFunc(sourcev1b2.GroupVersion.WithKind(sourcev1b2.HelmChartKind)), + ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1b2.HelmChartKind)), RunE: reconcileWithSourceCommand{ apiType: helmChartType, - object: helmChartAdapter{&sourcev1b2.HelmChart{}}, + object: helmChartAdapter{&sourcev1.HelmChart{}}, }.run, } @@ -62,10 +62,10 @@ func (obj helmChartAdapter) reconcileSource() bool { func (obj helmChartAdapter) getSource() (reconcileSource, types.NamespacedName) { var cmd reconcileCommand switch obj.Spec.SourceRef.Kind { - case sourcev1b2.HelmRepositoryKind: + case sourcev1.HelmRepositoryKind: cmd = reconcileCommand{ apiType: helmRepositoryType, - object: helmRepositoryAdapter{&sourcev1b2.HelmRepository{}}, + object: helmRepositoryAdapter{&sourcev1.HelmRepository{}}, } case sourcev1.GitRepositoryKind: cmd = reconcileCommand{ diff --git a/cmd/flux/reconcile_source_helm.go b/cmd/flux/reconcile_source_helm.go index a081fd0e88..a9b89d3d8e 100644 --- a/cmd/flux/reconcile_source_helm.go +++ b/cmd/flux/reconcile_source_helm.go @@ -23,7 +23,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" ) var reconcileSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/resume_source_chart.go b/cmd/flux/resume_source_chart.go index 6322f06fc1..9e7ec7591b 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/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var resumeSourceHelmChartCmd = &cobra.Command{ diff --git a/cmd/flux/resume_source_helm.go b/cmd/flux/resume_source_helm.go index 0ac641ebb6..b4cb13164e 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/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var resumeSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/source.go b/cmd/flux/source.go index 7dc96fdf1d..64f755be3b 100644 --- a/cmd/flux/source.go +++ b/cmd/flux/source.go @@ -95,16 +95,16 @@ func (a bucketListAdapter) len() int { return len(a.BucketList.Items) } -// sourcev1b2.HelmChart +// sourcev1.HelmChart var helmChartType = apiType{ - kind: sourcev1b2.HelmChartKind, + kind: sourcev1.HelmChartKind, humanKind: "source chart", - groupVersion: sourcev1b2.GroupVersion, + groupVersion: sourcev1.GroupVersion, } type helmChartAdapter struct { - *sourcev1b2.HelmChart + *sourcev1.HelmChart } func (a helmChartAdapter) asClientObject() client.Object { @@ -115,10 +115,10 @@ func (a helmChartAdapter) deepCopyClientObject() client.Object { return a.HelmChart.DeepCopy() } -// sourcev1b2.HelmChartList +// sourcev1.HelmChartList type helmChartListAdapter struct { - *sourcev1b2.HelmChartList + *sourcev1.HelmChartList } func (a helmChartListAdapter) asClientList() client.ObjectList { @@ -163,16 +163,16 @@ func (a gitRepositoryListAdapter) len() int { return len(a.GitRepositoryList.Items) } -// sourcev1b2.HelmRepository +// sourcev1.HelmRepository var helmRepositoryType = apiType{ - kind: sourcev1b2.HelmRepositoryKind, + kind: sourcev1.HelmRepositoryKind, humanKind: "source helm", - groupVersion: sourcev1b2.GroupVersion, + groupVersion: sourcev1.GroupVersion, } type helmRepositoryAdapter struct { - *sourcev1b2.HelmRepository + *sourcev1.HelmRepository } func (a helmRepositoryAdapter) asClientObject() client.Object { @@ -183,10 +183,10 @@ func (a helmRepositoryAdapter) deepCopyClientObject() client.Object { return a.HelmRepository.DeepCopy() } -// sourcev1b2.HelmRepositoryList +// sourcev1.HelmRepositoryList type helmRepositoryListAdapter struct { - *sourcev1b2.HelmRepositoryList + *sourcev1.HelmRepositoryList } func (a helmRepositoryListAdapter) asClientList() client.ObjectList { diff --git a/cmd/flux/suspend_source_chart.go b/cmd/flux/suspend_source_chart.go index e91327e844..6da1d8c0c6 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/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var suspendSourceHelmChartCmd = &cobra.Command{ diff --git a/cmd/flux/suspend_source_helm.go b/cmd/flux/suspend_source_helm.go index 22598c64cf..a59343bd49 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/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var suspendSourceHelmCmd = &cobra.Command{ diff --git a/cmd/flux/testdata/create_source_helm/https.golden b/cmd/flux/testdata/create_source_helm/https.golden index 8723524547..02da00a5a3 100644 --- a/cmd/flux/testdata/create_source_helm/https.golden +++ b/cmd/flux/testdata/create_source_helm/https.golden @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: HelmRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_helm/oci-with-secret.golden b/cmd/flux/testdata/create_source_helm/oci-with-secret.golden index 760a265c63..d01f6f7245 100644 --- a/cmd/flux/testdata/create_source_helm/oci-with-secret.golden +++ b/cmd/flux/testdata/create_source_helm/oci-with-secret.golden @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: HelmRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/create_source_helm/oci.golden b/cmd/flux/testdata/create_source_helm/oci.golden index f6049e99f6..92f095587b 100644 --- a/cmd/flux/testdata/create_source_helm/oci.golden +++ b/cmd/flux/testdata/create_source_helm/oci.golden @@ -1,5 +1,5 @@ --- -apiVersion: source.toolkit.fluxcd.io/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: HelmRepository metadata: name: podinfo diff --git a/cmd/flux/testdata/export/helm-repo.yaml b/cmd/flux/testdata/export/helm-repo.yaml index c5366e0baf..685b9079e0 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/v1beta2 +apiVersion: source.toolkit.fluxcd.io/v1 kind: HelmRepository metadata: name: flux-system From 6baefa258633f0d2550a969bec6b34ecc106d0e1 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Mon, 6 May 2024 12:50:22 +0300 Subject: [PATCH 3/6] Mark `source helm` commands as GA Signed-off-by: Stefan Prodan --- cmd/flux/create_secret_helm.go | 2 +- cmd/flux/create_source_helm.go | 6 +++--- cmd/flux/delete_source_helm.go | 2 +- cmd/flux/export_source_helm.go | 2 +- cmd/flux/get_source_chart.go | 2 +- cmd/flux/get_source_helm.go | 2 +- cmd/flux/reconcile_helmrelease.go | 2 +- cmd/flux/reconcile_with_source.go | 3 ++- cmd/flux/stats.go | 12 ++++++------ 9 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cmd/flux/create_secret_helm.go b/cmd/flux/create_secret_helm.go index bca4b5fdce..2a809366d1 100644 --- a/cmd/flux/create_secret_helm.go +++ b/cmd/flux/create_secret_helm.go @@ -32,7 +32,7 @@ import ( var createSecretHelmCmd = &cobra.Command{ Use: "helm [name]", Short: "Create or update a Kubernetes secret for Helm repository authentication", - Long: withPreviewNote(`The create secret helm command generates a Kubernetes secret with basic authentication credentials.`), + Long: `The create secret helm command generates a Kubernetes secret with basic authentication credentials.`, Example: ` # Create a Helm authentication secret on disk and encrypt it with Mozilla SOPS flux create secret helm repo-auth \ --namespace=my-namespace \ diff --git a/cmd/flux/create_source_helm.go b/cmd/flux/create_source_helm.go index b4f6130928..d299c43b01 100644 --- a/cmd/flux/create_source_helm.go +++ b/cmd/flux/create_source_helm.go @@ -22,7 +22,6 @@ import ( "net/url" "os" - "github.com/fluxcd/pkg/apis/meta" "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -32,6 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/yaml" + "github.com/fluxcd/pkg/apis/meta" sourcev1 "github.com/fluxcd/source-controller/api/v1" "github.com/fluxcd/flux2/v2/internal/utils" @@ -41,8 +41,8 @@ import ( var createSourceHelmCmd = &cobra.Command{ Use: "helm [name]", Short: "Create or update a HelmRepository source", - Long: withPreviewNote(`The create source helm command generates a HelmRepository resource and waits for it to fetch the index. -For private Helm repositories, the basic authentication credentials are stored in a Kubernetes secret.`), + Long: `The create source helm command generates a HelmRepository resource and waits for it to fetch the index. +For private Helm repositories, the basic authentication credentials are stored in a Kubernetes secret.`, Example: ` # Create a source for an HTTPS public Helm repository flux create source helm podinfo \ --url=https://stefanprodan.github.io/podinfo \ diff --git a/cmd/flux/delete_source_helm.go b/cmd/flux/delete_source_helm.go index bd057e8aaa..a5956d872b 100644 --- a/cmd/flux/delete_source_helm.go +++ b/cmd/flux/delete_source_helm.go @@ -25,7 +25,7 @@ import ( var deleteSourceHelmCmd = &cobra.Command{ Use: "helm [name]", Short: "Delete a HelmRepository source", - Long: withPreviewNote("The delete source helm command deletes the given HelmRepository from the cluster."), + Long: "The delete source helm command deletes the given HelmRepository from the cluster.", Example: ` # Delete a Helm repository flux delete source helm podinfo`, ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)), diff --git a/cmd/flux/export_source_helm.go b/cmd/flux/export_source_helm.go index f15d7b540c..2c8da3a1d4 100644 --- a/cmd/flux/export_source_helm.go +++ b/cmd/flux/export_source_helm.go @@ -27,7 +27,7 @@ import ( var exportSourceHelmCmd = &cobra.Command{ Use: "helm [name]", Short: "Export HelmRepository sources in YAML format", - Long: withPreviewNote("The export source git command exports one or all HelmRepository sources in YAML format."), + Long: "The export source git command exports one or all HelmRepository sources in YAML format.", Example: ` # Export all HelmRepository sources flux export source helm --all > sources.yaml diff --git a/cmd/flux/get_source_chart.go b/cmd/flux/get_source_chart.go index c4a455ef32..4f0784534a 100644 --- a/cmd/flux/get_source_chart.go +++ b/cmd/flux/get_source_chart.go @@ -33,7 +33,7 @@ import ( var getSourceHelmChartCmd = &cobra.Command{ Use: "chart", Short: "Get HelmChart statuses", - Long: withPreviewNote("The get sources chart command prints the status of the HelmCharts."), + Long: "The get sources chart command prints the status of the HelmCharts.", Example: ` # List all Helm charts and their status flux get sources chart diff --git a/cmd/flux/get_source_helm.go b/cmd/flux/get_source_helm.go index 913276bed2..eef666d4b8 100644 --- a/cmd/flux/get_source_helm.go +++ b/cmd/flux/get_source_helm.go @@ -34,7 +34,7 @@ import ( var getSourceHelmCmd = &cobra.Command{ Use: "helm", Short: "Get HelmRepository source statuses", - Long: withPreviewNote("The get sources helm command prints the status of the HelmRepository sources."), + Long: "The get sources helm command prints the status of the HelmRepository sources.", Example: ` # List all Helm repositories and their status flux get sources helm diff --git a/cmd/flux/reconcile_helmrelease.go b/cmd/flux/reconcile_helmrelease.go index 7d4449e92d..2d5586c2e7 100644 --- a/cmd/flux/reconcile_helmrelease.go +++ b/cmd/flux/reconcile_helmrelease.go @@ -19,11 +19,11 @@ package main import ( "fmt" - sourcev1 "github.com/fluxcd/source-controller/api/v1" "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/types" helmv2 "github.com/fluxcd/helm-controller/api/v2beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var reconcileHrCmd = &cobra.Command{ diff --git a/cmd/flux/reconcile_with_source.go b/cmd/flux/reconcile_with_source.go index ac0a6f159d..92d5b44579 100644 --- a/cmd/flux/reconcile_with_source.go +++ b/cmd/flux/reconcile_with_source.go @@ -10,8 +10,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/pkg/apis/meta" + + "github.com/fluxcd/flux2/v2/internal/utils" ) type reconcileWithSource interface { diff --git a/cmd/flux/stats.go b/cmd/flux/stats.go index fbb9a66f0b..caa24337c6 100644 --- a/cmd/flux/stats.go +++ b/cmd/flux/stats.go @@ -87,14 +87,14 @@ func runStatsCmd(cmd *cobra.Command, args []string) error { Group: sourcev1b2.GroupVersion.Group, }, { - Kind: sourcev1b2.HelmRepositoryKind, - Version: sourcev1b2.GroupVersion.Version, - Group: sourcev1b2.GroupVersion.Group, + Kind: sourcev1.HelmRepositoryKind, + Version: sourcev1.GroupVersion.Version, + Group: sourcev1.GroupVersion.Group, }, { - Kind: sourcev1b2.HelmChartKind, - Version: sourcev1b2.GroupVersion.Version, - Group: sourcev1b2.GroupVersion.Group, + Kind: sourcev1.HelmChartKind, + Version: sourcev1.GroupVersion.Version, + Group: sourcev1.GroupVersion.Group, }, { Kind: sourcev1b2.BucketKind, From 315c53a717623e848da322d56d0c0d226a9d93dd Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Mon, 6 May 2024 15:15:38 +0300 Subject: [PATCH 4/6] Migrate `flux events` to Helm Source API v1 Signed-off-by: Stefan Prodan --- cmd/flux/events.go | 8 ++++---- cmd/flux/reconcile_source_chart.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/flux/events.go b/cmd/flux/events.go index 481f9e79a0..6593d1d2f4 100644 --- a/cmd/flux/events.go +++ b/cmd/flux/events.go @@ -422,7 +422,7 @@ var fluxKindMap = refMap{ gvk: helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind), crossNamespaced: true, otherRefs: func(namespace, name string) []string { - return []string{fmt.Sprintf("%s/%s-%s", sourcev1b2.HelmChartKind, namespace, name)} + return []string{fmt.Sprintf("%s/%s-%s", sourcev1.HelmChartKind, namespace, name)} }, field: []string{"spec", "chart", "spec", "sourceRef"}, }, @@ -440,15 +440,15 @@ var fluxKindMap = refMap{ crossNamespaced: true, field: []string{"spec", "imageRepositoryRef"}, }, - sourcev1b2.HelmChartKind: { - gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.HelmChartKind), + sourcev1.HelmChartKind: { + gvk: sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind), crossNamespaced: true, field: []string{"spec", "sourceRef"}, }, sourcev1.GitRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)}, sourcev1b2.OCIRepositoryKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.OCIRepositoryKind)}, sourcev1b2.BucketKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.BucketKind)}, - sourcev1b2.HelmRepositoryKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.HelmRepositoryKind)}, + sourcev1.HelmRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)}, autov1.ImageUpdateAutomationKind: {gvk: autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)}, imagev1.ImageRepositoryKind: {gvk: imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)}, } diff --git a/cmd/flux/reconcile_source_chart.go b/cmd/flux/reconcile_source_chart.go index 7db4208798..77887b7504 100644 --- a/cmd/flux/reconcile_source_chart.go +++ b/cmd/flux/reconcile_source_chart.go @@ -33,7 +33,7 @@ var reconcileSourceHelmChartCmd = &cobra.Command{ # Trigger a reconciliation of the HelmCharts's source and apply changes flux reconcile helmchart podinfo --with-source`, - ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1b2.HelmChartKind)), + ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)), RunE: reconcileWithSourceCommand{ apiType: helmChartType, object: helmChartAdapter{&sourcev1.HelmChart{}}, From e40961c6d0fad595c070a97492a9fcae52843018 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Mon, 6 May 2024 15:23:30 +0300 Subject: [PATCH 5/6] Migrate `flux trace` to Helm Source API v1 Signed-off-by: Stefan Prodan --- cmd/flux/trace.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/flux/trace.go b/cmd/flux/trace.go index bab5a45724..89094eed6f 100644 --- a/cmd/flux/trace.go +++ b/cmd/flux/trace.go @@ -388,10 +388,10 @@ func traceHelm(ctx context.Context, kubeClient client.Client, hrName types.Names } hrReady := meta.FindStatusCondition(hr.Status.Conditions, fluxmeta.ReadyCondition) - var hrChart *sourcev1b2.HelmChart + var hrChart *sourcev1.HelmChart var hrChartReady *metav1.Condition if chart := hr.Status.HelmChart; chart != "" { - hrChart = &sourcev1b2.HelmChart{} + hrChart = &sourcev1.HelmChart{} err = kubeClient.Get(ctx, utils.ParseNamespacedName(chart), hrChart) if err != nil { return "", fmt.Errorf("failed to find HelmChart: %w", err) @@ -417,10 +417,10 @@ func traceHelm(ctx context.Context, kubeClient client.Client, hrName types.Names hrGitRepositoryReady = meta.FindStatusCondition(hrGitRepository.Status.Conditions, fluxmeta.ReadyCondition) } - var hrHelmRepository *sourcev1b2.HelmRepository + var hrHelmRepository *sourcev1.HelmRepository var hrHelmRepositoryReady *metav1.Condition - if hr.Spec.Chart.Spec.SourceRef.Kind == sourcev1b2.HelmRepositoryKind { - hrHelmRepository = &sourcev1b2.HelmRepository{} + if hr.Spec.Chart.Spec.SourceRef.Kind == sourcev1.HelmRepositoryKind { + hrHelmRepository = &sourcev1.HelmRepository{} sourceNamespace := hr.Namespace if hr.Spec.Chart.Spec.SourceRef.Namespace != "" { sourceNamespace = hr.Spec.Chart.Spec.SourceRef.Namespace @@ -522,11 +522,11 @@ Status: Unknown ObjectNamespace string HelmRelease *helmv2.HelmRelease HelmReleaseReady *metav1.Condition - HelmChart *sourcev1b2.HelmChart + HelmChart *sourcev1.HelmChart HelmChartReady *metav1.Condition GitRepository *sourcev1.GitRepository GitRepositoryReady *metav1.Condition - HelmRepository *sourcev1b2.HelmRepository + HelmRepository *sourcev1.HelmRepository HelmRepositoryReady *metav1.Condition }{ ObjectName: obj.GetKind() + "/" + obj.GetName(), From aae086c50884582240f75f7ab0f6180cdf81c912 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Mon, 6 May 2024 15:43:10 +0300 Subject: [PATCH 6/6] Migrate `flux uninstall` to Helm Source API v1 Signed-off-by: Stefan Prodan --- cmd/flux/delete_source_helm.go | 2 +- internal/flags/helm_chart_source.go | 2 +- internal/flags/helm_chart_source_test.go | 2 +- pkg/bootstrap/bootstrap.go | 2 +- pkg/uninstall/uninstall.go | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/flux/delete_source_helm.go b/cmd/flux/delete_source_helm.go index a5956d872b..b4860fbbff 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/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) var deleteSourceHelmCmd = &cobra.Command{ diff --git a/internal/flags/helm_chart_source.go b/internal/flags/helm_chart_source.go index 1ec99408ca..d55f1914e9 100644 --- a/internal/flags/helm_chart_source.go +++ b/internal/flags/helm_chart_source.go @@ -26,7 +26,7 @@ import ( "github.com/fluxcd/flux2/v2/internal/utils" ) -var supportedHelmChartSourceKinds = []string{sourcev1b2.HelmRepositoryKind, sourcev1.GitRepositoryKind, sourcev1b2.BucketKind} +var supportedHelmChartSourceKinds = []string{sourcev1.HelmRepositoryKind, sourcev1.GitRepositoryKind, sourcev1b2.BucketKind} type HelmChartSource struct { Kind string diff --git a/internal/flags/helm_chart_source_test.go b/internal/flags/helm_chart_source_test.go index 4590c3e9cd..0f4500ae24 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/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) func TestHelmChartSource_Set(t *testing.T) { diff --git a/pkg/bootstrap/bootstrap.go b/pkg/bootstrap/bootstrap.go index bca036275e..3faa921417 100644 --- a/pkg/bootstrap/bootstrap.go +++ b/pkg/bootstrap/bootstrap.go @@ -268,7 +268,7 @@ func objectReconciled(kube client.Client, objKey client.ObjectKey, clientObject func hasRevision(kind string, obj map[string]interface{}, expectedRev string) (bool, error) { var rev string switch kind { - case sourcev1.GitRepositoryKind, sourcev1b2.OCIRepositoryKind, sourcev1b2.BucketKind, sourcev1b2.HelmChartKind: + case sourcev1.GitRepositoryKind, sourcev1b2.OCIRepositoryKind, sourcev1b2.BucketKind, sourcev1.HelmChartKind: rev, _, _ = unstructured.NestedString(obj, "status", "artifact", "revision") case kustomizev1.KustomizationKind: rev, _, _ = unstructured.NestedString(obj, "status", "lastAttemptedRevision") diff --git a/pkg/uninstall/uninstall.go b/pkg/uninstall/uninstall.go index 220666ffc3..298a857d2c 100644 --- a/pkg/uninstall/uninstall.go +++ b/pkg/uninstall/uninstall.go @@ -169,7 +169,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client } } { - var list sourcev1b2.HelmRepositoryList + var list sourcev1.HelmRepositoryList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { for i := range list.Items { r := list.Items[i] @@ -184,7 +184,7 @@ func Finalizers(ctx context.Context, logger log.Logger, kubeClient client.Client } } { - var list sourcev1b2.HelmChartList + var list sourcev1.HelmChartList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { for i := range list.Items { r := list.Items[i]