-
Notifications
You must be signed in to change notification settings - Fork 136
Hermetically include kubectl in rules_k8s #21
Comments
Something like this (except it is blocked by a visibility issue in Bazel) |
@achew22 Perhaps, although that may make authentication tricky. I don't really know enough about One of my biggest pet peeves about Bazel's current |
@mattmoor, I think I'm a little confused. Aren't the rules_k8s targets all |
2cp: I Bazelified the kubecfg tool and it can be executed via
|
@achew22 Yes, today all the interesting actions are done on @hsyed does |
@mattmoor kubecfg is basically a wrapper to jsonnet and kubectl. It conventionally turns the multiple outputs of a single jsonnet file into a multi-doc yaml file and then applies that to kubernetes via apply. It picks up credentials from the ~/.kube/config but has switches to control the context / config. For now I assume the build environment provides a ~/.kube/config file outside of bazel. |
Would it be possible to select which version of kubectl you would get? What if you need a newer version of rules_k8s, but you're running an older cluster and there's an API incompatibility with the client? |
It is now possible to pull a prebuilt kubectl binary or build it from source. Details are here: https://github.com/bazelbuild/rules_k8s/tree/master/toolchains/kubectl |
Rather than depending on the kubectl that is available on the system, it would be nifty to be hermetic and to compile kubectl. Since kubernetes is using Bazel and Gazelle to manage things, I believe you could just add it as a git_repository (it vendors all its deps so no need to add more) and depend on
@com_github_kubernetes_kubernetes//cmd/kubectl
as a data dependency and then shell out toexternal/com_github_kubernetes_kubernetes/cmd/kubectl/kubectl
instead. A bash wrapper that checked for the existence of that file and called it and fell back to the system version if you didn't want to force the dependency.The text was updated successfully, but these errors were encountered: