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.24.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.24.3
Choose a head ref
  • 8 commits
  • 8 files changed
  • 4 contributors

Commits on Apr 21, 2022

  1. feat: flags to configure exponential backoff retry

    Signed-off-by: York Chen <ychen@d2iq.com>
    York Chen committed Apr 21, 2022

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    827f814 View commit details

Commits on Apr 22, 2022

  1. Ensure generated temp dir is absolute on all OSes

    Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
    Sanskar Jaiswal authored and hiddeco committed Apr 22, 2022

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    d499ed8 View commit details
  2. Merge pull request #630 from aryan9600/fix-tmp-dir-macos

    Ensure generated temp dir is absolute on all OSes
    hiddeco authored Apr 22, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5d10770 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cda51fe View commit details
  4. Update source-controller to v0.24.1

    Signed-off-by: Hidde Beydals <hello@hidde.co>
    hiddeco committed Apr 22, 2022

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    0cc81fc View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4c7b436 View commit details
  6. Release v0.24.3

    Signed-off-by: Hidde Beydals <hello@hidde.co>
    hiddeco committed Apr 22, 2022

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    f298671 View commit details
  7. Merge pull request #633 from fluxcd/release-v0.24.3

    Release v0.24.3
    hiddeco authored Apr 22, 2022

    Verified

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

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

## 0.24.3

**Release date:** 2022-04-22

This prerelease allows for configuring the exponential back-off retry, already
introduced in other Flux controllers. It can be configured with the new flags:
`--min-retry-delay` (default: `750ms`) and `--max-retry-delay`
(default: `15min`). Previously the defaults were set to `5ms` and `1000s`.

