Skip to content

Commit cf268a0

Browse files
authored
Merge pull request #1566 from fluxcd/upgrade-runtime
Upgrade fluxcd/pkg/runtime to v0.94.0
2 parents a86699a + e017256 commit cf268a0

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
github.com/fluxcd/pkg/cache v0.12.0
2929
github.com/fluxcd/pkg/http/fetch v0.21.0
3030
github.com/fluxcd/pkg/kustomize v1.24.0
31-
github.com/fluxcd/pkg/runtime v0.93.0
31+
github.com/fluxcd/pkg/runtime v0.94.0
3232
github.com/fluxcd/pkg/ssa v0.61.0
3333
github.com/fluxcd/pkg/tar v0.16.0
3434
github.com/fluxcd/pkg/testserver v0.13.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ github.com/fluxcd/pkg/http/fetch v0.21.0 h1:/vHWc+3BIk9q5HFA8khl0NEBb/XFXzZOqpnU
206206
github.com/fluxcd/pkg/http/fetch v0.21.0/go.mod h1:aFUPa2DLpUHE/dXkhIdaHakVIiZ6GVCWvp5tWkDKSEM=
207207
github.com/fluxcd/pkg/kustomize v1.24.0 h1:ckFB7hh9FpJA1Oy3bYl88p9On/zsZZTbwlLBgP6eUkA=
208208
github.com/fluxcd/pkg/kustomize v1.24.0/go.mod h1:cydG0vKpDuUaoP5STpKfxY3zqgzaARv5HsWDOFyt5nA=
209-
github.com/fluxcd/pkg/runtime v0.93.0 h1:fgd1O1xC7RRK5XJjBCocgg6MkDHS56Q73F0h5qCIvVk=
210-
github.com/fluxcd/pkg/runtime v0.93.0/go.mod h1:/E4dT1pdSkidyRTR5ghSzoyHEUcEJw3ipvJt597ArOA=
209+
github.com/fluxcd/pkg/runtime v0.94.0 h1:z33lG+albHTmmcpZgV7DY5VVUZXFFAErnBBATDI2B5I=
210+
github.com/fluxcd/pkg/runtime v0.94.0/go.mod h1:/E4dT1pdSkidyRTR5ghSzoyHEUcEJw3ipvJt597ArOA=
211211
github.com/fluxcd/pkg/sourceignore v0.15.0 h1:tB30fuk4jlB3UGlR7ppJguZ3zaJh1iwuTCEufs91jSM=
212212
github.com/fluxcd/pkg/sourceignore v0.15.0/go.mod h1:mZ9X6gNtNkq9ZsD35LebEYjePc7DRvB2JdowMNoj6IU=
213213
github.com/fluxcd/pkg/ssa v0.61.0 h1:GeueQfZVrjPLEzmEkq6gpFTBr1MDcqUihCQDf6AaIo8=

internal/controller/kustomization_controller.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
182182
}
183183

184184
// Configure custom health checks.
185-
statusReaders, err := cel.PollerWithCustomHealthChecks(ctx, obj.Spec.HealthCheckExprs)
185+
statusReader, err := cel.NewStatusReader(obj.Spec.HealthCheckExprs)
186186
if err != nil {
187187
errMsg := fmt.Sprintf("%s: %v", TerminalErrorMessage, err)
188188
conditions.MarkFalse(obj, meta.ReadyCondition, meta.InvalidCELExpressionReason, "%s", errMsg)
@@ -260,7 +260,7 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
260260
}
261261

262262
// Reconcile the latest revision.
263-
reconcileErr := r.reconcile(ctx, obj, artifactSource, patcher, statusReaders)
263+
reconcileErr := r.reconcile(ctx, obj, artifactSource, patcher, statusReader)
264264

265265
// Requeue at the specified retry interval if the artifact tarball is not found.
266266
if errors.Is(reconcileErr, fetch.ErrFileNotFound) {
@@ -304,7 +304,7 @@ func (r *KustomizationReconciler) reconcile(
304304
obj *kustomizev1.Kustomization,
305305
src sourcev1.Source,
306306
patcher *patch.SerialPatcher,
307-
statusReaders []func(apimeta.RESTMapper) engine.StatusReader) error {
307+
statusReader func(apimeta.RESTMapper) engine.StatusReader) error {
308308
reconcileStart := time.Now()
309309
log := ctrl.LoggerFrom(ctx)
310310

@@ -392,9 +392,9 @@ func (r *KustomizationReconciler) reconcile(
392392
impersonatorOpts = append(impersonatorOpts,
393393
runtimeClient.WithKubeConfig(obj.Spec.KubeConfig, r.KubeConfigOpts, obj.GetNamespace(), provider))
394394
}
395-
if r.ClusterReader != nil || len(statusReaders) > 0 {
395+
if r.ClusterReader != nil || len(obj.Spec.HealthCheckExprs) > 0 {
396396
impersonatorOpts = append(impersonatorOpts,
397-
runtimeClient.WithPolling(r.ClusterReader, statusReaders...))
397+
runtimeClient.WithPolling(r.ClusterReader, statusReader))
398398
}
399399
impersonation := runtimeClient.NewImpersonator(r.Client, impersonatorOpts...)
400400

@@ -404,7 +404,7 @@ func (r *KustomizationReconciler) reconcile(
404404
if mustImpersonate {
405405
kubeClient, statusPoller, err = impersonation.GetClient(ctx)
406406
} else {
407-
kubeClient, statusPoller = r.getClientAndPoller(statusReaders)
407+
kubeClient, statusPoller = r.getClientAndPoller(obj, statusReader)
408408
}
409409
if err != nil {
410410
conditions.MarkFalse(obj, meta.ReadyCondition, meta.ReconciliationFailedReason, "%s", err)
@@ -1286,13 +1286,14 @@ func (r *KustomizationReconciler) patch(ctx context.Context,
12861286
// Should be used for reconciliations that are not configured to use
12871287
// ServiceAccount impersonation or kubeconfig.
12881288
func (r *KustomizationReconciler) getClientAndPoller(
1289-
readerCtors []func(apimeta.RESTMapper) engine.StatusReader,
1289+
obj *kustomizev1.Kustomization,
1290+
readerCtor func(apimeta.RESTMapper) engine.StatusReader,
12901291
) (client.Client, *polling.StatusPoller) {
12911292

1292-
readers := make([]engine.StatusReader, 0, 1+len(readerCtors))
1293+
readers := make([]engine.StatusReader, 0, 1+len(obj.Spec.HealthCheckExprs))
12931294
readers = append(readers, statusreaders.NewCustomJobStatusReader(r.Mapper))
1294-
for _, ctor := range readerCtors {
1295-
readers = append(readers, ctor(r.Mapper))
1295+
if len(obj.Spec.HealthCheckExprs) > 0 {
1296+
readers = append(readers, readerCtor(r.Mapper))
12961297
}
12971298

12981299
poller := polling.NewStatusPoller(r.Client, r.Mapper, polling.Options{

0 commit comments

Comments
 (0)