Skip to content

Commit d932a1c

Browse files
committed
Support CRDs
Fixes #1033 Signed-off-by: David Gageot <[email protected]>
1 parent 05e10ef commit d932a1c

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

pkg/skaffold/deploy/kustomize.go

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type kustomization struct {
3838
Bases []string `yaml:"bases"`
3939
Resources []string `yaml:"resources"`
4040
Patches []string `yaml:"patches"`
41+
CRDs []string `yaml:"crds"`
4142
PatchesJSON6902 []patcheJSON6902 `yaml:"patchesJson6902"`
4243
}
4344

@@ -139,6 +140,9 @@ func dependenciesForKustomization(dir string) ([]string, error) {
139140
for _, file := range content.Patches {
140141
deps = append(deps, filepath.Join(dir, file))
141142
}
143+
for _, file := range content.CRDs {
144+
deps = append(deps, filepath.Join(dir, file))
145+
}
142146
for _, patch := range content.PatchesJSON6902 {
143147
deps = append(deps, filepath.Join(dir, patch.Path))
144148
}

pkg/skaffold/deploy/kustomize_test.go

+11-6
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,25 @@ func TestDependenciesForKustomization(t *testing.T) {
3232
}{
3333
{
3434
description: "resources",
35-
yaml: `resources: [pod1.yaml, pod2.yaml]`,
36-
expected: []string{"kustomization.yaml", "pod1.yaml", "pod2.yaml"},
35+
yaml: `resources: [pod1.yaml, path/pod2.yaml]`,
36+
expected: []string{"kustomization.yaml", "pod1.yaml", "path/pod2.yaml"},
3737
},
3838
{
3939
description: "paches",
40-
yaml: `patches: [patch1.yaml, patch2.yaml]`,
41-
expected: []string{"kustomization.yaml", "patch1.yaml", "patch2.yaml"},
40+
yaml: `patches: [patch1.yaml, path/patch2.yaml]`,
41+
expected: []string{"kustomization.yaml", "patch1.yaml", "path/patch2.yaml"},
42+
},
43+
{
44+
description: "crds",
45+
yaml: `patches: [crd1.yaml, path/crd2.yaml]`,
46+
expected: []string{"kustomization.yaml", "crd1.yaml", "path/crd2.yaml"},
4247
},
4348
{
4449
description: "patches json 6902",
4550
yaml: `patchesJson6902:
4651
- path: patch1.json
47-
- path: patch2.json`,
48-
expected: []string{"kustomization.yaml", "patch1.json", "patch2.json"},
52+
- path: path/patch2.json`,
53+
expected: []string{"kustomization.yaml", "patch1.json", "path/patch2.json"},
4954
},
5055
}
5156

0 commit comments

Comments
 (0)