Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: transmit manifest-generate-path resources to the cmp-server for plugin-based applications #19209

Merged

Conversation

jsolana
Copy link
Contributor

@jsolana jsolana commented Jul 25, 2024

Closes #17951

Transmit only the necessary information to the cmp-server to improve the performance. More info here and here

We are gonna transmit manifest-generate-paths annotation.

This value is not propagated right now . Because this annotation only affects manifests generation maybe make sense to modify ManifestRequest:

repository.proto

// ManifestRequest is a query for manifest generation.
message ManifestRequest {
    github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.Repository repo = 1;
    // revision, potentially un-resolved
    string revision = 2;
    bool noCache = 3;
    string appLabelKey = 4;
    // Name of the application for which the request is triggered
    string appName = 5;
    string namespace = 8;
    github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.ApplicationSource applicationSource = 10;
    repeated github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.Repository repos = 11;
    // Deprecated: use sidecar plugins instead.
    repeated github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.ConfigManagementPlugin plugins = 12;
    github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.KustomizeOptions kustomizeOptions = 13;
    string kubeVersion = 14;
    repeated string apiVersions = 15;
    // Request to verify the signature when generating the manifests (only for Git repositories)
    bool verifySignature = 16;
    repeated github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.RepoCreds helmRepoCreds = 17;
    bool noRevisionCache = 18;
    string trackingMethod = 19;
    map<string, bool> enabledSourceTypes = 20;
    github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.HelmOptions helmOptions = 21;
    bool hasMultipleSources = 22;
    map<string, github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.RefTarget> refSources = 23;
    // This is used to surface "source not permitted" errors for Helm repositories
    repeated string projectSourceRepos = 24;
    // This is used to surface "source not permitted" errors for Helm repositories
    string projectName = 25;
    // argocd.argoproj.io/manifest-generate-paths annotation value of the Application to allow optimize which resources propagated to cmpserver
    string AnnotationManifestGeneratePaths = 26;
}

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 Toolchain Guide
  • 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 (troubleshooting builds).
  • 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).

…r plugin-based applications

Signed-off-by: Javier Solana <javier.solana@cabify.com>
@jsolana jsolana requested a review from a team as a code owner July 25, 2024 07:15
Copy link

bunnyshell bot commented Jul 25, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

bunnyshell bot commented Jul 25, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@jsolana
Copy link
Contributor Author

jsolana commented Jul 25, 2024

Hi @todaywasawesome!
It is the same code as #18054 (previous the disaster 😅 )

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 84.81013% with 24 lines in your changes missing coverage. Please review.

Project coverage is 55.87%. Comparing base (0710ff9) to head (eb9121a).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cmd/argocd/commands/app.go 0.00% 12 Missing ⚠️
reposerver/repository/utils.go 85.36% 4 Missing and 2 partials ⚠️
reposerver/repository/repository.go 76.92% 2 Missing and 1 partial ⚠️
pkg/apis/application/v1alpha1/types.go 80.00% 1 Missing ⚠️
util/argo/argo.go 95.00% 0 Missing and 1 partial ⚠️
util/cmp/stream.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19209      +/-   ##
==========================================
+ Coverage   55.81%   55.87%   +0.05%     
==========================================
  Files         320      321       +1     
  Lines       44431    44490      +59     
==========================================
+ Hits        24800    24859      +59     
+ Misses      17066    17060       -6     
- Partials     2565     2571       +6     

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

@jsolana
Copy link
Contributor Author

jsolana commented Jul 26, 2024

cc: @crenshaw-dev , cause you were also related to this issue 😄

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.

Since this is breaking behavior, should we allow the CMP author to opt in via the CMP config?

reposerver/repository/utils.go Outdated Show resolved Hide resolved
util/cmp/stream.go Show resolved Hide resolved
Signed-off-by: Javier Solana <javier.solana@cabify.com>
@jsolana
Copy link
Contributor Author

jsolana commented Jul 31, 2024

