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

Commits on Jun 28, 2022

  1. Pass polling options to impersonation client

    Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
    somtochiama committed Jun 28, 2022
    Copy the full SHA
    1304452 View commit details

Commits on Jun 29, 2022

  1. Merge pull request #687 from somtochiama/polling-opts

    Fix job wait by adding polling options to impersonation client
    stefanprodan authored Jun 29, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2aa69b6 View commit details
  2. Release v0.26.2

    Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
    stefanprodan committed Jun 29, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    stefanprodan Stefan Prodan
    Copy the full SHA
    319c4a8 View commit details
  3. Merge pull request #688 from fluxcd/release-v0.26.2

    Release v0.26.2
    stefanprodan authored Jun 29, 2022

    Verified

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

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

## 0.26.2

**Release date:** 2022-06-29

This prerelease adds support for health checking Kubernetes Jobs
when impersonating a service account.

Fixes:
- Fix job wait by adding polling options to impersonation client
[#687](https://github.com/fluxcd/kustomize-controller/pull/687)

## 0.26.1

**Release date:** 2022-06-08
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.25.5/source-controller.crds.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.25.5/source-controller.deployment.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.25.9/source-controller.crds.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.25.9/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.26.1
newTag: v0.26.2
5 changes: 3 additions & 2 deletions controllers/kustomization_controller.go
Original file line number Diff line number Diff line change
@@ -85,6 +85,7 @@ type KustomizationReconciler struct {
EventRecorder kuberecorder.EventRecorder
MetricsRecorder *metrics.Recorder
StatusPoller *polling.StatusPoller
PollingOpts polling.Options
ControllerName string
statusManager string
NoCrossNamespaceRefs bool
@@ -350,7 +351,7 @@ func (r *KustomizationReconciler) reconcile(
}

// setup the Kubernetes client for impersonation
impersonation := NewKustomizeImpersonation(kustomization, r.Client, r.StatusPoller, r.DefaultServiceAccount, r.KubeConfigOpts)
impersonation := NewKustomizeImpersonation(kustomization, r.Client, r.StatusPoller, r.DefaultServiceAccount, r.KubeConfigOpts, r.PollingOpts)
kubeClient, statusPoller, err := impersonation.GetClient(ctx)
if err != nil {
return kustomizev1.KustomizationNotReady(
@@ -931,7 +932,7 @@ func (r *KustomizationReconciler) finalize(ctx context.Context, kustomization ku
kustomization.Status.Inventory.Entries != nil {
objects, _ := ListObjectsInInventory(kustomization.Status.Inventory)

impersonation := NewKustomizeImpersonation(kustomization, r.Client, r.StatusPoller, r.DefaultServiceAccount, r.KubeConfigOpts)
impersonation := NewKustomizeImpersonation(kustomization, r.Client, r.StatusPoller, r.DefaultServiceAccount, r.KubeConfigOpts, r.PollingOpts)
if impersonation.CanFinalize(ctx) {
kubeClient, _, err := impersonation.GetClient(ctx)
if err != nil {
9 changes: 6 additions & 3 deletions controllers/kustomization_impersonation.go
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ type KustomizeImpersonation struct {
kustomization kustomizev1.Kustomization
statusPoller *polling.StatusPoller
defaultServiceAccount string
pollingOpts polling.Options
kubeConfigOpts runtimeClient.KubeConfigOptions
}

@@ -50,13 +51,15 @@ func NewKustomizeImpersonation(
kubeClient client.Client,
statusPoller *polling.StatusPoller,
defaultServiceAccount string,
kubeConfigOpts runtimeClient.KubeConfigOptions) *KustomizeImpersonation {
kubeConfigOpts runtimeClient.KubeConfigOptions,
pollingOpts polling.Options) *KustomizeImpersonation {
return &KustomizeImpersonation{
defaultServiceAccount: defaultServiceAccount,
kustomization: kustomization,
statusPoller: statusPoller,
Client: kubeClient,
kubeConfigOpts: kubeConfigOpts,
pollingOpts: pollingOpts,
}
}

@@ -131,7 +134,7 @@ func (ki *KustomizeImpersonation) clientForServiceAccountOrDefault() (client.Cli
return nil, nil, err
}

statusPoller := polling.NewStatusPoller(client, restMapper, polling.Options{})
statusPoller := polling.NewStatusPoller(client, restMapper, ki.pollingOpts)
return client, statusPoller, err

}
@@ -160,7 +163,7 @@ func (ki *KustomizeImpersonation) clientForKubeConfig(ctx context.Context) (clie
return nil, nil, err
}

statusPoller := polling.NewStatusPoller(client, restMapper, polling.Options{})
statusPoller := polling.NewStatusPoller(client, restMapper, ki.pollingOpts)

return client, statusPoller, err
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -19,7 +19,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.26.1
github.com/fluxcd/kustomize-controller/api v0.26.2
github.com/fluxcd/pkg/apis/acl v0.0.3
github.com/fluxcd/pkg/apis/kustomize v0.4.2
github.com/fluxcd/pkg/apis/meta v0.14.2
@@ -28,7 +28,7 @@ require (
github.com/fluxcd/pkg/ssa v0.17.0
github.com/fluxcd/pkg/testserver v0.2.0
github.com/fluxcd/pkg/untar v0.1.0
github.com/fluxcd/source-controller/api v0.25.5
github.com/fluxcd/source-controller/api v0.25.9
github.com/hashicorp/go-retryablehttp v0.7.1
github.com/hashicorp/vault/api v1.6.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
@@ -304,8 +304,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.25.5 h1:64rLb5cuHhZ3LcRIxkp+/oAVCyVtjOhQ9kbphdFfR/s=
github.com/fluxcd/source-controller/api v0.25.5/go.mod h1:/e7YRDOqb8z8I3N8ifbDF1mknf8zFsoADtS/Q93iWPs=
github.com/fluxcd/source-controller/api v0.25.9 h1:hdaBYYNuW3qTcXRMfrxO5paK+UVFL9ApZS495nd7K2w=
github.com/fluxcd/source-controller/api v0.25.9/go.mod h1:/e7YRDOqb8z8I3N8ifbDF1mknf8zFsoADtS/Q93iWPs=
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/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y=
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -141,6 +141,9 @@ func main() {
}

jobStatusReader := statusreaders.NewCustomJobStatusReader(mgr.GetRESTMapper())
pollingOpts := polling.Options{
CustomStatusReaders: []engine.StatusReader{jobStatusReader},
}
if err = (&controllers.KustomizationReconciler{
ControllerName: controllerName,
DefaultServiceAccount: defaultServiceAccount,
@@ -151,9 +154,8 @@ func main() {
NoCrossNamespaceRefs: aclOptions.NoCrossNamespaceRefs,
NoRemoteBases: noRemoteBases,
KubeConfigOpts: kubeConfigOpts,
StatusPoller: polling.NewStatusPoller(mgr.GetClient(), mgr.GetRESTMapper(), polling.Options{
CustomStatusReaders: []engine.StatusReader{jobStatusReader},
}),
PollingOpts: pollingOpts,
StatusPoller: polling.NewStatusPoller(mgr.GetClient(), mgr.GetRESTMapper(), pollingOpts),
}).SetupWithManager(mgr, controllers.KustomizationReconcilerOptions{
MaxConcurrentReconciles: concurrent,
DependencyRequeueInterval: requeueDependency,