-
Notifications
You must be signed in to change notification settings - Fork 0
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
remove use of kubectl proxy for api calls #1
remove use of kubectl proxy for api calls #1
Conversation
Signed-off-by: Doug Davis <[email protected]>
Signed-off-by: Doug Davis <[email protected]>
Note that the call to For example, an user called something like |
9c351dd
to
a3bdc6f
Compare
thanks for pointing this out, I have updated the kubectl call to include Also, updated patch to honor
According to this section in the docs, I could retrieve any other global flag values through |
9766a97
to
ca9808f
Compare
We don't and it would depend on each plugin's role, but most plugins should honor as much as possible, if not all. For example, if I make a call to a given plugin with
The plugin framework makes no assumptions or validations about the set of flags it's supposed to support, it just blindly passes through an env var every global flag available in the given version of the caller. So if you want to make your plugin support both Of course there's another front we could think about proposing which is making flag names conform between the projects (or at least have aliases). |
@fabianofranz Thanks for the response
Maybe we could, in the future, think about making a package of common utils that could be used by all plugins, to further abstract some common logic handling?
|
Definitely, at least for Go and maybe a couple others (shell script, etc). |
ca9808f
to
128389f
Compare
plugin/cmd/kubectl/utils/utils.go
Outdated
func KubeGet(endpoint string) (stdout, stderr io.ReadCloser, err error) { | ||
v, logLevel := Loglevel() | ||
caller := os.Getenv("KUBECTL_PLUGINS_CALLER") | ||
kubeCmd := exec.Command(caller, "--namespace", Namespace(), v, logLevel, "get", "--raw", "/api/v1/"+endpoint) |
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.
@fabianofranz A shortcoming with this patch that I have recently noticed, is that for cases like this one, where we use get --raw
to see if a namespace exists, the success of the command is entirely dependent on whether or not the currently logged in user in kubeconfig has permission to list all namespaces in the cluster
@fabianofranz I am now handling the following global options when obtaining a client config: --as
--as-group
--certificate-authority
--client-certificate
--client-key
--cluster # not sure where to override this
--context # not sure where to override this
--user # not sure where to override this
--config
--kubeconfig
--namespace
--password
--request-timeout
--server
--token
--user The following flags are not being handled as of the latest commit. --insecure-skip-tls-verify # the default value received from the caller is `true`
--log-flush-frequency
--alsologtostderr
--loglevel
--logspec
--log-backtrace-at
--logtostderr
--match-server-version
--stderrthreshold
--v
--vmodule |
001d3de
to
af25941
Compare
Hey there @juanvallejo I picked up Simon's work on the service catalogue plugins. Unfortunately I don't have access to this repo so I've forked it over at github.com/jberkhahn/service-catalog I'm interested in your work, but it unfortunately seems like it needs to be rebased again due to code drift. If you'd be up for rebasing on top of my branch, that would be great. If not, I might try and cherry pick in some of the utils you've written. Thanks, |
Hi @jberkhahn, sure will open a PR against your branch shortly that replays these patches onto your changes |
Closing in favor of jberkhahn#1 |
Work in progress.
Main idea is to remove the use of
kubectl proxy...
and just to as much as possible throughkubectl get --raw
.cc @fabianofranz