Skip to content

Commit 9fc807d

Browse files
committed
improve kustomize config name handling
1 parent e4b925a commit 9fc807d

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

pkg/update/filereader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (r *ScreeningLocalReader) Read() ([]*yaml.RNode, error) {
9393
return nil
9494
}
9595

96-
if ext := filepath.Ext(p); ext != ".yaml" && ext != ".yml" {
96+
if ext := filepath.Ext(p); ext != ".yaml" && ext != ".yml" && filepath.Base(p) != "Kustomization" {
9797
return nil
9898
}
9999

pkg/update/filereader_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ func TestScreeningLocalReader(t *testing.T) {
3333
}
3434
nodes, err := r.Read()
3535
g.Expect(err).ToNot(HaveOccurred())
36-
// the test fixture has three files that contain the marker:
37-
// - otherns.yaml
36+
// the test fixture has four files that contain the marker:
3837
// - marked.yaml
39-
// - kustomization.yaml
40-
g.Expect(len(nodes)).To(Equal(3))
38+
// - otherns.yaml
39+
// - kustomization.yml
40+
// - Kustomization
41+
g.Expect(len(nodes)).To(Equal(4))
4142
filesSeen := map[string]struct{}{}
4243
for i := range nodes {
4344
path, _, err := kioutil.GetFileAnnotations(nodes[i])
@@ -46,8 +47,9 @@ func TestScreeningLocalReader(t *testing.T) {
4647
}
4748
g.Expect(filesSeen).To(Equal(map[string]struct{}{
4849
"marked.yaml": {},
49-
"kustomization.yaml": {},
5050
"otherns.yaml": {},
51+
"kustomization.yml": {},
52+
"Kustomization": {},
5153
}))
5254

5355
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This is not intended to be a working kustomization
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
resources:
5+
- irrelevant.yaml
6+
images:
7+
- name: container
8+
newName: replaced # {"$imagepolicy": "automation-ns:policy:name"}
9+
newTag: v1 # {"$imagepolicy": "automation-ns:policy:tag"}

0 commit comments

Comments
 (0)