-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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: support resource actions on CRDs that use status subresources #4690
Conversation
@@ -2317,7 +2317,7 @@ func filterResources(command *cobra.Command, resources []*argoappv1.ResourceDiff | |||
if resourceName != "" && resourceName != obj.GetName() { | |||
continue | |||
} | |||
if kind != gvk.Kind { | |||
if kind != "" && kind != gvk.Kind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes the following possible:
$ dist/argocd --plaintext --server localhost:8080 app actions list test-crd-status-subresource-action
GROUP KIND NAME ACTION DISABLED
argoproj.io StatusSubResource status-subresource update-both false
argoproj.io StatusSubResource status-subresource update-spec false
argoproj.io StatusSubResource status-subresource update-status false
argoproj.io NonStatusSubResource non-status-subresource update-status false
argoproj.io NonStatusSubResource non-status-subresource update-both false
argoproj.io NonStatusSubResource non-status-subresource update-spec false
e811352
to
3433315
Compare
Codecov Report
@@ Coverage Diff @@
## master #4690 +/- ##
==========================================
- Coverage 41.37% 41.11% -0.27%
==========================================
Files 126 127 +1
Lines 17154 17397 +243
==========================================
+ Hits 7097 7152 +55
- Misses 9042 9216 +174
- Partials 1015 1029 +14
Continue to review full report at Codecov.
|
Signed-off-by: Jesse Suen <[email protected]>
3433315
to
eeb4670
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…zation-generators * 'master' of github.com:argoproj/argo-cd: fix: RevisionFormField component crashes in 'refs' API returns no tags (argoproj#4735) docs: add Opensurvey to USERS.md (argoproj#4727) docs: correct parameters usage in CLI (argoproj#4725) fix: Repo-server has silent unmarshalling errors leading to empty applications (argoproj#4423) (argoproj#4708) fix: inject artificial delay between sync waves to better support health assessments (argoproj#4715) fix: exclude files listed under exclusions (argoproj#4686) feat: support resource actions on CRDs that use status subresources (argoproj#4690) feat: Add autocomplete for repo Revisions (argoproj#4645) (argoproj#4713) fix: webhook don't refresh apps pointing to HEAD (argoproj#4717) feat: Add support for ExecProvider cluster auth (argoproj#4600) (argoproj#4710) fix: adding helm values file in New App (argoproj#4635) docs: Instructions on `make verify-kube-connect` step when using k3d (argoproj#4687) feat: Annotation based app paths detection in webhooks (argoproj#4699) fix: adding commonAnnotations for Kustomize (argoproj#4613)
Resolves #4670
This PR adds support for performing resource actions on CRDs which use the status subresource.
When an action is performed on a resource, and that action modifies status, Argo CD will first split the patch into a non-status patch and a status-only patch. It then tries to apply the status only patch. This will either succeed (if status subresource is enabled), or fail with 404 if status subresource is disabled.
If the status patch was successful, Argo CD will then proceed to applying the non-status patch. Otherwise, if the status patch 404'ed, this indicates status subresources are not enabled for the CRD, and Argo CD will fall back to applying the original full resource action patch.
With this change, Argo CD transparently supports resources that use status subresource, even if this definition changes from one call to another.