@ -135,7 +135,7 @@ func (ch *Chart) CRDs() []*File {
files := [ ] * File { }
files := [ ] * File { }
// Find all resources in the crds/ directory
// Find all resources in the crds/ directory
for _ , f := range ch . Files {
for _ , f := range ch . Files {
if strings . HasPrefix ( f . Name , "crds/" ) {
if strings . HasPrefix ( f . Name , "crds/" ) && hasManifestExtension ( f . Name ) {
files = append ( files , f )
files = append ( files , f )
}
}
}
}
@ -151,7 +151,7 @@ func (ch *Chart) CRDObjects() []CRD {
crds := [ ] CRD { }
crds := [ ] CRD { }
// Find all resources in the crds/ directory
// Find all resources in the crds/ directory
for _ , f := range ch . Files {
for _ , f := range ch . Files {
if strings . HasPrefix ( f . Name , "crds/" ) {
if strings . HasPrefix ( f . Name , "crds/" ) && hasManifestExtension ( f . Name ) {
mycrd := CRD { Name : f . Name , Filename : filepath . Join ( ch . ChartFullPath ( ) , f . Name ) , File : f }
mycrd := CRD { Name : f . Name , Filename : filepath . Join ( ch . ChartFullPath ( ) , f . Name ) , File : f }
crds = append ( crds , mycrd )
crds = append ( crds , mycrd )
}
}
@ -162,3 +162,8 @@ func (ch *Chart) CRDObjects() []CRD {
}
}
return crds
return crds
}
}
func hasManifestExtension ( fname string ) bool {
ext := filepath . Ext ( fname )
return strings . EqualFold ( ext , ".yaml" ) || strings . EqualFold ( ext , ".yml" ) || strings . EqualFold ( ext , ".json" )
}