Skip to content

Conversation

@gyu-young-park
Copy link
Contributor

@gyu-young-park gyu-young-park commented Aug 28, 2025

Related Issue #19067

This PR introduces support for dynamically managing the content written to README.md that hydrator uses using the argocd-cm ConfigMap.

Changes:

  1. Added Role and RoleBinding for the commit-server to allow access to the Kubernetes API.
  2. The commit-server now subscribes to the argocd-cm configmap with an k8s informer to detect changes dynamically.
  3. Added a new key hydrator.readme.template in argocd-cm to configure the README template string dynamically.
  4. The existing README template remains as the default template. If hydrator.readme.template is empty, the default template will be applied.

Test:
I created the following Application and used the hydrator feature.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
  namespace: argocd
spec:
  destination:
    namespace: default
    server: https://kubernetes.default.svc
  project: default
  sourceHydrator:
    drySource:
      path: helm-guestbook
      repoURL: https://github.com/gyu-young-park/argocd-example-apps.git
      targetRevision: HEAD
    syncSource:
      path: helm-guestbook
      targetBranch: dev

Next, I modified the configmap.

kubectl edit -n argocd configmaps argocd-cm

In argocd-cm, I changed hydrator.readme.template as follows:

data:
  hydrator.readme.template: "Hello World! Im Gyu! {{ .RepoURL }}"

The result submitted by hydrator can be found at the following link. You can see that the README.md correctly reflects the updated configmap information dynamically.
gyu-young-park/argocd-example-apps@4a705c7

Current Status

  • Tests and documentation are not yet complete.
  • Verified manually by building and running locally: changes to hydrator.readme.template in the configmap are correctly reflected in README.md of hydrator

This PR is still in an early stage, and I’d like to gather feedback on the implementation before proceeding with tests and documentation. Since I’m not yet very familiar with the argo-cd codebase, I find it difficult to identify potential issues in my changes or the right direction for improvements. I’d greatly appreciate your feedback and suggestions before moving forward.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR guidelines.
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO.
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green.
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@gyu-young-park gyu-young-park requested a review from a team as a code owner August 28, 2025 18:24
@bunnyshell
Copy link

bunnyshell bot commented Aug 28, 2025

❌ Preview Environment undeployed from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

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 PR! Added a comment for a slightly different high-level direction for implementation.

Comment on lines 73 to 77
settingsMgr := settings.NewSettingsManager(context.Background(), kubeclientset, namespace)
err = settingsMgr.ResyncInformers()
if err != nil {
errors.CheckError(err)
}
Copy link
Member

Choose a reason for hiding this comment

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

I think instead of loading the template directly from the commit-server component, we should load it in the application-controller and pass it to the commit-server via the gRPC request. That'll require updating commit.proto with the new param.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review! I’ll update the code according to your comment and push a new commit.

@crenshaw-dev
Copy link
Member

Aside question: are you or your org finding the README.md useful so far? What kind of things do you want to add to the template?

@gyu-young-park
Copy link
Contributor Author

Aside question: are you or your org finding the README.md useful so far? What kind of things do you want to add to the template?

Actually, I haven’t used the hydrator feature much yet. I’ll try using it more and think about practical strings to add to the template. I’ll also ask my colleagues for their opinions.

@codecov
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

❌ Patch coverage is 76.92308% with 6 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@b8e8c1f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
controller/hydrator/hydrator.go 40.00% 2 Missing and 1 partial ⚠️
controller/hydrator_dependencies.go 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #24309   +/-   ##
=========================================
  Coverage          ?   60.84%           
=========================================
  Files             ?      404           
  Lines             ?    66238           
  Branches          ?        0           
=========================================
  Hits              ?    40304           
  Misses            ?    22694           
  Partials          ?     3240           

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

@gyu-young-park gyu-young-park force-pushed the feat-configurable-hydrator-readme-template branch 2 times, most recently from ff31047 to 40a3a11 Compare September 29, 2025 15:49
@gyu-young-park
Copy link
Contributor Author

gyu-young-park commented Sep 29, 2025

Hi @crenshaw-dev, sorry for updating the code so late. I have reverted all previous code implementations and added a new implementation according to the review comments.

Changes in this PR

  1. Removed all previous implementations
  2. Modified ApplicationController to dynamically fetch the hydrator README template from a ConfigMap
  3. Send the hydrator README template to the commit-server via gRPC
  4. Implemented commit-server to receive the README template via gRPC and use it during rendering

I tested this on my local server, and the results are as follows. You can check them via this link:
https://github.com/gyu-young-park/argocd-example-apps/tree/dev/helm-guestbook

I know you are busy, but I would appreciate it if you could review the implementation. Thank you!

@gyu-young-park gyu-young-park force-pushed the feat-configurable-hydrator-readme-template branch from 0e3e8f7 to f3c52d3 Compare September 30, 2025 00:27
@gyu-young-park gyu-young-park requested a review from a team as a code owner October 1, 2025 13:58
@gyu-young-park gyu-young-park force-pushed the feat-configurable-hydrator-readme-template branch 2 times, most recently from e059e70 to 5c1414c Compare October 1, 2025 14:51
@gyu-young-park gyu-young-park force-pushed the feat-configurable-hydrator-readme-template branch from 04636b7 to fe8430c Compare October 1, 2025 16:28
@gyu-young-park gyu-young-park changed the title feat(hydrator): dynamically manage README template from argocd-cm ConfigMap (#19067) feat(hydrator): dynamically manage README template from argocd-cm ConfigMap [updated] (#19067) Oct 1, 2025
@crenshaw-dev crenshaw-dev added this to the v3.3 milestone Nov 10, 2025
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.

2 participants