Skip to content

Commit a2631c1

Browse files
authored
When calculating Kustomize dependencies, include components (#6534)
When calling "kustomize(<directory>)" in a Tiltfile, the directory is watched as well as any paths the Kustomization includes. This doesn't currently include components, so Kustomizations that include components[1] don't trigger a reload of the Tiltfile and the Kustomization when files in those components change. This commit adds the "components:"" field of a Kustomization to the list of paths "dependenciesForKustomization" will inspect. [1]: https://github.com/kubernetes-sigs/kustomize/blob/master/examples/components.md Signed-off-by: Sam Clements <[email protected]>
1 parent 661604e commit a2631c1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

internal/kustomize/dependencies.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func dependenciesForKustomization(dir string) ([]string, error) {
8686
}
8787

8888
paths := append([]string{}, content.Bases...)
89+
paths = append(paths, content.Components...)
8990
paths = append(paths, content.Resources...)
9091

9192
for _, p := range paths {

internal/kustomize/dependencies_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ func TestRecursive(t *testing.T) {
8686
// https://github.com/tilt-dev/tilt/blob/15d0c94ccc08230d3a528b14cb0a3455b947d13c/vendor/sigs.k8s.io/kustomize/api/types/kustomization.go#L102
8787
kustomize := `bases:
8888
- ./dev
89+
components:
90+
- ./component
8991
resources:
9092
- ./staging
9193
- ./production
@@ -114,6 +116,11 @@ namePrefix: cluster-a-`
114116
namePrefix: dev-`
115117
f.writeBaseKustomize("dev", dev)
116118

119+
component := `labels:
120+
- pairs:
121+
instance: myapp`
122+
f.writeBaseKustomize("component", component)
123+
117124
staging := `bases:
118125
- ./../base
119126
namePrefix: stag-`
@@ -127,6 +134,7 @@ namePrefix: prod-`
127134
expected := []string{
128135
"base/kustomization.yaml",
129136
"base/pod.yaml",
137+
"component/kustomization.yaml",
130138
"dev/kustomization.yaml",
131139
"staging/kustomization.yaml",
132140
"production/kustomization.yaml",

0 commit comments

Comments
 (0)