Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Merge branch 'usePyNewFlags' of https://github.com/nlopezgi/rules_k8s
Browse files Browse the repository at this point in the history
…into usePyNewFlags
  • Loading branch information
Nicolas Lopez committed May 13, 2019
2 parents c783b62 + 1c534ab commit 8ef7da3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

Expand Down
8 changes: 5 additions & 3 deletions examples/hellogrpc/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions k8s/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ par_binary(
name = "stamper",
srcs = ["stamper.py"],
main = "stamper.py",
python_version = "PY2",
visibility = ["//visibility:public"],
)

par_binary(
name = "reverser",
srcs = ["reverser.py"],
main = "reverser.py",
python_version = "PY2",
visibility = ["//visibility:public"],
deps = [
"@yaml",
Expand Down
3 changes: 2 additions & 1 deletion k8s/delete.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
8 changes: 8 additions & 0 deletions k8s/with-defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 8ef7da3

Please sign in to comment.