Skip to content

Commit a7001e3

Browse files
authored
Merge pull request #129 from joshmeranda/crd-upstream
Support pulling crds from an upstream
2 parents b887354 + e5814ba commit a7001e3

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

pkg/charts/additionalchart.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ func (c *AdditionalChart) Prepare(rootFs, pkgFs billy.Filesystem, mainChartUpstr
117117
if err != nil {
118118
return fmt.Errorf("encountered error while trying to get the main chart's working directory: %s", err)
119119
}
120+
if c.Upstream != nil {
121+
logrus.Infof("pulling CRD upstream")
122+
u := *c.Upstream
123+
if err := u.Pull(rootFs, pkgFs, filepath.Join(mainChartWorkingDir, path.ChartCRDDir)); err != nil {
124+
return fmt.Errorf("encountered error while trying to pull upstream into %s: %s", mainChartWorkingDir, err)
125+
}
126+
}
120127
exists, err := filesystem.PathExists(pkgFs, filepath.Join(mainChartWorkingDir, path.ChartCRDDir))
121128
if err != nil {
122129
return fmt.Errorf("encountered error while trying to check if %s exists: %s", filepath.Join(mainChartWorkingDir, path.ChartCRDDir), err)

pkg/charts/parse.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ func GetChartFromOptions(opt options.ChartOptions) (Chart, error) {
162162
// GetAdditionalChartFromOptions returns an AdditionalChart based on the options provided
163163
func GetAdditionalChartFromOptions(opt options.AdditionalChartOptions) (AdditionalChart, error) {
164164
var a AdditionalChart
165-
if opt.UpstreamOptions != nil && opt.CRDChartOptions != nil {
166-
return a, fmt.Errorf("invalid additional chart options provided: cannot define both UpstreamOptions and CRDChartOptions")
167-
}
168165
if opt.UpstreamOptions == nil && opt.CRDChartOptions == nil {
169166
return a, fmt.Errorf("cannot parse additional chart options: you must either provide a URL (UpstreamOptions) or provide CRDChartOptions")
170167
}

pkg/options/additionalchart.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ package options
44
type AdditionalChartOptions struct {
55
// WorkingDir is the working directory for this chart within packages/<package-name>
66
WorkingDir string `yaml:"workingDir"`
7-
// UpstreamOptions is any options provided on how to get this chart from upstream. It is mutually exclusive with CRDChartOptions
7+
// UpstreamOptions is any options provided on how to get this chart from upstream.
88
UpstreamOptions *UpstreamOptions `yaml:"upstreamOptions,omitempty"`
9-
// CRDChartOptions is any options provided on how to generate a CRD chart. It is mutually exclusive with UpstreamOptions
9+
// CRDChartOptions is any options provided on how to generate a CRD chart.
1010
CRDChartOptions *CRDChartOptions `yaml:"crdOptions,omitempty"`
1111
// IgnoreDependencies drops certain dependencies from the list that is parsed from upstream
1212
IgnoreDependencies []string `yaml:"ignoreDependencies"`

templates/template/docs/packages.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ additionalCharts:
1616
# These contain other charts that you would like to package alongside this chart
1717
- workingDir: # same as above
1818
upstreamOptions:
19-
# Mutually exclusive with crdOptions
2019
url: # same as above
2120
subdirectory: # optional, same as above
2221
commit: # optional, same as above
2322
crdOptions:
24-
# Mutually exclusive with upstreamOptions
2523
templateDirectory: # A directory within packages/<package>/template that will contain a template for your CRD chart
2624
crdDirectory: # Where to place your CRDs within a CRD chart (e.g. crds for default charts)
2725
addCRDValidationToMainChart: # Whether to add additional validation to your main chart to check that the CRD chart is installed.

0 commit comments

Comments
 (0)