From bba569c1f985bbcebae8992963a9cec9555a5626 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Thu, 30 Mar 2023 15:53:15 +0200 Subject: [PATCH 1/2] Update dependencies - github.com/fluxcd/pkg/ssa to v0.27.0 - github.com/go-logr/logr to v1.2.4 - github.com/onsi/gomega to v1.27.6 Signed-off-by: Hidde Beydals --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 7d7c1bbf5..bbf26eb05 100644 --- a/go.mod +++ b/go.mod @@ -11,12 +11,12 @@ require ( github.com/fluxcd/pkg/apis/kustomize v1.0.0 github.com/fluxcd/pkg/apis/meta v1.0.0 github.com/fluxcd/pkg/runtime v0.35.0 - github.com/fluxcd/pkg/ssa v0.26.0 + github.com/fluxcd/pkg/ssa v0.27.0 github.com/fluxcd/source-controller/api v0.36.1 - github.com/go-logr/logr v1.2.3 + github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/hashicorp/go-retryablehttp v0.7.2 - github.com/onsi/gomega v1.27.5 + github.com/onsi/gomega v1.27.6 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/go-digest/blake3 v0.0.0-20220411205349-bde1400a84be github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index e4fe2367e..6a9597a78 100644 --- a/go.sum +++ b/go.sum @@ -179,8 +179,8 @@ github.com/fluxcd/pkg/apis/meta v1.0.0 h1:i9IGHd/VNEZELX7mepkiYFbJxs2J5znaB4cN9z github.com/fluxcd/pkg/apis/meta v1.0.0/go.mod h1:04ZdpZYm1x+aL93K4daNHW1UX6E8K7Gyf5za9OhrE+U= github.com/fluxcd/pkg/runtime v0.35.0 h1:9PYLcul8qdfLYQArcYpHe/QuMqyhAGGFN9F7uY/QVX4= github.com/fluxcd/pkg/runtime v0.35.0/go.mod h1:sAaSTH8RHj3Y99xj0AtAndDTe5cv0DP4enyLV62EO78= -github.com/fluxcd/pkg/ssa v0.26.0 h1:xqAPF9wA4a3HVeUL1bMsrk1pJDjo5IEqL3+Vjts6vTM= -github.com/fluxcd/pkg/ssa v0.26.0/go.mod h1:GEzdW/IkhD/EGvhRerwipp5IrLVkWjhVFsB4Y7MnnMI= +github.com/fluxcd/pkg/ssa v0.27.0 h1:BJnWDy3xDtYD2U+sVZPkoh6PfnQKoXsklO0pzojU8XU= +github.com/fluxcd/pkg/ssa v0.27.0/go.mod h1:fxvmVf4FxodJi5lTglMcL8JsF6hfJLG99C56/CgchH0= github.com/fluxcd/source-controller/api v0.36.1 h1:/ul69kJNEwrFG1Cwk2P/GwgraIxOETCL+tP+zMtxTu8= github.com/fluxcd/source-controller/api v0.36.1/go.mod h1:GktZmd5Dfxo84vPFBdLDl0bBtiJRODfd47uugK0romU= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= @@ -207,8 +207,8 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= @@ -506,8 +506,8 @@ github.com/nelsam/hel/v2 v2.3.3/go.mod h1:1ZTGfU2PFTOd5mx22i5O0Lc2GY933lQ2wb/ggy github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= -github.com/onsi/gomega v1.27.5 h1:T/X6I0RNFw/kTqgfkZPcQ5KU6vCnWNBGdtrIx2dpGeQ= -github.com/onsi/gomega v1.27.5/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= +github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= github.com/opencontainers/go-digest v1.0.1-0.20220411205349-bde1400a84be h1:f2PlhC9pm5sqpBZFvnAoKj+KzXRzbjFMA+TqXfJdgho= github.com/opencontainers/go-digest v1.0.1-0.20220411205349-bde1400a84be/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/go-digest/blake3 v0.0.0-20220411205349-bde1400a84be h1:yJISmqboKE7zWqC2Nlg3pBkelqCblzZBoMHv2nbrUjQ= From 2de972cb8f9c74a0d51709e2334541e4ded18aae Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Thu, 30 Mar 2023 16:13:10 +0200 Subject: [PATCH 2/2] Update to source-controller v1.0.0-rc.1 Signed-off-by: Hidde Beydals --- config/default/kustomization.yaml | 4 +-- go.mod | 2 +- go.sum | 4 +-- .../helmrelease_controller_chart.go | 31 ++++++++++--------- internal/controllers/source_predicate.go | 2 +- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index b19b4e50c..b5fa652be 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -2,8 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: helm-system resources: -- https://github.com/fluxcd/source-controller/releases/download/v0.36.1/source-controller.crds.yaml -- https://github.com/fluxcd/source-controller/releases/download/v0.36.1/source-controller.deployment.yaml +- https://github.com/fluxcd/source-controller/releases/download/v1.0.0-rc.1/source-controller.crds.yaml +- https://github.com/fluxcd/source-controller/releases/download/v1.0.0-rc.1/source-controller.deployment.yaml - ../crd - ../rbac - ../manager diff --git a/go.mod b/go.mod index bbf26eb05..d03b85186 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/fluxcd/pkg/apis/meta v1.0.0 github.com/fluxcd/pkg/runtime v0.35.0 github.com/fluxcd/pkg/ssa v0.27.0 - github.com/fluxcd/source-controller/api v0.36.1 + github.com/fluxcd/source-controller/api v1.0.0-rc.1 github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/hashicorp/go-retryablehttp v0.7.2 diff --git a/go.sum b/go.sum index 6a9597a78..d0d16888c 100644 --- a/go.sum +++ b/go.sum @@ -181,8 +181,8 @@ github.com/fluxcd/pkg/runtime v0.35.0 h1:9PYLcul8qdfLYQArcYpHe/QuMqyhAGGFN9F7uY/ github.com/fluxcd/pkg/runtime v0.35.0/go.mod h1:sAaSTH8RHj3Y99xj0AtAndDTe5cv0DP4enyLV62EO78= github.com/fluxcd/pkg/ssa v0.27.0 h1:BJnWDy3xDtYD2U+sVZPkoh6PfnQKoXsklO0pzojU8XU= github.com/fluxcd/pkg/ssa v0.27.0/go.mod h1:fxvmVf4FxodJi5lTglMcL8JsF6hfJLG99C56/CgchH0= -github.com/fluxcd/source-controller/api v0.36.1 h1:/ul69kJNEwrFG1Cwk2P/GwgraIxOETCL+tP+zMtxTu8= -github.com/fluxcd/source-controller/api v0.36.1/go.mod h1:GktZmd5Dfxo84vPFBdLDl0bBtiJRODfd47uugK0romU= +github.com/fluxcd/source-controller/api v1.0.0-rc.1 h1:MZaP5utClMG95Aw/AVu1l05WEfmpEw/RIlCLnkCQl14= +github.com/fluxcd/source-controller/api v1.0.0-rc.1/go.mod h1:CvGNdS8g/MqwpERUK6aJp4lndsrm+JBzGpoyyZ4u0c8= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= diff --git a/internal/controllers/helmrelease_controller_chart.go b/internal/controllers/helmrelease_controller_chart.go index 532e56959..893816d5a 100644 --- a/internal/controllers/helmrelease_controller_chart.go +++ b/internal/controllers/helmrelease_controller_chart.go @@ -40,12 +40,13 @@ import ( "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" + sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2" v2 "github.com/fluxcd/helm-controller/api/v2beta1" ) -func (r *HelmReleaseReconciler) reconcileChart(ctx context.Context, hr *v2.HelmRelease) (*sourcev1.HelmChart, error) { +func (r *HelmReleaseReconciler) reconcileChart(ctx context.Context, hr *v2.HelmRelease) (*sourcev1b2.HelmChart, error) { chartName := types.NamespacedName{ Namespace: hr.Spec.Chart.GetNamespace(hr.Namespace), Name: hr.GetHelmChartName(), @@ -67,7 +68,7 @@ func (r *HelmReleaseReconciler) reconcileChart(ctx context.Context, hr *v2.HelmR } // Continue with the reconciliation of the current template. - var helmChart sourcev1.HelmChart + var helmChart sourcev1b2.HelmChart err := r.Client.Get(ctx, chartName, &helmChart) if err != nil && !apierrors.IsNotFound(err) { return nil, err @@ -81,7 +82,7 @@ func (r *HelmReleaseReconciler) reconcileChart(ctx context.Context, hr *v2.HelmR hr.Status.HelmChart = chartName.String() return hc, nil case helmChartRequiresUpdate(hr, &helmChart): - ctrl.LoggerFrom(ctx).Info("chart diverged from template", strings.ToLower(sourcev1.HelmChartKind), chartName.String()) + ctrl.LoggerFrom(ctx).Info("chart diverged from template", strings.ToLower(sourcev1b2.HelmChartKind), chartName.String()) helmChart.Spec = hc.Spec helmChart.Labels = hc.Labels helmChart.Annotations = hc.Annotations @@ -97,9 +98,9 @@ func (r *HelmReleaseReconciler) reconcileChart(ctx context.Context, hr *v2.HelmR // getHelmChart retrieves the v1beta2.HelmChart for the given // v2beta1.HelmRelease using the name that is advertised in the status // object. It returns the v1beta2.HelmChart, or an error. -func (r *HelmReleaseReconciler) getHelmChart(ctx context.Context, hr *v2.HelmRelease) (*sourcev1.HelmChart, error) { +func (r *HelmReleaseReconciler) getHelmChart(ctx context.Context, hr *v2.HelmRelease) (*sourcev1b2.HelmChart, error) { namespace, name := hr.Status.GetHelmChart() - hc := &sourcev1.HelmChart{} + hc := &sourcev1b2.HelmChart{} if err := r.Client.Get(ctx, types.NamespacedName{Namespace: namespace, Name: name}, hc); err != nil { return nil, err } @@ -109,7 +110,7 @@ func (r *HelmReleaseReconciler) getHelmChart(ctx context.Context, hr *v2.HelmRel // loadHelmChart attempts to download the artifact from the provided source, // loads it into a chart.Chart, and removes the downloaded artifact. // It returns the loaded chart.Chart on success, or an error. -func (r *HelmReleaseReconciler) loadHelmChart(source *sourcev1.HelmChart) (*chart.Chart, error) { +func (r *HelmReleaseReconciler) loadHelmChart(source *sourcev1b2.HelmChart) (*chart.Chart, error) { f, err := os.CreateTemp("", fmt.Sprintf("%s-%s-*.tgz", source.GetNamespace(), source.GetName())) if err != nil { return nil, err @@ -174,7 +175,7 @@ func (r *HelmReleaseReconciler) deleteHelmChart(ctx context.Context, hr *v2.Helm if hr.Status.HelmChart == "" { return nil } - var hc sourcev1.HelmChart + var hc sourcev1b2.HelmChart chartNS, chartName := hr.Status.GetHelmChart() err := r.Client.Get(ctx, types.NamespacedName{Namespace: chartNS, Name: chartName}, &hc) if err != nil { @@ -196,19 +197,19 @@ func (r *HelmReleaseReconciler) deleteHelmChart(ctx context.Context, hr *v2.Helm // buildHelmChartFromTemplate builds a v1beta2.HelmChart from the // v2beta1.HelmChartTemplate of the given v2beta1.HelmRelease. -func buildHelmChartFromTemplate(hr *v2.HelmRelease) *sourcev1.HelmChart { +func buildHelmChartFromTemplate(hr *v2.HelmRelease) *sourcev1b2.HelmChart { template := hr.Spec.Chart - return &sourcev1.HelmChart{ + return &sourcev1b2.HelmChart{ ObjectMeta: metav1.ObjectMeta{ Name: hr.GetHelmChartName(), Namespace: hr.Spec.Chart.GetNamespace(hr.Namespace), Labels: hr.Spec.Chart.ObjectMeta.Labels, Annotations: hr.Spec.Chart.ObjectMeta.Annotations, }, - Spec: sourcev1.HelmChartSpec{ + Spec: sourcev1b2.HelmChartSpec{ Chart: template.Spec.Chart, Version: template.Spec.Version, - SourceRef: sourcev1.LocalHelmChartSourceReference{ + SourceRef: sourcev1b2.LocalHelmChartSourceReference{ Name: template.Spec.SourceRef.Name, Kind: template.Spec.SourceRef.Kind, }, @@ -224,7 +225,7 @@ func buildHelmChartFromTemplate(hr *v2.HelmRelease) *sourcev1.HelmChart { // helmChartRequiresUpdate compares the v2beta1.HelmChartTemplate of the // v2beta1.HelmRelease to the given v1beta2.HelmChart to determine if an // update is required. -func helmChartRequiresUpdate(hr *v2.HelmRelease, chart *sourcev1.HelmChart) bool { +func helmChartRequiresUpdate(hr *v2.HelmRelease, chart *sourcev1b2.HelmChart) bool { template := hr.Spec.Chart switch { case template.Spec.Chart != chart.Spec.Chart: @@ -257,12 +258,12 @@ func helmChartRequiresUpdate(hr *v2.HelmRelease, chart *sourcev1.HelmChart) bool } // templateVerificationToSourceVerification converts the HelmChartTemplateVerification to the OCIRepositoryVerification. -func templateVerificationToSourceVerification(template *v2.HelmChartTemplateVerification) *sourcev1.OCIRepositoryVerification { +func templateVerificationToSourceVerification(template *v2.HelmChartTemplateVerification) *sourcev1b2.OCIRepositoryVerification { if template == nil { return nil } - return &sourcev1.OCIRepositoryVerification{ + return &sourcev1b2.OCIRepositoryVerification{ Provider: template.Provider, SecretRef: template.SecretRef, } diff --git a/internal/controllers/source_predicate.go b/internal/controllers/source_predicate.go index 48a730087..9d7583fed 100644 --- a/internal/controllers/source_predicate.go +++ b/internal/controllers/source_predicate.go @@ -20,7 +20,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/event" "sigs.k8s.io/controller-runtime/pkg/predicate" - sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" + sourcev1 "github.com/fluxcd/source-controller/api/v1" ) type SourceRevisionChangePredicate struct {