Merge pull request #219 from Liujingfang1/glob

remove glob support from kustomization.yaml
This commit is contained in:
Jeff Regan
2018-07-30 17:03:53 -07:00
committed by GitHub
3 changed files with 14 additions and 17 deletions

View File

@@ -72,7 +72,7 @@ resources:
namespace: namespace-b namespace: namespace-b
EOF EOF
cat <<EOF >$NSA/namespace.yaml cat <<EOF >$NSB/namespace.yaml
apiVersion: v1 apiVersion: v1
kind: Namespace kind: Namespace
metadata: metadata:

View File

@@ -6,4 +6,6 @@ commonLabels:
commonAnnotations: commonAnnotations:
note: This is a test annotation note: This is a test annotation
resources: resources:
- resources/*.yaml - resources/deployment.yaml
- resources/networkpolicy.yaml
- resources/service.yaml

View File

@@ -134,18 +134,15 @@ func NewResourceSliceFromPatches(
loader loader.Loader, paths []string) ([]*resource.Resource, error) { loader loader.Loader, paths []string) ([]*resource.Resource, error) {
var result []*resource.Resource var result []*resource.Resource
for _, path := range paths { for _, path := range paths {
contents, err := loader.GlobLoad(path) content, err := loader.Load(path)
if err != nil { if err != nil {
return nil, err return nil, err
} }
for p, content := range contents {
res, err := newResourceSliceFromBytes(content) res, err := newResourceSliceFromBytes(content)
if err != nil { if err != nil {
return nil, internal.Handler(err, p) return nil, internal.Handler(err, path)
} }
result = append(result, res...) result = append(result, res...)
}
} }
return result, nil return result, nil
} }
@@ -154,18 +151,16 @@ func NewResourceSliceFromPatches(
func NewResMapFromFiles(loader loader.Loader, paths []string) (ResMap, error) { func NewResMapFromFiles(loader loader.Loader, paths []string) (ResMap, error) {
var result []ResMap var result []ResMap
for _, path := range paths { for _, path := range paths {
contents, err := loader.GlobLoad(path) content, err := loader.Load(path)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "Load from path "+path+" failed") return nil, errors.Wrap(err, "Load from path "+path+" failed")
} }
for p, content := range contents {
res, err := newResMapFromBytes(content) res, err := newResMapFromBytes(content)
if err != nil { if err != nil {
return nil, internal.Handler(err, p) return nil, internal.Handler(err, path)
} }
result = append(result, res) result = append(result, res)
} }
}
return MergeWithoutOverride(result...) return MergeWithoutOverride(result...)
} }