-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: Allow to pass optional flags to resource template #1779
Conversation
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.
Please add examples
The example references openshift/origin#24060 |
5645d9c
to
4397256
Compare
Could I ask for help with the CI check? I am kinda struggling to understand the reason it failed. |
Looks like a network issue when running |
I think that this PR could become more generalized by allowing the user to pass arbitrary arguments to Something like: - name: create-route-without-validation
resource:
action: create
flags: ["--validate=false"] # validation will be turned off could work. Will open this as a new issue. @CermakM do you want to own this? (P.S. Not that this is slightly different from the open #1834 as that requires executor changes, so it still requires its own PR) |
@simster7 This looks reasonable to me and I'll be happy to extend the implementation :) I suppose we therefore want to have just EDIT: Commented on the issue as well. |
020c8a9
to
03c3f4d
Compare
Fixes: #1857 |
Codecov Report
@@ Coverage Diff @@
## master #1779 +/- ##
=========================================
Coverage ? 11.39%
=========================================
Files ? 74
Lines ? 31163
Branches ? 0
=========================================
Hits ? 3550
Misses ? 27134
Partials ? 479
Continue to review full report at Codecov.
|
See argoproj/argo-workflows#1779 Signed-off-by: Marek Cermak <macermak@redhat.com> modified: workflows/templates/inspection-build-template.yaml modified: workflows/templates/inspection-build-with-cpu-template.yaml
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 LGTM! Could you add some tests please?
Uh, well, I hoped you wouldn't say that :D I'll see what I can do. |
See argoproj/argo-workflows#1779 Signed-off-by: Marek Cermak <macermak@redhat.com> modified: workflows/templates/inspection-build-template.yaml modified: workflows/templates/inspection-build-with-cpu-template.yaml
Does this implementation require a manifest? I want to delete given a particular label in an argo work flow and I seem to only be able to do it with a specific manifest that requires a metadata.name |
03c3f4d
to
7b64016
Compare
@maximmold I am sorry, struggling to understand your use case a little bit. Could you please elaborate or provide an example of how would you imagine that being used other than in the |
7b64016
to
2062de8
Compare
See argoproj/argo-workflows#1779 Signed-off-by: Marek Cermak <macermak@redhat.com> modified: workflows/templates/inspection-build-template.yaml modified: workflows/templates/inspection-build-with-cpu-template.yaml
I simply want to be able to do a delete of resources given a particular label selector.
Providing a manifest requires you know the same of the resource. |
Ah, gotcha. Let me take a look at it. I think it shouldn't require many changes. |
Will try to get some internal comments w.r.t this PR today |
See argoproj/argo-workflows#1779 Signed-off-by: Marek Cermak <macermak@redhat.com> modified: workflows/templates/inspection-build-template.yaml modified: workflows/templates/inspection-build-with-cpu-template.yaml
See argoproj/argo-workflows#1779 Signed-off-by: Marek Cermak <macermak@redhat.com> modified: workflows/templates/inspection-build-template.yaml modified: workflows/templates/inspection-build-with-cpu-template.yaml
@CermakM is this still wanted please? |
@alexec Yes it is. I guess I have quite a lot of rebasing to do. :/ |
9b8d5a5
to
cc94c54
Compare
@simster7 do you want to continue as reviewer? |
Is the failure of Golang CI setup on my side? 🤔 |
cc94c54
to
fb6522a
Compare
Yes, sorry this got out of my radar. I'll give another review today |
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.
Two minor changes, otherwise LGTM.
I have reservations about security. With this PR we effectively give the workflow submitter full access to kubectl
. I'm going to bring this up with @jessesuen, but feel free to chime in with your opinions.
@simster7 you're right, but IMHO it is not Argo who should impose security restrictions, it is the cluster/namespace admin, I.e. if users have the rights to execute a certain command via kubectl, they should be able to do that in Argo as well, shouldn't they? |
b2c42d1
to
4ed2795
Compare
You're right, except that Argo its own ServiceAccount with |
- added an example for resource flags - added a test for resource flags - allow to use resource flags without manifest Signed-off-by: Marek Cermak <macermak@redhat.com> modified: cmd/argoexec/commands/resource.go modified: pkg/apis/workflow/v1alpha1/workflow_types.go modified: workflow/executor/resource.go new file: examples/resource-delete-with-flags.yaml new file: examples/resource-flags.yaml new file: workflow/executor/resource_test.go
c182b3b
to
8f772da
Compare
@simster7 I rebased it once again and pushed it without updated codegen, which causes the conflicts (which, in turn, I assume, have been blocking the merging the whole time). Please, if / when you decide to merge this, generate the codegen as well. Cheers, |
SonarCloud Quality Gate failed. 0 Bugs |
Thanks for your work @CermakM! Glad we finally got this merged |
Thanks @simster7 ! |
I'm new to Argo. Will this solve the issue with Openshift resources when used with ArgoCD as well? or will it only affect argo workflows? |
I found this option in
However is it possible to disable it per resource (instead of the whole app)? |
In some cases, it might be useful to have the option to pass optional flags to a resource template.
For example, to turn off
kubectl
default validation when submitting a resource manifest. OpenShift has some strict requirements (and in case of OpenShift 3.11 even discrepancies) in the oapi spec, which prevents resources from being submitted viakubectl
This patch introduces the
Template.Spec.Resource.Flags
parameter which allows to pass optional flags to a resource template.Example: