Skip to content

Commit

Permalink
Kustomize: pick up patchesStrategicMerge changes (#2349)
Browse files Browse the repository at this point in the history
Fixes #2344

Signed-off-by: David Gageot <david@gageot.net>
  • Loading branch information
dgageot authored Jun 26, 2019
1 parent f34a7db commit 926ebce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/skaffold/deploy/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ import (

// kustomization is the content of a kustomization.yaml file.
type kustomization struct {
Bases []string `yaml:"bases"`
Resources []string `yaml:"resources"`
Patches []string `yaml:"patches"`
CRDs []string `yaml:"crds"`
PatchesJSON6902 []patchJSON6902 `yaml:"patchesJson6902"`
ConfigMapGenerator []configMapGenerator `yaml:"configMapGenerator"`
SecretGenerator []secretGenerator `yaml:"secretGenerator"`
Bases []string `yaml:"bases"`
Resources []string `yaml:"resources"`
Patches []string `yaml:"patches"`
PatchesStrategicMerge []string `yaml:"patchesStrategicMerge"`
CRDs []string `yaml:"crds"`
PatchesJSON6902 []patchJSON6902 `yaml:"patchesJson6902"`
ConfigMapGenerator []configMapGenerator `yaml:"configMapGenerator"`
SecretGenerator []secretGenerator `yaml:"secretGenerator"`
}

type patchJSON6902 struct {
Expand Down Expand Up @@ -177,6 +178,7 @@ func dependenciesForKustomization(dir string) ([]string, error) {
deps = append(deps, path)
deps = append(deps, joinPaths(dir, content.Resources)...)
deps = append(deps, joinPaths(dir, content.Patches)...)
deps = append(deps, joinPaths(dir, content.PatchesStrategicMerge)...)
deps = append(deps, joinPaths(dir, content.CRDs)...)
for _, patch := range content.PatchesJSON6902 {
deps = append(deps, filepath.Join(dir, patch.Path))
Expand Down
5 changes: 5 additions & 0 deletions pkg/skaffold/deploy/kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ func TestDependenciesForKustomization(t *testing.T) {
yaml: `patches: [patch1.yaml, path/patch2.yaml]`,
expected: []string{"kustomization.yaml", "patch1.yaml", "path/patch2.yaml"},
},
{
description: "patchesStrategicMerge",
yaml: `patchesStrategicMerge: [patch1.yaml, path/patch2.yaml]`,
expected: []string{"kustomization.yaml", "patch1.yaml", "path/patch2.yaml"},
},
{
description: "crds",
yaml: `patches: [crd1.yaml, path/crd2.yaml]`,
Expand Down

0 comments on commit 926ebce

Please sign in to comment.