Skip to content

Commit 9b7f116

Browse files
authored
Add a .diff target for k8s_deploy (#55)
1 parent c6f0b61 commit 9b7f116

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ For example, let's look at the [example's k8s_deploy](./e2e/helloworld/BUILD.baz
5151
cd e2e
5252
bazel run //helloworld:mynamespace.show
5353
```
54+
We can run `bazel run ///helloworld:mynamespace.diff` to see a difference from source to what is stored in kubernetes.
55+
5456
When you run `bazel run ///helloworld:mynamespace.apply`, it applies this file into your personal (`{BUILD_USER}`) namespace. Viewing the rendered files with `.show` can be useful for debugging issues with invalid or misconfigured manifests.
5557

5658
| Parameter | Default | Description

skylib/k8s.bzl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,17 @@ def k8s_deploy(
223223
tags = tags,
224224
visibility = visibility,
225225
)
226+
kubectl(
227+
name = name + ".diff",
228+
srcs = [name],
229+
command = "diff",
230+
cluster = cluster,
231+
push = False,
232+
user = user,
233+
namespace = namespace,
234+
tags = tags,
235+
visibility = visibility,
236+
)
226237
show(
227238
name = name + ".show",
228239
namespace = namespace,

0 commit comments

Comments
 (0)