kyverno
kyverno copied to clipboard
Support apiCalls in the CLI when `--cluster` is used
Is your feature request related to a problem? Please describe.
Currently the CLI expects the user to supply variables, including ones from API calls. This makes sense when the CLI is used without cluster access. However, when the CLI is used with a cluster the API calls should be performed against the cluster.
Describe the solution you'd like
When the --cluster
option is used, API calls should be resolved without requiring the user to provide variable values.
Describe alternatives you've considered
Additional context
Slack discussion: https://kubernetes.slack.com/archives/CLGR9BJU9/p1638383189095100?thread_ts=1638368072.089700&cid=CLGR9BJU9
@JimBugwadia Interesting issue, has it been assigned to anyone yet? if not I would like to work on it.
Please what is the CLI command for API calls in kyverno kyverno apply {apiURL} ......
?
@zeborg - are you working on this issue?
@zeborg - are you working on this issue?
@realshuting Not yet, other contributors are free to pick it up.
@adeniyistephen - I assigned the issue!
Please what is the CLI command for API calls in kyverno kyverno apply {apiURL} ...... ?
Yes, both test
and apply
commands need to support this. You can find the CLI implementation in this package.
Let us know if you want to discuss the design / proposal, thanks!
@adeniyistephen - are you still interested in picking this up?
@adeniyistephen - are you still interested in picking this up?
Yes, I have been busy. But other contributors are free to pick it up.
I can take this up! @JimBugwadia @realshuting
Thanks @tend2infinity!
Hey @JimBugwadia I was actually going through the codebase and I realized that in the ApplyPolicyOnResource function, we don't have any method to get variables
from Api calls, we get variables
as an argument of this function which is definitely a map. So, How should I actually approach this issue? Should I create a new method inside applyCommandHelper function that will allow us to get variables using API calls. Also do we have a reusable piece of relevant code for implementing API support, actually I couldn't find it :sweat_smile:
Just ran into this as an issue while testing policies using apiCall context against a cluster. Would be great to see this added.
Hey @tend2infinity are you still working on this ?, as I'm currently exploring CLI section and interested in this issue .