From 926ebcebfdb8ab7c829e434920ccd9c3621548f8 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Wed, 26 Jun 2019 23:49:32 +0200 Subject: [PATCH] Kustomize: pick up patchesStrategicMerge changes (#2349) Fixes #2344 Signed-off-by: David Gageot --- pkg/skaffold/deploy/kustomize.go | 16 +++++++++------- pkg/skaffold/deploy/kustomize_test.go | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pkg/skaffold/deploy/kustomize.go b/pkg/skaffold/deploy/kustomize.go index f39d3f8e075..9a6097d25a9 100644 --- a/pkg/skaffold/deploy/kustomize.go +++ b/pkg/skaffold/deploy/kustomize.go @@ -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 { @@ -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)) diff --git a/pkg/skaffold/deploy/kustomize_test.go b/pkg/skaffold/deploy/kustomize_test.go index 019c214b896..e3c93d26193 100644 --- a/pkg/skaffold/deploy/kustomize_test.go +++ b/pkg/skaffold/deploy/kustomize_test.go @@ -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]`,