MCPcopy
hub / github.com/helm/helm / CRDObjects

Method CRDObjects

pkg/chart/v2/chart.go:163–177  ·  view source on GitHub ↗

CRDObjects returns a list of CRD objects in the 'crds/' directory of a Helm chart & subcharts

()

Source from the content-addressed store, hash-verified

161
162// CRDObjects returns a list of CRD objects in the 'crds/' directory of a Helm chart & subcharts
163func (ch *Chart) CRDObjects() []CRD {
164 crds := []CRD{}
165 // Find all resources in the crds/ directory
166 for _, f := range ch.Files {
167 if strings.HasPrefix(f.Name, "crds/") && hasManifestExtension(f.Name) {
168 mycrd := CRD{Name: f.Name, Filename: filepath.Join(ch.ChartFullPath(), f.Name), File: f}
169 crds = append(crds, mycrd)
170 }
171 }
172 // Get CRDs from dependencies, too.
173 for _, dep := range ch.Dependencies() {
174 crds = append(crds, dep.CRDObjects()...)
175 }
176 return crds
177}
178
179func hasManifestExtension(fname string) bool {
180 ext := filepath.Ext(fname)

Callers 10

TestCRDObjectsFunction · 0.95
RunWithContextMethod · 0.95
CrdsFunction · 0.45
RunMethod · 0.45
TestInstallCRDsFunction · 0.45
renderResourcesMethod · 0.45

Calls 3

ChartFullPathMethod · 0.95
DependenciesMethod · 0.95
hasManifestExtensionFunction · 0.70

Tested by 6

TestCRDObjectsFunction · 0.76
TestInstallCRDsFunction · 0.36