Skip to content

Conversation

@stefanprodan
Copy link
Member

@stefanprodan stefanprodan commented Jul 22, 2025

This PR extends the HelmRelease API with the .spec.dependsOn[].readyExpr optional field that can be used to define a CEL expression to determine the readiness of a HelmRelease dependency.

This is helpful for when custom logic is needed to determine if a dependency is ready. For example, when performing a lockstep upgrade, the readyExpr can be used to verify that a dependency has a matching version in values before proceeding with the reconciliation of the dependent HelmRelease.

apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: backend
  namespace: default
spec:
  # ...omitted for brevity
  values: 
    app:
      version: v1.2.3
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: frontend
  namespace: default
spec:
  # ...omitted for brevity
  values:
    app:
      version: v1.2.3
  dependsOn:
    - name: backend
      readyExpr: >
        dep.spec.values.app.version == self.spec.values.app.version &&
        dep.status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'True') &&
        dep.metadata.generation == dep.status.observedGeneration

The CEL expression contains the following variables:

  • dep: The dependency HelmRelease object being evaluated.
  • self: The HelmRelease object being reconciled.

Note: When readyExpr is specified, the built-in readiness check is replaced by the logic defined in the CEL expression. You can configure the controller to run both the CEL expression evaluation and the built-in readiness check, with the AdditiveCELDependencyCheck feature gate.

xref: fluxcd/kustomize-controller#1491 & fluxcd/kustomize-controller#1490

Extend the readiness evaluation of dependencies with CEL expressions

Signed-off-by: Stefan Prodan <[email protected]>
@stefanprodan stefanprodan requested a review from matheuscscp July 22, 2025 19:20
@stefanprodan stefanprodan added enhancement New feature or request area/ux In pursuit of a delightful user experience area/api API related issues and pull requests labels Jul 22, 2025
@stefanprodan stefanprodan force-pushed the feat-dependson-cel branch 2 times, most recently from 73b939f to cde4258 Compare July 23, 2025 05:52
Copy link
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@stefanprodan stefanprodan merged commit 183a4f4 into main Jul 29, 2025
6 checks passed
@stefanprodan stefanprodan deleted the feat-dependson-cel branch July 29, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API related issues and pull requests area/ux In pursuit of a delightful user experience enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants