mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Add a fileType field into the index
This commit is contained in:
@@ -87,17 +87,17 @@ func (doc *KustomizationDocument) GetResources(
|
||||
res := make([]*Document, 0)
|
||||
|
||||
if includeResources {
|
||||
resourceDocs := doc.CollectDocuments(k.Resources)
|
||||
resourceDocs := doc.CollectDocuments(k.Resources, "resource")
|
||||
res = append(res, resourceDocs...)
|
||||
}
|
||||
|
||||
if includeGenerators {
|
||||
generatorDocs := doc.CollectDocuments(k.Generators)
|
||||
generatorDocs := doc.CollectDocuments(k.Generators, "generator")
|
||||
res = append(res, generatorDocs...)
|
||||
}
|
||||
|
||||
if includeTransformers {
|
||||
transformerDocs := doc.CollectDocuments(k.Transformers)
|
||||
transformerDocs := doc.CollectDocuments(k.Transformers, "transformer")
|
||||
res = append(res, transformerDocs...)
|
||||
}
|
||||
|
||||
@@ -106,7 +106,8 @@ func (doc *KustomizationDocument) GetResources(
|
||||
|
||||
// CollectDocuments construct a Document for each path in paths, and return
|
||||
// a slice of Document pointers.
|
||||
func (doc *KustomizationDocument) CollectDocuments(paths []string) []*Document {
|
||||
func (doc *KustomizationDocument) CollectDocuments(
|
||||
paths []string, fileType string) []*Document {
|
||||
docs := make([]*Document, 0, len(paths))
|
||||
for _, r := range paths {
|
||||
if strings.TrimSpace(r) == "" {
|
||||
@@ -117,6 +118,7 @@ func (doc *KustomizationDocument) CollectDocuments(paths []string) []*Document {
|
||||
log.Printf("CollectDocuments error: %v\n", err)
|
||||
continue
|
||||
}
|
||||
next.FileType = fileType
|
||||
docs = append(docs, &next)
|
||||
}
|
||||
return docs
|
||||
|
||||
Reference in New Issue
Block a user