-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support kustomize components #352
base: main
Are you sure you want to change the base?
Conversation
Mergecat's ReviewClick to read mergecats review!😼 Mergecat review of pkg/appdir/walk_kustomize_files.go@@ -40,6 +40,7 @@ func walkKustomizeFiles(result *AppDirectory, fs fs.FS, appName, dirpath string)
kustomize struct {
Bases []string `yaml:"bases"`
+ Components []string `yaml:"components"`
Resources []string `yaml:"resources"`
PatchesJson6902 []patchJson6902 `yaml:"patchesJson6902"`
PatchesStrategicMerge []string `yaml:"patchesStrategicMerge"`
@@ -66,7 +67,7 @@ func walkKustomizeFiles(result *AppDirectory, fs fs.FS, appName, dirpath string)
for _, resource := range kustomize.Resources {
if isGoGetterIsh(resource) {
- // no reason to walk remote files, since they can't be changed
+ // no reason to walk remote files, since they can't be changed in this PR
continue
}
@@ -110,6 +111,17 @@ func walkKustomizeFiles(result *AppDirectory, fs fs.FS, appName, dirpath string)
}
}
+ for _, componentPath := range kustomize.Components {
+ if isGoGetterIsh(componentPath) {
+ continue
+ }
+ relPath := filepath.Join(dirpath, componentPath)
+ result.addDir(appName, relPath)
+ if err = walkKustomizeFiles(result, fs, appName, relPath); err != nil {
+ log.Warn().Err(err).Msgf("failed to read kustomize.yaml from components in %s", relPath)
+ }
+ }
+
for _, patchFile := range kustomize.PatchesStrategicMerge {
relPath := filepath.Join(dirpath, patchFile)
result.addFile(appName, relPath) Feedback & Suggestions:
😼 Mergecat review of pkg/appdir/walk_kustomize_files_test.go@@ -55,6 +55,10 @@ resources:
- file1.yaml
- ../overlays/base
- /common/overlays/prod
+
+components:
+- ../components/one/
+- ../components/two/
`)},
"test/overlays/base/kustomization.yaml": {
Data: toBytes(`
@@ -73,6 +77,8 @@ resources:
"common/overlays/prod/kustomization.yaml": {Data: toBytes("hello: world")},
"test/overlays/base/some-file1.yaml": {Data: toBytes("hello: world")},
"test/overlays/base/some-file2.yaml": {Data: toBytes("hello: world")},
+ "test/components/one/kustomization.yaml": {Data: toBytes("hello: world")},
+ "test/components/two/kustomization.yaml": {Data: toBytes("hello: world")},
}
)
@@ -135,6 +141,12 @@ resources:
kustomizeApp1Name,
kustomizeApp2Name,
},
+ "test/components/one": {
+ kustomizeApp2Name,
+ },
+ "test/components/two": {
+ kustomizeApp2Name,
+ },
}, appdir.appDirs)
assert.Equal(t, map[string][]string{ Feedback & Suggestions:
Dependency ReviewClick to read mergecats review!No suggestions found |
Resolves #351 |
Temporary image available at |
No description provided.