kubeconfig cluster.proxy-url is being ignored by kube client
gustavobini opened this issue · comments
I was checking the remote cluster API with a target private cluster in GKE. I had setup a service proxy to connect from the flux cluster to the remote cluster, but it does not work as the cluster.proxy-url
field in kubeconfig is being ignored by Flux.
I confirmed it by checking the https://github.com/fluxcd/pkg/blob/main/runtime/client/kubeconfig.go#L70 code.
Would it be possible to use proxy-url
? I understand it might not be a small change since it's on the pkgs.
Also just hit this issue. Having flux ignore the proxy-url means we can't deploy to downstream clusters :(
I was able to patch kubeconfig.go with the following diff, which allows the proxy-url property to be used:
diff --git runtime/client/kubeconfig.go runtime/client/kubeconfig.go
index 1cf0a3b..74e6750 100644
--- runtime/client/kubeconfig.go
+++ runtime/client/kubeconfig.go
@@ -91,6 +91,8 @@ func KubeConfig(in *rest.Config, opts KubeConfigOptions) *rest.Config {
KeyData: in.TLSClientConfig.KeyData,
}
+ out.Proxy = in.Proxy
+
out.Username = in.Username
out.Password = in.Password
out.BearerToken = in.BearerToken
I wasn't able to perform a build of the pkg project because of a compile error elsewhere in the project. but I could monkey-patch the runtime folder into the kustomize-controller project to build a docker image in order to at least verify that the change worked.
I'll happily create a pull request if requested.
@garyhodgson please go head and add the proxy mapping in runtime package so that all Flux controllers can use it. Thanks
Thanks Stefan, have created the PR here: fluxcd/pkg#747