Merge pull request #4759 from fluxcd/source-helm-api-ga

Update Helm Source APIs to v1 (GA)
pull/4701/head
Stefan Prodan 8 months ago committed by GitHub
commit 214a273f66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -32,7 +32,7 @@ import (
var createSecretHelmCmd = &cobra.Command{ var createSecretHelmCmd = &cobra.Command{
Use: "helm [name]", Use: "helm [name]",
Short: "Create or update a Kubernetes secret for Helm repository authentication", 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 Example: ` # Create a Helm authentication secret on disk and encrypt it with Mozilla SOPS
flux create secret helm repo-auth \ flux create secret helm repo-auth \
--namespace=my-namespace \ --namespace=my-namespace \

@ -22,7 +22,6 @@ import (
"net/url" "net/url"
"os" "os"
"github.com/fluxcd/pkg/apis/meta"
"github.com/spf13/cobra" "github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
@ -32,7 +31,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/fluxcd/pkg/apis/meta"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/flux2/v2/internal/utils"
"github.com/fluxcd/flux2/v2/pkg/manifestgen/sourcesecret" "github.com/fluxcd/flux2/v2/pkg/manifestgen/sourcesecret"
@ -41,8 +41,8 @@ import (
var createSourceHelmCmd = &cobra.Command{ var createSourceHelmCmd = &cobra.Command{
Use: "helm [name]", Use: "helm [name]",
Short: "Create or update a HelmRepository source", 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. 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.`), For private Helm repositories, the basic authentication credentials are stored in a Kubernetes secret.`,
Example: ` # Create a source for an HTTPS public Helm repository Example: ` # Create a source for an HTTPS public Helm repository
flux create source helm podinfo \ flux create source helm podinfo \
--url=https://stefanprodan.github.io/podinfo \ --url=https://stefanprodan.github.io/podinfo \

@ -30,7 +30,8 @@ import (
"github.com/fluxcd/pkg/apis/meta" "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/flags"
"github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/flux2/v2/internal/utils"
@ -79,7 +80,7 @@ var sourceOCIRepositoryArgs = newSourceOCIFlags()
func newSourceOCIFlags() sourceOCIRepositoryFlags { func newSourceOCIFlags() sourceOCIRepositoryFlags {
return 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 ignorePaths = &ignorePathsStr
} }
repository := &sourcev1.OCIRepository{ repository := &sourcev1b2.OCIRepository{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Namespace: *kubeconfigArgs.Namespace, Namespace: *kubeconfigArgs.Namespace,
Labels: sourceLabels, Labels: sourceLabels,
}, },
Spec: sourcev1.OCIRepositorySpec{ Spec: sourcev1b2.OCIRepositorySpec{
Provider: sourceOCIRepositoryArgs.provider.String(), Provider: sourceOCIRepositoryArgs.provider.String(),
URL: sourceOCIRepositoryArgs.url, URL: sourceOCIRepositoryArgs.url,
Insecure: sourceOCIRepositoryArgs.insecure, Insecure: sourceOCIRepositoryArgs.insecure,
Interval: metav1.Duration{ Interval: metav1.Duration{
Duration: createArgs.interval, Duration: createArgs.interval,
}, },
Reference: &sourcev1.OCIRepositoryRef{}, Reference: &sourcev1b2.OCIRepositoryRef{},
Ignore: ignorePaths, Ignore: ignorePaths,
}, },
} }
@ -228,13 +229,13 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
} }
func upsertOCIRepository(ctx context.Context, kubeClient client.Client, func upsertOCIRepository(ctx context.Context, kubeClient client.Client,
ociRepository *sourcev1.OCIRepository) (types.NamespacedName, error) { ociRepository *sourcev1b2.OCIRepository) (types.NamespacedName, error) {
namespacedName := types.NamespacedName{ namespacedName := types.NamespacedName{
Namespace: ociRepository.GetNamespace(), Namespace: ociRepository.GetNamespace(),
Name: ociRepository.GetName(), Name: ociRepository.GetName(),
} }
var existing sourcev1.OCIRepository var existing sourcev1b2.OCIRepository
err := kubeClient.Get(ctx, namespacedName, &existing) err := kubeClient.Get(ctx, namespacedName, &existing)
if err != nil { if err != nil {
if errors.IsNotFound(err) { if errors.IsNotFound(err) {

@ -19,13 +19,13 @@ package main
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var deleteSourceHelmCmd = &cobra.Command{ var deleteSourceHelmCmd = &cobra.Command{
Use: "helm [name]", Use: "helm [name]",
Short: "Delete a HelmRepository source", 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 Example: ` # Delete a Helm repository
flux delete source helm podinfo`, flux delete source helm podinfo`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)),

@ -422,7 +422,7 @@ var fluxKindMap = refMap{
gvk: helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind), gvk: helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind),
crossNamespaced: true, crossNamespaced: true,
otherRefs: func(namespace, name string) []string { 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"}, field: []string{"spec", "chart", "spec", "sourceRef"},
}, },
@ -440,15 +440,15 @@ var fluxKindMap = refMap{
crossNamespaced: true, crossNamespaced: true,
field: []string{"spec", "imageRepositoryRef"}, field: []string{"spec", "imageRepositoryRef"},
}, },
sourcev1b2.HelmChartKind: { sourcev1.HelmChartKind: {
gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.HelmChartKind), gvk: sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind),
crossNamespaced: true, crossNamespaced: true,
field: []string{"spec", "sourceRef"}, field: []string{"spec", "sourceRef"},
}, },
sourcev1.GitRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)}, sourcev1.GitRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)},
sourcev1b2.OCIRepositoryKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.OCIRepositoryKind)}, sourcev1b2.OCIRepositoryKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.OCIRepositoryKind)},
sourcev1b2.BucketKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.BucketKind)}, 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)}, autov1.ImageUpdateAutomationKind: {gvk: autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)},
imagev1.ImageRepositoryKind: {gvk: imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)}, imagev1.ImageRepositoryKind: {gvk: imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)},
} }

@ -21,13 +21,13 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "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{ var exportSourceHelmCmd = &cobra.Command{
Use: "helm [name]", Use: "helm [name]",
Short: "Export HelmRepository sources in YAML format", 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 Example: ` # Export all HelmRepository sources
flux export source helm --all > sources.yaml flux export source helm --all > sources.yaml

@ -54,11 +54,11 @@ var getSourceAllCmd = &cobra.Command{
}, },
{ {
apiType: helmRepositoryType, apiType: helmRepositoryType,
list: &helmRepositoryListAdapter{&sourcev1b2.HelmRepositoryList{}}, list: &helmRepositoryListAdapter{&sourcev1.HelmRepositoryList{}},
}, },
{ {
apiType: helmChartType, apiType: helmChartType,
list: &helmChartListAdapter{&sourcev1b2.HelmChartList{}}, list: &helmChartListAdapter{&sourcev1.HelmChartList{}},
}, },
} }

@ -25,7 +25,7 @@ import (
"golang.org/x/text/language" "golang.org/x/text/language"
"k8s.io/apimachinery/pkg/runtime" "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" "github.com/fluxcd/flux2/v2/internal/utils"
) )
@ -33,7 +33,7 @@ import (
var getSourceHelmChartCmd = &cobra.Command{ var getSourceHelmChartCmd = &cobra.Command{
Use: "chart", Use: "chart",
Short: "Get HelmChart statuses", 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 Example: ` # List all Helm charts and their status
flux get sources chart flux get sources chart

@ -26,7 +26,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "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" "github.com/fluxcd/flux2/v2/internal/utils"
) )
@ -34,7 +34,7 @@ import (
var getSourceHelmCmd = &cobra.Command{ var getSourceHelmCmd = &cobra.Command{
Use: "helm", Use: "helm",
Short: "Get HelmRepository source statuses", 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 Example: ` # List all Helm repositories and their status
flux get sources helm flux get sources helm

@ -23,7 +23,7 @@ import (
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
helmv2 "github.com/fluxcd/helm-controller/api/v2beta2" helmv2 "github.com/fluxcd/helm-controller/api/v2beta2"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var reconcileHrCmd = &cobra.Command{ var reconcileHrCmd = &cobra.Command{
@ -70,7 +70,7 @@ func (obj helmReleaseAdapter) reconcileSource() bool {
func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName) { func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName) {
cmd := reconcileWithSourceCommand{ cmd := reconcileWithSourceCommand{
apiType: helmChartType, apiType: helmChartType,
object: helmChartAdapter{&sourcev1b2.HelmChart{}}, object: helmChartAdapter{&sourcev1.HelmChart{}},
force: true, force: true,
} }

@ -33,10 +33,10 @@ var reconcileSourceHelmChartCmd = &cobra.Command{
# Trigger a reconciliation of the HelmCharts's source and apply changes # Trigger a reconciliation of the HelmCharts's source and apply changes
flux reconcile helmchart podinfo --with-source`, flux reconcile helmchart podinfo --with-source`,
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1b2.GroupVersion.WithKind(sourcev1b2.HelmChartKind)), ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.HelmChartKind)),
RunE: reconcileWithSourceCommand{ RunE: reconcileWithSourceCommand{
apiType: helmChartType, apiType: helmChartType,
object: helmChartAdapter{&sourcev1b2.HelmChart{}}, object: helmChartAdapter{&sourcev1.HelmChart{}},
}.run, }.run,
} }
@ -62,10 +62,10 @@ func (obj helmChartAdapter) reconcileSource() bool {
func (obj helmChartAdapter) getSource() (reconcileSource, types.NamespacedName) { func (obj helmChartAdapter) getSource() (reconcileSource, types.NamespacedName) {
var cmd reconcileCommand var cmd reconcileCommand
switch obj.Spec.SourceRef.Kind { switch obj.Spec.SourceRef.Kind {
case sourcev1b2.HelmRepositoryKind: case sourcev1.HelmRepositoryKind:
cmd = reconcileCommand{ cmd = reconcileCommand{
apiType: helmRepositoryType, apiType: helmRepositoryType,
object: helmRepositoryAdapter{&sourcev1b2.HelmRepository{}}, object: helmRepositoryAdapter{&sourcev1.HelmRepository{}},
} }
case sourcev1.GitRepositoryKind: case sourcev1.GitRepositoryKind:
cmd = reconcileCommand{ cmd = reconcileCommand{

@ -23,7 +23,7 @@ import (
"github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/conditions" "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{ var reconcileSourceHelmCmd = &cobra.Command{

@ -10,8 +10,9 @@ import (
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"github.com/fluxcd/flux2/v2/internal/utils"
"github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/flux2/v2/internal/utils"
) )
type reconcileWithSource interface { type reconcileWithSource interface {

@ -21,7 +21,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var resumeSourceHelmChartCmd = &cobra.Command{ var resumeSourceHelmChartCmd = &cobra.Command{

@ -19,7 +19,7 @@ package main
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var resumeSourceHelmCmd = &cobra.Command{ var resumeSourceHelmCmd = &cobra.Command{

@ -95,16 +95,16 @@ func (a bucketListAdapter) len() int {
return len(a.BucketList.Items) return len(a.BucketList.Items)
} }
// sourcev1b2.HelmChart // sourcev1.HelmChart
var helmChartType = apiType{ var helmChartType = apiType{
kind: sourcev1b2.HelmChartKind, kind: sourcev1.HelmChartKind,
humanKind: "source chart", humanKind: "source chart",
groupVersion: sourcev1b2.GroupVersion, groupVersion: sourcev1.GroupVersion,
} }
type helmChartAdapter struct { type helmChartAdapter struct {
*sourcev1b2.HelmChart *sourcev1.HelmChart
} }
func (a helmChartAdapter) asClientObject() client.Object { func (a helmChartAdapter) asClientObject() client.Object {
@ -115,10 +115,10 @@ func (a helmChartAdapter) deepCopyClientObject() client.Object {
return a.HelmChart.DeepCopy() return a.HelmChart.DeepCopy()
} }
// sourcev1b2.HelmChartList // sourcev1.HelmChartList
type helmChartListAdapter struct { type helmChartListAdapter struct {
*sourcev1b2.HelmChartList *sourcev1.HelmChartList
} }
func (a helmChartListAdapter) asClientList() client.ObjectList { func (a helmChartListAdapter) asClientList() client.ObjectList {
@ -163,16 +163,16 @@ func (a gitRepositoryListAdapter) len() int {
return len(a.GitRepositoryList.Items) return len(a.GitRepositoryList.Items)
} }
// sourcev1b2.HelmRepository // sourcev1.HelmRepository
var helmRepositoryType = apiType{ var helmRepositoryType = apiType{
kind: sourcev1b2.HelmRepositoryKind, kind: sourcev1.HelmRepositoryKind,
humanKind: "source helm", humanKind: "source helm",
groupVersion: sourcev1b2.GroupVersion, groupVersion: sourcev1.GroupVersion,
} }
type helmRepositoryAdapter struct { type helmRepositoryAdapter struct {
*sourcev1b2.HelmRepository *sourcev1.HelmRepository
} }
func (a helmRepositoryAdapter) asClientObject() client.Object { func (a helmRepositoryAdapter) asClientObject() client.Object {
@ -183,10 +183,10 @@ func (a helmRepositoryAdapter) deepCopyClientObject() client.Object {
return a.HelmRepository.DeepCopy() return a.HelmRepository.DeepCopy()
} }
// sourcev1b2.HelmRepositoryList // sourcev1.HelmRepositoryList
type helmRepositoryListAdapter struct { type helmRepositoryListAdapter struct {
*sourcev1b2.HelmRepositoryList *sourcev1.HelmRepositoryList
} }
func (a helmRepositoryListAdapter) asClientList() client.ObjectList { func (a helmRepositoryListAdapter) asClientList() client.ObjectList {

@ -87,14 +87,14 @@ func runStatsCmd(cmd *cobra.Command, args []string) error {
Group: sourcev1b2.GroupVersion.Group, Group: sourcev1b2.GroupVersion.Group,
}, },
{ {
Kind: sourcev1b2.HelmRepositoryKind, Kind: sourcev1.HelmRepositoryKind,
Version: sourcev1b2.GroupVersion.Version, Version: sourcev1.GroupVersion.Version,
Group: sourcev1b2.GroupVersion.Group, Group: sourcev1.GroupVersion.Group,
}, },
{ {
Kind: sourcev1b2.HelmChartKind, Kind: sourcev1.HelmChartKind,
Version: sourcev1b2.GroupVersion.Version, Version: sourcev1.GroupVersion.Version,
Group: sourcev1b2.GroupVersion.Group, Group: sourcev1.GroupVersion.Group,
}, },
{ {
Kind: sourcev1b2.BucketKind, Kind: sourcev1b2.BucketKind,

@ -19,7 +19,7 @@ package main
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var suspendSourceHelmChartCmd = &cobra.Command{ var suspendSourceHelmChartCmd = &cobra.Command{

@ -19,7 +19,7 @@ package main
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var suspendSourceHelmCmd = &cobra.Command{ var suspendSourceHelmCmd = &cobra.Command{

@ -1,5 +1,5 @@
--- ---
apiVersion: source.toolkit.fluxcd.io/v1beta2 apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository kind: HelmRepository
metadata: metadata:
name: podinfo name: podinfo

@ -1,5 +1,5 @@
--- ---
apiVersion: source.toolkit.fluxcd.io/v1beta2 apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository kind: HelmRepository
metadata: metadata:
name: podinfo name: podinfo

@ -1,5 +1,5 @@
--- ---
apiVersion: source.toolkit.fluxcd.io/v1beta2 apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository kind: HelmRepository
metadata: metadata:
name: podinfo name: podinfo

@ -1,5 +1,5 @@
--- ---
apiVersion: source.toolkit.fluxcd.io/v1beta2 apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository kind: HelmRepository
metadata: metadata:
name: flux-system name: flux-system

@ -388,10 +388,10 @@ func traceHelm(ctx context.Context, kubeClient client.Client, hrName types.Names
} }
hrReady := meta.FindStatusCondition(hr.Status.Conditions, fluxmeta.ReadyCondition) hrReady := meta.FindStatusCondition(hr.Status.Conditions, fluxmeta.ReadyCondition)
var hrChart *sourcev1b2.HelmChart var hrChart *sourcev1.HelmChart
var hrChartReady *metav1.Condition var hrChartReady *metav1.Condition
if chart := hr.Status.HelmChart; chart != "" { if chart := hr.Status.HelmChart; chart != "" {
hrChart = &sourcev1b2.HelmChart{} hrChart = &sourcev1.HelmChart{}
err = kubeClient.Get(ctx, utils.ParseNamespacedName(chart), hrChart) err = kubeClient.Get(ctx, utils.ParseNamespacedName(chart), hrChart)
if err != nil { if err != nil {
return "", fmt.Errorf("failed to find HelmChart: %w", err) 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) hrGitRepositoryReady = meta.FindStatusCondition(hrGitRepository.Status.Conditions, fluxmeta.ReadyCondition)
} }
var hrHelmRepository *sourcev1b2.HelmRepository var hrHelmRepository *sourcev1.HelmRepository
var hrHelmRepositoryReady *metav1.Condition var hrHelmRepositoryReady *metav1.Condition
if hr.Spec.Chart.Spec.SourceRef.Kind == sourcev1b2.HelmRepositoryKind { if hr.Spec.Chart.Spec.SourceRef.Kind == sourcev1.HelmRepositoryKind {
hrHelmRepository = &sourcev1b2.HelmRepository{} hrHelmRepository = &sourcev1.HelmRepository{}
sourceNamespace := hr.Namespace sourceNamespace := hr.Namespace
if hr.Spec.Chart.Spec.SourceRef.Namespace != "" { if hr.Spec.Chart.Spec.SourceRef.Namespace != "" {
sourceNamespace = hr.Spec.Chart.Spec.SourceRef.Namespace sourceNamespace = hr.Spec.Chart.Spec.SourceRef.Namespace
@ -522,11 +522,11 @@ Status: Unknown
ObjectNamespace string ObjectNamespace string
HelmRelease *helmv2.HelmRelease HelmRelease *helmv2.HelmRelease
HelmReleaseReady *metav1.Condition HelmReleaseReady *metav1.Condition
HelmChart *sourcev1b2.HelmChart HelmChart *sourcev1.HelmChart
HelmChartReady *metav1.Condition HelmChartReady *metav1.Condition
GitRepository *sourcev1.GitRepository GitRepository *sourcev1.GitRepository
GitRepositoryReady *metav1.Condition GitRepositoryReady *metav1.Condition
HelmRepository *sourcev1b2.HelmRepository HelmRepository *sourcev1.HelmRepository
HelmRepositoryReady *metav1.Condition HelmRepositoryReady *metav1.Condition
}{ }{
ObjectName: obj.GetKind() + "/" + obj.GetName(), ObjectName: obj.GetKind() + "/" + obj.GetName(),

@ -15,7 +15,7 @@ require (
github.com/fluxcd/helm-controller/api v0.37.4 github.com/fluxcd/helm-controller/api v0.37.4
github.com/fluxcd/image-automation-controller/api v0.37.1 github.com/fluxcd/image-automation-controller/api v0.37.1
github.com/fluxcd/image-reflector-controller/api v0.31.2 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/notification-controller/api v1.2.4
github.com/fluxcd/pkg/apis/event v0.9.0 github.com/fluxcd/pkg/apis/event v0.9.0
github.com/fluxcd/pkg/apis/meta v1.5.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/ssh v0.13.0
github.com/fluxcd/pkg/tar v0.7.0 github.com/fluxcd/pkg/tar v0.7.0
github.com/fluxcd/pkg/version v0.4.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-git/go-git/v5 v5.12.0
github.com/go-logr/logr v1.4.1 github.com/go-logr/logr v1.4.1
github.com/gonvenience/bunt v1.3.5 github.com/gonvenience/bunt v1.3.5
@ -58,7 +58,7 @@ require (
k8s.io/cli-runtime v0.30.0 k8s.io/cli-runtime v0.30.0
k8s.io/client-go v0.30.0 k8s.io/client-go v0.30.0
k8s.io/kubectl 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/api v0.17.1
sigs.k8s.io/kustomize/kyaml v0.17.0 sigs.k8s.io/kustomize/kyaml v0.17.0
sigs.k8s.io/yaml v1.4.0 sigs.k8s.io/yaml v1.4.0

@ -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-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 h1:s16ewwfuLBYuh8hENuVgU8SYsSNxRaA4f+AD60/+les=
github.com/fluxcd/image-reflector-controller/api v0.31.2/go.mod h1:tV7g+KXQL3W8w5+fRJU7ubVGc4QAfx1C7XI5qrQvA3U= 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.3.0 h1:IwXkU48lQ/YhU6XULlPXDgQlnpNyQdCNbUvhLdWVIbE=
github.com/fluxcd/kustomize-controller/api v1.2.2/go.mod h1:dfAaPQuuoWfExyWaeO7Kj2ZtfKQ4nDcJrt7AeAFlLZs= 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 h1:H/C8XW5boncf8rzJjSe/MCr186Hgvw+arPat9XOaRlw=
github.com/fluxcd/notification-controller/api v1.2.4/go.mod h1:LeHtKKTI3ew+FXY0oYtYqM68UYOArfBa/cy4pxAzN4M= 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= 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/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 h1:3F6oeIZ+ug/f7pALIBhcUhfURel37EPPOn7nsGfsnOg=
github.com/fluxcd/pkg/version v0.4.0/go.mod h1:izVsSDxac81qWRmpOL9qcxZYx+zAN1ajoP5SidGP6PA= 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.3.0 h1:Z5Lq0aJY87yg0cQDEuwGLKS60GhdErCHtsi546HUt10=
github.com/fluxcd/source-controller/api v1.2.4/go.mod h1:j3QSHpIPBP5sjaGIkVtsgWCx8JcOmcsutRmdJmRMOZg= 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 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= 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= 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/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 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= 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.1 h1:RpWbigmuiylbxOCLy0tGnq1cU1qWPwNIQzoJk+QeJx4=
sigs.k8s.io/controller-runtime v0.18.0/go.mod h1:tuAt1+wbVsXIT8lPtk5RURxqAnq7xkpv2Mhttslg7Hw= 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 h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= 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= sigs.k8s.io/kustomize/api v0.17.1 h1:MYJBOP/yQ3/5tp4/sf6HiiMfNNyO97LmtnirH9SLNr4=

@ -26,7 +26,7 @@ import (
"github.com/fluxcd/flux2/v2/internal/utils" "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 { type HelmChartSource struct {
Kind string Kind string

@ -23,7 +23,7 @@ import (
"fmt" "fmt"
"testing" "testing"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
func TestHelmChartSource_Set(t *testing.T) { func TestHelmChartSource_Set(t *testing.T) {

@ -1,8 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: 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.3.0/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.deployment.yaml
- account.yaml - account.yaml
transformers: transformers:
- labels.yaml - labels.yaml

@ -1,8 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: 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.3.0/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.deployment.yaml
- account.yaml - account.yaml
transformers: transformers:
- labels.yaml - labels.yaml

@ -1,8 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: 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.3.0/source-controller.crds.yaml
- https://github.com/fluxcd/kustomize-controller/releases/download/v1.2.2/kustomize-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/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/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 - https://github.com/fluxcd/image-reflector-controller/releases/download/v0.31.2/image-reflector-controller.crds.yaml

@ -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) { func hasRevision(kind string, obj map[string]interface{}, expectedRev string) (bool, error) {
var rev string var rev string
switch kind { 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") rev, _, _ = unstructured.NestedString(obj, "status", "artifact", "revision")
case kustomizev1.KustomizationKind: case kustomizev1.KustomizationKind:
rev, _, _ = unstructured.NestedString(obj, "status", "lastAttemptedRevision") rev, _, _ = unstructured.NestedString(obj, "status", "lastAttemptedRevision")

@ -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 { if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
for i := range list.Items { for i := range list.Items {
r := list.Items[i] 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 { if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {
for i := range list.Items { for i := range list.Items {
r := list.Items[i] r := list.Items[i]

Loading…
Cancel
Save