diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 871b584a..0a47b4d6 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -2,8 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: kustomize-system resources: -- https://github.com/fluxcd/source-controller/releases/download/v0.34.0/source-controller.crds.yaml -- https://github.com/fluxcd/source-controller/releases/download/v0.34.0/source-controller.deployment.yaml +- https://github.com/fluxcd/source-controller/releases/download/v0.35.1/source-controller.crds.yaml +- https://github.com/fluxcd/source-controller/releases/download/v0.35.1/source-controller.deployment.yaml - ../crd - ../rbac - ../manager diff --git a/controllers/kustomization_controller.go b/controllers/kustomization_controller.go index 60355927..223850b9 100644 --- a/controllers/kustomization_controller.go +++ b/controllers/kustomization_controller.go @@ -293,10 +293,8 @@ func (r *KustomizationReconciler) reconcile( src sourcev1.Source, patcher *patch.SerialPatcher) error { - revision := src.GetArtifact().Revision - isNewRevision := obj.Status.LastAppliedRevision != revision - // Update status with the reconciliation progress. + revision := src.GetArtifact().Revision progressingMsg := fmt.Sprintf("Fetching manifests for revision %s with a timeout of %s", revision, obj.GetTimeout().String()) conditions.MarkUnknown(obj, meta.ReadyCondition, meta.ProgressingReason, "Reconciliation in progress") conditions.MarkReconciling(obj, meta.ProgressingReason, progressingMsg) @@ -439,6 +437,7 @@ func (r *KustomizationReconciler) reconcile( } // Run the health checks for the last applied resources. + isNewRevision := !src.GetArtifact().HasRevision(obj.Status.LastAppliedRevision) if err := r.checkHealth(ctx, resourceManager, patcher, @@ -491,7 +490,7 @@ func (r *KustomizationReconciler) checkDependencies(ctx context.Context, if k.Spec.SourceRef.Name == obj.Spec.SourceRef.Name && k.Spec.SourceRef.Namespace == obj.Spec.SourceRef.Namespace && k.Spec.SourceRef.Kind == obj.Spec.SourceRef.Kind && - source.GetArtifact().Revision != k.Status.LastAppliedRevision { + !source.GetArtifact().HasRevision(k.Status.LastAppliedRevision) { return fmt.Errorf("dependency '%s' revision is not up to date", dName) } } diff --git a/controllers/kustomization_indexers.go b/controllers/kustomization_indexers.go index 0801b080..d8239c02 100644 --- a/controllers/kustomization_indexers.go +++ b/controllers/kustomization_indexers.go @@ -52,7 +52,7 @@ func (r *KustomizationReconciler) requestsForRevisionChangeOf(indexKey string) f for _, d := range list.Items { // If the revision of the artifact equals to the last attempted revision, // we should not make a request for this Kustomization - if repo.GetArtifact().Revision == d.Status.LastAttemptedRevision { + if repo.GetArtifact().HasRevision(d.Status.LastAttemptedRevision) { continue } dd = append(dd, d.DeepCopy()) diff --git a/controllers/source_predicate.go b/controllers/source_predicate.go index 1909f05f..3d27cf2f 100644 --- a/controllers/source_predicate.go +++ b/controllers/source_predicate.go @@ -47,7 +47,7 @@ func (SourceRevisionChangePredicate) Update(e event.UpdateEvent) bool { } if oldSource.GetArtifact() != nil && newSource.GetArtifact() != nil && - oldSource.GetArtifact().Revision != newSource.GetArtifact().Revision { + !oldSource.GetArtifact().HasRevision(newSource.GetArtifact().Revision) { return true } diff --git a/go.mod b/go.mod index 5081aeb5..e151b84f 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/fluxcd/pkg/ssa v0.23.1 github.com/fluxcd/pkg/tar v0.2.0 github.com/fluxcd/pkg/testserver v0.4.0 - github.com/fluxcd/source-controller/api v0.34.0 + github.com/fluxcd/source-controller/api v0.35.1 github.com/hashicorp/vault/api v1.9.0 github.com/onsi/gomega v1.26.0 github.com/ory/dockertest/v3 v3.9.1 diff --git a/go.sum b/go.sum index d671449f..b1f0deb1 100644 --- a/go.sum +++ b/go.sum @@ -232,8 +232,8 @@ github.com/fluxcd/pkg/tar v0.2.0 h1:HEUHgONQYsJGeZZ4x6h5nQU9Aox1I4T3bOp1faWTqf8= github.com/fluxcd/pkg/tar v0.2.0/go.mod h1:w0/TOC7kwBJhnSJn7TCABkc/I7ib1f2Yz6vOsbLBnhw= github.com/fluxcd/pkg/testserver v0.4.0 h1:pDZ3gistqYhwlf3sAjn1Q8NzN4Qe6I1BEmHMHi46lMg= github.com/fluxcd/pkg/testserver v0.4.0/go.mod h1:gjOKX41okmrGYOa4oOF2fiLedDAfPo1XaG/EzrUUGBI= -github.com/fluxcd/source-controller/api v0.34.0 h1:M2kD95IdpmHcDNy78K6T6p7niC38LGwSrKq8XAZEJY0= -github.com/fluxcd/source-controller/api v0.34.0/go.mod h1:w3PDdR+FZyq3zyyUDxz6vY3CKByZfYAjkzJUxuUXCuc= +github.com/fluxcd/source-controller/api v0.35.1 h1:IHlbN7giz5kY4z9oWZ9QLNKtHAaxHdk9RbIurUPS1aI= +github.com/fluxcd/source-controller/api v0.35.1/go.mod h1:TImPMy/MEwNpDu6qHsw9LlCznXaB8bSO8mnxBSFsX4Q= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=