diff --git a/WORKSPACE b/WORKSPACE index ba856630..6d8660d9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -23,12 +23,12 @@ http_archive( url = "https://github.com/google/protobuf/archive/v3.7.1.tar.gz", ) -# Mention subpar directly to ensure we get a version dated after 2019-03-07, -# which included fixes for incompatible change flags added in Bazel 0.23. This +# Mention subpar directly to ensure we get a version dated after 2019-05-13, +# which included fixes for incompatible change flags added in Bazel 0.25. This # can be removed once other dependencies are updated. git_repository( name = "subpar", - commit = "9c7b3e73b2c1f2befb3a789194bb46982ea336c8", # 2019-03-07 + commit = "9c7b3e73b2c1f2befb3a789194bb46982ea336c8", # 2019-05-13 remote = "https://github.com/google/subpar.git", ) diff --git a/examples/hellogrpc/e2e-test.sh b/examples/hellogrpc/e2e-test.sh index 898f11e4..40204f97 100755 --- a/examples/hellogrpc/e2e-test.sh +++ b/examples/hellogrpc/e2e-test.sh @@ -119,9 +119,11 @@ delete() { } check_kubeconfig_args() { - bazel build examples/hellogrpc:staging-deployment-with-kubeconfig.apply - OUTPUT="$(cat ./bazel-bin/examples/hellogrpc/staging-deployment-with-kubeconfig.apply)" - EXPECT_CONTAINS_PATTERN "${OUTPUT}" "--kubeconfig=\S*/examples/hellogrpc/kubeconfig.out" + for cmd in apply delete; do + bazel build examples/hellogrpc:staging-deployment-with-kubeconfig.${cmd} + OUTPUT="$(cat ./bazel-bin/examples/hellogrpc/staging-deployment-with-kubeconfig.${cmd})" + EXPECT_CONTAINS_PATTERN "${OUTPUT}" "--kubeconfig=\S*/examples/hellogrpc/kubeconfig.out" + done } # e2e test that checks that args are added to the kubectl apply command diff --git a/k8s/BUILD b/k8s/BUILD index 6db576a3..ad19ac4d 100644 --- a/k8s/BUILD +++ b/k8s/BUILD @@ -71,6 +71,7 @@ par_binary( name = "stamper", srcs = ["stamper.py"], main = "stamper.py", + python_version = "PY2", visibility = ["//visibility:public"], ) @@ -78,6 +79,7 @@ par_binary( name = "reverser", srcs = ["reverser.py"], main = "reverser.py", + python_version = "PY2", visibility = ["//visibility:public"], deps = [ "@yaml", diff --git a/k8s/delete.sh.tpl b/k8s/delete.sh.tpl index b995c29b..999b0699 100644 --- a/k8s/delete.sh.tpl +++ b/k8s/delete.sh.tpl @@ -26,4 +26,5 @@ function exe() { echo "\$ ${@/eval/}" ; "$@" ; } RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}" PYTHON_RUNFILES=${RUNFILES} %{reverse_script} | \ - exe %{kubectl_tool} --cluster="%{cluster}" --context="%{context}" --user="%{user}" %{namespace_arg} delete $@ --ignore-not-found=true -f - + exe %{kubectl_tool} --kubeconfig="%{kubeconfig}" --cluster="%{cluster}" \ + --context="%{context}" --user="%{user}" %{namespace_arg} delete $@ --ignore-not-found=true -f - diff --git a/k8s/with-defaults.bzl b/k8s/with-defaults.bzl index 46ebd142..76d2d919 100644 --- a/k8s/with-defaults.bzl +++ b/k8s/with-defaults.bzl @@ -87,6 +87,13 @@ def _impl(repository_ctx): repository_ctx.attr.kind, )] + if repository_ctx.attr.kubeconfig: + overrides += [_override( + repository_ctx.attr.name, + "kubeconfig", + repository_ctx.attr.kubeconfig, + )] + if repository_ctx.attr.image_chroot: overrides += [_override( repository_ctx.attr.name, @@ -120,6 +127,7 @@ k8s_defaults = repository_rule( "context": attr.string(mandatory = False), "image_chroot": attr.string(mandatory = False), "kind": attr.string(mandatory = False), + "kubeconfig": attr.string(mandatory = False), "namespace": attr.string(mandatory = False), "resolver": attr.string(mandatory = False), "user": attr.string(mandatory = False),