Skip to content

feat(hydrator): add inline parameter support to Source Hydrator (#24228)#24277

Merged
crenshaw-dev merged 21 commits intoargoproj:masterfrom
sangyeong01:feat/hydrator-helm-support
Dec 5, 2025
Merged

feat(hydrator): add inline parameter support to Source Hydrator (#24228)#24277
crenshaw-dev merged 21 commits intoargoproj:masterfrom
sangyeong01:feat/hydrator-helm-support

Conversation

@sangyeong01
Copy link
Contributor

@sangyeong01 sangyeong01 commented Aug 26, 2025

Summary

Add Helm support to Source Hydrator (alpha feature) to enable using Helm charts with environment-specific value files and parameters.

Currently, Source Hydrator only supports basic Git repository fields (repoURL, targetRevision, path) in the DrySource specification, making it impossible to use with Helm charts that require valueFiles, parameters, or other Helm-specific configurations.

This PR adds a Helm field to the DrySource type and updates the hydrator logic to properly handle Helm configurations, enabling teams to use Source Hydrator with Helm-based applications.

Closes #24228

Changes

  • API: Added Helm *ApplicationSourceHelm field to DrySource type in pkg/apis/application/v1alpha1/types.go
  • Logic: Updated controller/hydrator/hydrator.go to copy Helm configuration from DrySource to the hydrated ApplicationSource

Example Usage

Before (not supported):

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  sourceHydrator:
    drySource:
      repoURL: https://github.com/example/charts.git
      targetRevision: main
      path: my-chart
      # ❌ helm field not supported

After (now supported):

apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
  sourceHydrator:
    drySource:
      repoURL: https://github.com/example/charts.git
      targetRevision: main
      path: my-chart
      helm:  # ✅ Now works
        valueFiles:
          - values-prod.yaml
        parameters:
          - name: image.tag
            value: v1.2.3
        releaseName: my-release

Use Case

Many teams use Helm with environment-specific value files (e.g., values-dev.yaml, values-prod.yaml). Without this support, Source Hydrator cannot be used for Helm applications, limiting its adoption for teams that want to use both Helm and the hydration workflow.

Testing

  • Manual testing with Helm chart and multiple value files
  • Verified existing functionality remains unaffected
  • Confirmed omitempty tag ensures backward compatibility

Future Work

  • Add unit tests (will be included in follow-up PR)
  • Update CRD schema (will be included in follow-up PR)
  • Add documentation (will be included in follow-up PR)

Checklist

Notes

This PR focuses on the core API and logic changes. Follow-up PRs will include:

  1. Unit and integration tests
  2. CRD schema updates
  3. Documentation updates
  4. CLI/UI updates if needed

The changes are minimal and backward-compatible, using the omitempty JSON tag to ensure existing DrySource configurations continue to work without modification.

@sangyeong01 sangyeong01 requested a review from a team as a code owner August 26, 2025 16:18
@bunnyshell
Copy link

bunnyshell bot commented Aug 26, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@codecov
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@e81872f). Learn more about missing BASE report.
⚠️ Report is 20 commits behind head on master.

Files with missing lines Patch % Lines
pkg/apis/application/v1alpha1/types.go 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #24277   +/-   ##
=========================================
  Coverage          ?   62.46%           
=========================================
  Files             ?      351           
  Lines             ?    49502           
  Branches          ?        0           
=========================================
  Hits              ?    30922           
  Misses            ?    15619           
  Partials          ?     2961           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@crenshaw-dev crenshaw-dev marked this pull request as draft August 26, 2025 19:20
@crenshaw-dev
Copy link
Member

Thanks for the PR! I've marked it as draft while it's being iterated over.

I think we should add kustomize and directory fields at the same time for feature parity with the source field.

I don't think we can save CRD updates, tests, and docs for a follow-up PR. Those need to be part of the initial PR.

@sangyeong01 sangyeong01 force-pushed the feat/hydrator-helm-support branch 2 times, most recently from 4e7e061 to 7fad451 Compare September 2, 2025 15:49
@sangyeong01 sangyeong01 force-pushed the feat/hydrator-helm-support branch 3 times, most recently from ba3b1ae to 14814e9 Compare September 7, 2025 08:24
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Can you add docs and e2e tests?

@sangyeong01 sangyeong01 force-pushed the feat/hydrator-helm-support branch 5 times, most recently from 5ccd11a to 13c9fc0 Compare September 13, 2025 13:54
@crenshaw-dev crenshaw-dev changed the title feat(hydrator): add Helm support to Source Hydrator (#24228) feat(hydrator): add inline parameter support to Source Hydrator (#24228) Sep 14, 2025
@sangyeong01 sangyeong01 force-pushed the feat/hydrator-helm-support branch 7 times, most recently from be374c9 to 0c9f611 Compare September 16, 2025 00:58
@sangyeong01 sangyeong01 marked this pull request as ready for review September 16, 2025 08:36
@sangyeong01 sangyeong01 requested a review from a team as a code owner September 16, 2025 08:36
@sangyeong01
Copy link
Contributor Author

sangyeong01 commented Sep 20, 2025

@crenshaw-dev,
I’ve addressed all requested changes, including adding docs and e2e tests. Could you please take another look when you have a chance? Thanks!

sangyeong01 and others added 5 commits December 4, 2025 15:35
Signed-off-by: sangyeong01 <sy.park@alpacax.com>
Signed-off-by: sangyeong01 <tkddud386@gmail.com>
Signed-off-by: sangyeong01 <sy.park@alpacax.com>
Signed-off-by: sangyeong01 <sy.park@alpacax.com>
Signed-off-by: sangyeong01 <sy.park@alpacax.com>
@sangyeong01 sangyeong01 force-pushed the feat/hydrator-helm-support branch from 34b1d6b to 2829c93 Compare December 4, 2025 06:36
Signed-off-by: sangyeong01 <sy.park@alpacax.com>
@sangyeong01 sangyeong01 force-pushed the feat/hydrator-helm-support branch from e184b62 to 98d2266 Compare December 4, 2025 08:45
Signed-off-by: sangyeong01 <sy.park@alpacax.com>
@sangyeong01 sangyeong01 force-pushed the feat/hydrator-helm-support branch 2 times, most recently from 976b4f3 to 68c1827 Compare December 4, 2025 11:42
@sangyeong01
Copy link
Contributor Author

Looking good! Added a couple questions about tests.

Mind adding a note to docs/operator-manual/application.yaml that these fields are available? No need to copy the full spec from source, just add a note that the helm, kustomize, directory, and plugin fields are available.

Added a note in commit 607f7a0. The docs now mention that drySource.helm, drySource.kustomize, drySource.directory, and drySource.plugin fields are available and reference the source field sections above for the full spec.

@crenshaw-dev
Copy link
Member

@sangyeong01, @emirot is gonna give this a local test, but code LGTM. Looking forward to getting it into 3.3!

@emirot
Copy link
Contributor

emirot commented Dec 4, 2025

I have added an ArgoCD helm application with your changes and I could see the helm chart got hydrated https://github.com/emirot/argocd-test-hydrator/tree/environments/dev/development

ArgoCD app:

project: default
destination:
  server: https://kubernetes.default.svc
  namespace: argocd
sourceHydrator:
  drySource:
    repoURL: https://github.com/emirot/argocd-test-hydrator
    targetRevision: HEAD
    path: hello-world
    helm:
      valueFiles:
        - values.yaml
      releaseName: my-release
  syncSource:
    targetBranch: environments/dev
    path: development

However in my case it looks like the app is in a infinite Hydrating state
Screenshot 2025-12-04 at 1 32 33 PM
@sangyeong01 what did I miss? Did you see that behavior?

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
@crenshaw-dev
Copy link
Member

@emirot good catch! I proposed a fix here: sangyeong01#1

@sangyeong01
Copy link
Contributor Author

@emirot good catch! I proposed a fix here: sangyeong01#1

Thanks for the fix! I tested this by deploying a local build . Before the fix, it was stuck in Hydrating state with repeated "reason":"spec.sourceHydrator differs" logs. After the fix, it reaches Hydrated and stays stable. Good to merge.

@crenshaw-dev
Copy link
Member

Great! @sangyeong01 you can either merge my PR into your branch or copy/paste my code into this PR. :-)

@sangyeong01
Copy link
Contributor Author

sangyeong01 commented Dec 5, 2025

Thanks @crenshaw-dev ! I've merged your PR into my branch. The fix is now included in this PR.

Signed-off-by: sangyeong01 <tkddud386@gmail.com>
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Great work, thanks so much! And thanks @emirot for the testing!

@crenshaw-dev crenshaw-dev merged commit 0c6fa28 into argoproj:master Dec 5, 2025
28 checks passed
yuehaii pushed a commit to yuehaii/argo-cd that referenced this pull request Dec 11, 2025
…proj#24228) (argoproj#24277)

Signed-off-by: sangyeong01 <tkddud386@gmail.com>
Signed-off-by: sangyeong01 <sy.park@alpacax.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: hai.yue <hai.yue@ingka.com>
@juwon8891
Copy link
Member

Thanks @sangyeong01

@sym-stiller
Copy link

Hey guys,

I was really looking forward to this feature, because I wanted to use a Helm chart with multiple values.yaml files in a hydrator app. The hydration works well, I can see that the manifests were rendered correctly to my hydration branch. But I noticed an issue with this feature: When ArgoCD tries to apply the manifests from my sync branch to the K8s cluster, ArgoCD renders the manifests on my sync branch again (by calling helm template)! This obviously fails with an error, since the manifests on my sync branch are already hydrated, and there is no Helm chart to template on this branch.

My AppSet looks like this:

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
spec:
  generators: ...
  template:
    spec:
      sourceHydrator:
        drySource:
          repoURL: https://github.com/someRepo
          path: &path somePath # you can find a standard Helm chart and multiple values.yaml files here
          targetRevision: HEAD # dry branch
          helm:
            valueFiles:
              - values.yaml
              - values-{{.env}}.yaml
        hydrateTo:
          targetBranch: environments/{{.env}}-next # hydration branch
        syncSource:
          targetBranch: environments/{{.env}} # sync branch
          path: *path

As I said, hydration works fine. But when the time comes to sync this app to the cluster, I get a ComparisonError event with a message like this:

Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = Manifest generation error (cached): failed to execute helm template command: failed to get command args to log: `helm template . --name-template REDACTED--namespace REDACTED --kube-version 1.33 <api versions removed> --include-crds` failed exit status 1: Error: template: some/templatefile/in/my/chart.yaml:10:16: executing "some/templatefile/in/my/chart.yaml" at <.Values.some.value>: nil pointer evaluating interface {}.value Use --debug flag to render out invalid YAML

The event message looks like ArgoCD tries to hydrate the already hydrated manifests from the sync branch again before applying them. When I omit all helm: parameters from my app, everything can be synced as expected, so I suspect that this new behavior was introduced with the inline parameter support for Source Hydrator.

My environment:

  1. ArgoCD v3.3.0-rc3
  2. gitops-promoter v0.20.2
  3. AKS cluster with K8s v1.33.5

Should I open a new issue for this bug? Have I misconfigured something, and there is no bug? Any help would be appreciated, since this is blocking us from rolling out gitops-promoter.

@crenshaw-dev
Copy link
Member

@sym-stiller that definitely seems like a bug, can you open an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Helm valueFiles in Source Hydrator

7 participants

Comments