Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fluxcd/kustomize-controller
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.15.2
Choose a base ref
...
head repository: fluxcd/kustomize-controller
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.15.3
Choose a head ref
  • 4 commits
  • 6 files changed
  • 1 contributor

Commits on Oct 11, 2021

  1. Fix drift detection in Secrets and ConfigMaps

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Oct 11, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    stefanprodan Stefan Prodan
    Copy the full SHA
    a292f28 View commit details
  2. Merge pull request #451 from fluxcd/ssa-fix-diff

    Fix drift detection in Secrets and ConfigMaps
    stefanprodan authored Oct 11, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    57c6302 View commit details
  3. Release v0.15.3

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Oct 11, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    stefanprodan Stefan Prodan
    Copy the full SHA
    aae8cbd View commit details
  4. Merge pull request #452 from fluxcd/release-v0.15.3

    Release v0.15.3
    stefanprodan authored Oct 11, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7ecf6fd View commit details
Showing with 35 additions and 8 deletions.
  1. +10 −0 CHANGELOG.md
  2. +1 −1 config/manager/kustomization.yaml
  3. +4 −3 controllers/kustomization_controller.go
  4. +16 −0 controllers/kustomization_decryptor_test.go
  5. +2 −2 go.mod
  6. +2 −2 go.sum
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,16 @@

All notable changes to this project are documented in this file.

## 0.15.3

**Release date:** 2021-10-11

This prerelease comes with fixes for drift detection in Secrets and ConfigMaps.

Fixes:
* Fix drift detection in Secrets and ConfigMaps
[#451](https://github.com/fluxcd/kustomize-controller/pull/451)

## 0.15.2

**Release date:** 2021-10-10
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -5,4 +5,4 @@ resources:
images:
- name: fluxcd/kustomize-controller
newName: fluxcd/kustomize-controller
newTag: v0.15.2
newTag: v0.15.3
7 changes: 4 additions & 3 deletions controllers/kustomization_controller.go
Original file line number Diff line number Diff line change
@@ -611,6 +611,10 @@ func (r *KustomizationReconciler) build(ctx context.Context, kustomization kusto
func (r *KustomizationReconciler) apply(ctx context.Context, manager *ssa.ResourceManager, kustomization kustomizev1.Kustomization, revision string, objects []*unstructured.Unstructured) (bool, error) {
log := logr.FromContext(ctx)

if err := ssa.SetNativeKindsDefaults(objects); err != nil {
return false, err
}

// contains only CRDs and Namespaces
var stageOne []*unstructured.Unstructured

@@ -651,9 +655,6 @@ func (r *KustomizationReconciler) apply(ctx context.Context, manager *ssa.Resour
// sort by kind, validate and apply all the others objects
sort.Sort(ssa.SortableUnstructureds(stageTwo))
if len(stageTwo) > 0 {
if err := ssa.SetNativeKindsDefaults(stageTwo); err != nil {
return false, err
}
changeSet, err := manager.ApplyAll(ctx, stageTwo, kustomization.Spec.Force)
if err != nil {
return false, fmt.Errorf("%w\n%s", err, changeSetLog.String())
16 changes: 16 additions & 0 deletions controllers/kustomization_decryptor_test.go
Original file line number Diff line number Diff line change
@@ -138,4 +138,20 @@ func TestKustomizationReconciler_Decryptor(t *testing.T) {
g.Expect(string(encodedSecret.Data["month.yaml"])).To(Equal("month: May\n"))
})

t.Run("does not emit change events for identical secrets", func(t *testing.T) {
resultK := &kustomizev1.Kustomization{}
revision := "v2.0.0"
err = applyGitRepository(repositoryName, artifactURL, revision, artifactChecksum+"v2")
g.Expect(err).NotTo(HaveOccurred())

g.Eventually(func() bool {
_ = k8sClient.Get(context.Background(), client.ObjectKeyFromObject(kustomization), resultK)
return resultK.Status.LastAttemptedRevision == revision
}, timeout, time.Second).Should(BeTrue())

events := getEvents(resultK.GetName(), map[string]string{"kustomize.toolkit.fluxcd.io/revision": revision})
g.Expect(len(events)).To(BeIdenticalTo(1))
g.Expect(events[0].Message).Should(ContainSubstring("Reconciliation finished"))
g.Expect(events[0].Message).ShouldNot(ContainSubstring("configured"))
})
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -8,11 +8,11 @@ require (
filippo.io/age v1.0.0
github.com/cyphar/filepath-securejoin v0.2.2
github.com/drone/envsubst v1.0.3-0.20200804185402-58bc65f69603
github.com/fluxcd/kustomize-controller/api v0.15.2
github.com/fluxcd/kustomize-controller/api v0.15.3
github.com/fluxcd/pkg/apis/kustomize v0.2.0
github.com/fluxcd/pkg/apis/meta v0.10.1
github.com/fluxcd/pkg/runtime v0.12.2
github.com/fluxcd/pkg/ssa v0.0.3
github.com/fluxcd/pkg/ssa v0.0.5
github.com/fluxcd/pkg/testserver v0.1.0
github.com/fluxcd/pkg/untar v0.1.0
github.com/fluxcd/source-controller/api v0.16.0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -218,8 +218,8 @@ github.com/fluxcd/pkg/apis/meta v0.10.1/go.mod h1:yUblM2vg+X8TE3A2VvJfdhkGmg+uqB
github.com/fluxcd/pkg/runtime v0.12.0/go.mod h1:EyaTR2TOYcjL5U//C4yH3bt2tvTgIOSXpVRbWxUn/C4=
github.com/fluxcd/pkg/runtime v0.12.2 h1:4iOpx2j/w15kNemDOnZrF6ugJ/rhSmRu7aI+xn23+BI=
github.com/fluxcd/pkg/runtime v0.12.2/go.mod h1:tuWdqpWPhgjQvYrSnojdZ4plyU8DRU1NDzsfOhnzl2g=
github.com/fluxcd/pkg/ssa v0.0.3 h1:5s/dZIaJGtI/46w5VRmr5sy/jNJGpxPnSad8oSzAbkc=
github.com/fluxcd/pkg/ssa v0.0.3/go.mod h1:B/6V2gF3zq3P6EstM/qTmOEUf3YgOh1ybFfAAmG4Shw=
github.com/fluxcd/pkg/ssa v0.0.5 h1:WA8ShFeRTOLa8A1QZMyzIPygeMmHufkJhs1IpHEwX5w=
github.com/fluxcd/pkg/ssa v0.0.5/go.mod h1:B/6V2gF3zq3P6EstM/qTmOEUf3YgOh1ybFfAAmG4Shw=
github.com/fluxcd/pkg/testserver v0.1.0 h1:nOYgM1HYFZNNSUFykuWDmrsxj4jQxUCvmLHWOQeqmyA=
github.com/fluxcd/pkg/testserver v0.1.0/go.mod h1:fvt8BHhXw6c1+CLw1QFZxcQprlcXzsrL4rzXaiGM+Iw=
github.com/fluxcd/pkg/untar v0.1.0 h1:k97V/xV5hFrAkIkVPuv5AVhyxh1ZzzAKba/lbDfGo6o=