Fixes:
- Ensure generated temp dir is absolute on all OSes
[#630](https://github.com/fluxcd/kustomize-controller/pull/630)

Improvements:
- feat: flags to configure exponential backoff retry
[#631](https://github.com/fluxcd/kustomize-controller/pull/631)
- Update source-controller to v0.24.1
[#632](https://github.com/fluxcd/kustomize-controller/pull/632)

## 0.24.2

**Release date:** 2022-04-21
4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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.24.0/source-controller.crds.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.24.0/source-controller.deployment.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.24.1/source-controller.crds.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.24.1/source-controller.deployment.yaml
- ../crd
- ../rbac
- ../manager
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.24.2
newTag: v0.24.3
9 changes: 7 additions & 2 deletions controllers/kustomization_controller.go
Original file line number Diff line number Diff line change
@@ -50,6 +50,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/ratelimiter"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"

@@ -96,6 +97,7 @@ type KustomizationReconcilerOptions struct {
MaxConcurrentReconciles int
HTTPRetry int
DependencyRequeueInterval time.Duration
RateLimiter ratelimiter.RateLimiter
}

func (r *KustomizationReconciler) SetupWithManager(mgr ctrl.Manager, opts KustomizationReconcilerOptions) error {
@@ -142,7 +144,10 @@ func (r *KustomizationReconciler) SetupWithManager(mgr ctrl.Manager, opts Kustom
handler.EnqueueRequestsFromMapFunc(r.requestsForRevisionChangeOf(bucketIndexKey)),
builder.WithPredicates(SourceRevisionChangePredicate{}),
).
WithOptions(controller.Options{MaxConcurrentReconciles: opts.MaxConcurrentReconciles}).
WithOptions(controller.Options{
MaxConcurrentReconciles: opts.MaxConcurrentReconciles,
RateLimiter: opts.RateLimiter,
}).
Complete(r)
}

@@ -300,7 +305,7 @@ func (r *KustomizationReconciler) reconcile(
revision := source.GetArtifact().Revision

// create tmp dir
tmpDir, err := os.MkdirTemp("", "kustomization-")
tmpDir, err := MkdirTempAbs("", "kustomization-")
if err != nil {
err = fmt.Errorf("tmp dir error: %w", err)
return kustomizev1.KustomizationNotReady(
38 changes: 38 additions & 0 deletions controllers/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright 2022 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package controllers

import (
"fmt"
"os"
"path/filepath"
)

// MkdirTempAbs creates a tmp dir and returns the absolute path to the dir.
// This is required since certain OSes like MacOS create temporary files in
// e.g. `/private/var`, to which `/var` is a symlink.
func MkdirTempAbs(dir, pattern string) (string, error) {
tmpDir, err := os.MkdirTemp(dir, pattern)
if err != nil {
return "", err
}
tmpDir, err = filepath.EvalSymlinks(tmpDir)
if err != nil {
return "", fmt.Errorf("error evaluating symlink: %w", err)
}
return tmpDir, nil
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ require (
github.com/cyphar/filepath-securejoin v0.2.3
github.com/dimchansky/utfbom v1.1.1
github.com/drone/envsubst v1.0.3
github.com/fluxcd/kustomize-controller/api v0.24.2
github.com/fluxcd/kustomize-controller/api v0.24.3
github.com/fluxcd/pkg/apis/acl v0.0.3
github.com/fluxcd/pkg/apis/kustomize v0.3.3
github.com/fluxcd/pkg/apis/meta v0.12.2
@@ -21,7 +21,7 @@ require (
github.com/fluxcd/pkg/ssa v0.15.2
github.com/fluxcd/pkg/testserver v0.2.0
github.com/fluxcd/pkg/untar v0.1.0
github.com/fluxcd/source-controller/api v0.24.0
github.com/fluxcd/source-controller/api v0.24.1
github.com/hashicorp/go-retryablehttp v0.7.1
github.com/hashicorp/vault/api v1.5.0
github.com/onsi/gomega v1.19.0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -286,8 +286,8 @@ github.com/fluxcd/pkg/testserver v0.2.0 h1:Mj0TapmKaywI6Fi5wvt1LAZpakUHmtzWQpJNK
github.com/fluxcd/pkg/testserver v0.2.0/go.mod h1:bgjjydkXsZTeFzjz9Cr4heGANr41uTB1Aj1Q5qzuYVk=
github.com/fluxcd/pkg/untar v0.1.0 h1:k97V/xV5hFrAkIkVPuv5AVhyxh1ZzzAKba/lbDfGo6o=
github.com/fluxcd/pkg/untar v0.1.0/go.mod h1:aGswNyzB1mlz/T/kpOS58mITBMxMKc9tlJBH037A2HY=
github.com/fluxcd/source-controller/api v0.24.0 h1:VIpyMX8jrPKGhOsFOzaxYeufi/gq5GZwcoeG8+QqrgE=
github.com/fluxcd/source-controller/api v0.24.0/go.mod h1:+raHSQaSGlk1PqgLc0joVk1KTnf1K/lQcgxdEdZ/mk8=
github.com/fluxcd/source-controller/api v0.24.1 h1:bFpfajE09k/xNIWkgNZtmtPrw/dS0zWUYMYxUUWu+jI=
github.com/fluxcd/source-controller/api v0.24.1/go.mod h1:+raHSQaSGlk1PqgLc0joVk1KTnf1K/lQcgxdEdZ/mk8=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ import (

"github.com/fluxcd/pkg/runtime/acl"
"github.com/fluxcd/pkg/runtime/client"
helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/events"
"github.com/fluxcd/pkg/runtime/leaderelection"
"github.com/fluxcd/pkg/runtime/logger"
@@ -73,6 +74,7 @@ func main() {
kubeConfigOpts client.KubeConfigOptions
logOptions logger.Options
leaderElectionOptions leaderelection.Options
rateLimiterOptions helper.RateLimiterOptions
aclOptions acl.Options
watchAllNamespaces bool
httpRetry int
@@ -93,6 +95,7 @@ func main() {
leaderElectionOptions.BindFlags(flag.CommandLine)
aclOptions.BindFlags(flag.CommandLine)
kubeConfigOpts.BindFlags(flag.CommandLine)
rateLimiterOptions.BindFlags(flag.CommandLine)
flag.Parse()

ctrl.SetLogger(logger.NewLogger(logOptions))
@@ -151,6 +154,7 @@ func main() {
MaxConcurrentReconciles: concurrent,
DependencyRequeueInterval: requeueDependency,
HTTPRetry: httpRetry,
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", controllerName)
os.Exit(1)