Since this is breaking behavior, should we allow the CMP author to opt in via the CMP config?

Sounds cool! We could define a "EnableUseGeneratePathsAnnotation". wdyt?

Which approach do you prefer?

  • Define it as an environment variable?
    - Define it in the PluginConfigSpec? <-- In this case it requires to update config-magament-plugins.md Ignore this, cause PluginConfigSpec is the configuration of the cmp server side and we are talking about modify the Repo server behavior.

Then the better approach is to define a new environment variable for Repo Server and document it
Thanks!

… configurable by environment variable

Signed-off-by: Javier Solana <javier.solana@cabify.com>
@jsolana jsolana requested a review from a team as a code owner August 8, 2024 16:03
@jsolana
Copy link
Contributor Author

jsolana commented Aug 8, 2024

New environment variable added! Let me know your thoughts (Im really terrible naming things 😅 )
cc: @crenshaw-dev

Signed-off-by: Javier Solana <javier.solana@cabify.com>
Javier Solana added 2 commits August 20, 2024 11:04
…alse by default

Signed-off-by: Javier Solana <javier.solana@cabify.com>
…FEST_GENERATE_PATHS_ANNOTATION properly

Signed-off-by: Javier Solana <javier.solana@cabify.com>
@jsolana jsolana requested a review from gbw August 20, 2024 09:09
…FEST_GENERATE_PATHS_ANNOTATION properly

Signed-off-by: Javier Solana <javier.solana@cabify.com>
@jsolana
Copy link
Contributor Author

jsolana commented Sep 2, 2024

Any news?

@momilo
Copy link

momilo commented Sep 2, 2024

It would be fabulous to have this merged, together with depth flag and sparse checkout - we have the whole team of engineers excitedly following these PRs, in hope that they resolve our major problems with argocd (as otherwise we will probably need to migrate to something more appropriate for monorepos).

Please do let me know if there is anything I could do to help progress these PR - happy to help. 🙏

@crenshaw-dev
Copy link
Member

@momilo if you have engineering resources to put behind those features, there are some challenges to overcome: #16064 (comment)

…ation-manifests-for-plugin

Signed-off-by: Javier Solana <javier.solana@cabify.com>
@jsolana
Copy link
Contributor Author

jsolana commented Sep 2, 2024

For visibility, after discuss with @crenshaw-dev, next steps:

  • Improve log and doc about how root path is calculated (adding a note under multiple paths scenario here)
  • Update GetApplicationRootPath implementation: app path should be fed into the common path algorithm. In other words, for this example:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: guestbook
  annotations:
    argocd.argoproj.io/manifest-generate-paths: ./manifests
spec:
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
    path: my-application
# ...

The common root path calculated must be my-application instead to resolve the common root path as my-application/manifests

Javier Solana added 2 commits September 2, 2024 16:16
Signed-off-by: Javier Solana <javier.solana@cabify.com>
Signed-off-by: Javier Solana <javier.solana@cabify.com>
@jsolana
Copy link
Contributor Author

jsolana commented Sep 4, 2024

Hi mates! Here is the diagram describing how GetApplicationRootPath calculate the root path

graph TD
    A[GetApplicationRootPath] --> B{Is argocd.argoproj.io/manifest-generate-paths empty?}
    B -->|Yes, for backward compatibility| C[Return repoPath]
    B -->|No| D[Set common root path to appPath]
    D --> E[Iterate over each path in argocd.argoproj.io/manifest-generate-paths]
    E --> F{disjoint path and common root path in some point?}
    F -->|Yes, use deepest common path| G[Update common root path]
    F -->|No| I{non disjoint and path is higher than current common root path?}
    I -->|Yes, use path| G
    G -->H[return common root path]
Loading

…tion

Signed-off-by: Javier Solana <javier.solana@cabify.com>
Javier Solana and others added 3 commits September 4, 2024 11:21
Signed-off-by: Javier Solana <javier.solana@cabify.com>
Signed-off-by: Javier Solana <javier.solana@cabify.com>
@jsolana
Copy link
Contributor Author

jsolana commented Sep 4, 2024

Let me know if everything is ok to move the summary of the whole conversation to the issue for better discoverability of the decisions taken

@jsolana
Copy link
Contributor Author

jsolana commented Sep 18, 2024

Hi! @crenshaw-dev, do you think it is ok to merge it or miss anything? Thanks!

@jsoref
Copy link
Member

jsoref commented Sep 20, 2024

This is not a chore. It's a feat.

@jsolana jsolana changed the title chore: transmit manifest-generate-path resources to the cmp-server for plugin-based applications feat: transmit manifest-generate-path resources to the cmp-server for plugin-based applications Sep 23, 2024
@jsolana
Copy link
Contributor Author

jsolana commented Sep 23, 2024

Let me know if it is ok now

Thanks!

Javier Solana and others added 3 commits September 23, 2024 12:34
…ation-manifests-for-plugin

Signed-off-by: Javier Solana <javier.solana@cabify.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
@jsolana
Copy link
Contributor Author

jsolana commented Sep 24, 2024

Thanks @crenshaw-dev really nice names now!! (among other tweaks) 🙇

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, @jsolana!

@crenshaw-dev crenshaw-dev merged commit b824956 into argoproj:master Sep 24, 2024
26 checks passed
cveld pushed a commit to cveld/argo-cd that referenced this pull request Sep 24, 2024
… plugin-based applications (argoproj#19209)

* chore: transmit manifest-generate-path resources to the cmp-server for plugin-based applications
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* use SecureJoin
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* make cmp manifests generation using manifest generate path annotation configurable by environment variable
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* fix missing doc running codegen-local
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* set reposerver.plugin.enable.manifests.generation.using.annotations false by default
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* Fix conflict
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* autogenerate install manifests
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* add note about common root path calculation for manifest paths annotation
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* log common root path calculated
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* app path must be the lower common path
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* tweaks

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

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Javier Solana <javier.solana@cabify.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Carl in 't Veld <carl@intveld.nl>
cveld pushed a commit to cveld/argo-cd that referenced this pull request Sep 24, 2024
… plugin-based applications (argoproj#19209)

* chore: transmit manifest-generate-path resources to the cmp-server for plugin-based applications
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* use SecureJoin
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* make cmp manifests generation using manifest generate path annotation configurable by environment variable
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* fix missing doc running codegen-local
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* set reposerver.plugin.enable.manifests.generation.using.annotations false by default
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* Fix conflict
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* autogenerate install manifests
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* add note about common root path calculation for manifest paths annotation
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* log common root path calculated
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* app path must be the lower common path
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* tweaks

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

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Javier Solana <javier.solana@cabify.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Carl in 't Veld <carl@intveld.nl>
ratulbasak pushed a commit to ratulbasak/argo-cd that referenced this pull request Sep 25, 2024
… plugin-based applications (argoproj#19209)

* chore: transmit manifest-generate-path resources to the cmp-server for plugin-based applications
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* use SecureJoin
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* make cmp manifests generation using manifest generate path annotation configurable by environment variable
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* fix missing doc running codegen-local
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* set reposerver.plugin.enable.manifests.generation.using.annotations false by default
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* define ARGOCD_REPO_SERVER_PLUGIN_ENABLE_GENERATE_MANIFESTS_USING_MANIFEST_GENERATE_PATHS_ANNOTATION properly
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* Fix conflict
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* autogenerate install manifests
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* add note about common root path calculation for manifest paths annotation
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* log common root path calculated
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* app path must be the lower common path
Signed-off-by: Javier Solana <javier.solana@cabify.com>

* tweaks

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

---------

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Javier Solana <javier.solana@cabify.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: ratulbasak <ratulbasak93@gmail.com>
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.

Tansfer only application's manifests to cmp-server for plugin-based applications
6 participants