charts

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 25 Imported by: 5

Documentation

Index

Constants

View Source
const ValidateInstallCRDContentsFmt = `` /* 496-byte string literal not displayed */

ValidateInstallCRDContentsFmt is the format for the contents of ChartValidateInstallCRDFile

View Source
const ValidateInstallCRDPerGVKFmt = `# {{- set $found "%s" false -}}`

ValidateInstallCRDPerGVKFmt is the format that the GroupVersionKind of each CRD placed in ValidateInstallCRDContentsFmt needs to have

Variables

View Source
var (
	// ErrRemoteDoesNotExist indicates that the remote does not exist in the current repository
	ErrRemoteDoesNotExist = errors.New("Repository does not have any matching remotes")
)

Functions

func AddCRDValidationToChart

func AddCRDValidationToChart(fs billy.Filesystem, helmChartPathWithoutCRDs, helmChartPathWithCRDs, crdsDir string) error

AddCRDValidationToChart adds the validate-install-crd.yaml to helmChartPathWithoutCRDs based on CRDs located in crdsDir within helmChartPathWithCRDs

func GenerateCRDChartFromTemplate

func GenerateCRDChartFromTemplate(fs billy.Filesystem, dstHelmChartPath, templateDir, crdsDir string) error

GenerateCRDChartFromTemplate copies templateDir over to dstPath

func GetDependencyMap

func GetDependencyMap(pkgFs billy.Filesystem, gcRootDir string) (map[string]*Chart, error)

GetDependencyMap gets a map between a dependency's name and a Chart representing that dependency for all rooted at gcRootDir

func GetUpstream

func GetUpstream(opt options.UpstreamOptions) (puller.Puller, error)

GetUpstream returns the appropriate Upstream given the options provided

func LoadDependencies

func LoadDependencies(pkgFs billy.Filesystem, mainHelmChartPath string, gcRootDir string) error

LoadDependencies takes all existing subcharts in the package and loads them into the gcRootDir as dependencies

func PrepareDependencies

func PrepareDependencies(rootFs, pkgFs billy.Filesystem, mainHelmChartPath string, gcRootDir string) error

PrepareDependencies prepares all of the dependencies of a given chart and regenerates the requirements.yaml or Chart.yaml

func RemoveCRDValidationFromChart

func RemoveCRDValidationFromChart(fs billy.Filesystem, helmChartPath string) error

RemoveCRDValidationFromChart removes the ChartValidateInstallCRDFile from a given chart

func UpdateHelmMetadataWithDependencies

func UpdateHelmMetadataWithDependencies(fs billy.Filesystem, mainHelmChartPath string, dependencyMap map[string]*Chart) error

UpdateHelmMetadataWithDependencies updates either the requirements.yaml or Chart.yaml for the dependencies provided For each dependency in dependencies, it will replace the entry in the requirements.yaml / Chart.yaml with a URL pointing to the local chart archive

Types

type AdditionalChart

type AdditionalChart struct {
	// WorkingDir represents the working directory of this chart
	WorkingDir string `yaml:"workingDir" default:"charts"`
	// Upstream represents any options that are configurable for upstream charts
	Upstream *puller.Puller `yaml:"upstream"`
	// CRDChartOptions represents any options that are configurable for CRD charts
	CRDChartOptions *options.CRDChartOptions `yaml:"crdChart"`
	// contains filtered or unexported fields
}

AdditionalChart represents any additional charts packaged along with the main chart in a package

func GetAdditionalChartFromOptions

func GetAdditionalChartFromOptions(opt options.AdditionalChartOptions) (AdditionalChart, error)

GetAdditionalChartFromOptions returns an AdditionalChart based on the options provided

func (*AdditionalChart) ApplyMainChanges

func (c *AdditionalChart) ApplyMainChanges(pkgFs billy.Filesystem) error

ApplyMainChanges applies any changes on the main chart introduced by the AdditionalChart

func (*AdditionalChart) GenerateChart

func (c *AdditionalChart) GenerateChart(rootFs, pkgFs billy.Filesystem, packageVersion *int, version *semver.Version, packageAssetsDirpath, packageChartsDirpath string, omitBuildMetadataOnExport bool) error

GenerateChart generates the chart and stores it in the assets and charts directory

func (*AdditionalChart) GeneratePatch

func (c *AdditionalChart) GeneratePatch(rootFs, pkgFs billy.Filesystem) error

GeneratePatch generates a patch on a forked Helm chart based on local changes

func (*AdditionalChart) GeneratedChangesRootDir

func (c *AdditionalChart) GeneratedChangesRootDir() string

GeneratedChangesRootDir stored the directory rooted at the package level where generated changes for this chart can be found

func (*AdditionalChart) OriginalDir

func (c *AdditionalChart) OriginalDir() string

OriginalDir returns a working directory where we can place the original chart from upstream

func (*AdditionalChart) Prepare

func (c *AdditionalChart) Prepare(rootFs, pkgFs billy.Filesystem, mainChartUpstreamVersion *string) error

Prepare pulls in a package based on the spec to the local git repository

func (*AdditionalChart) RevertMainChanges

func (c *AdditionalChart) RevertMainChanges(pkgFs billy.Filesystem) error

RevertMainChanges reverts any changes on the main chart introduced by the AdditionalChart

type Chart

type Chart struct {
	// Upstream represents where the chart is sourced from
	Upstream puller.Puller `yaml:"upstream"`
	// WorkingDir represents the working directory of this chart
	WorkingDir string `yaml:"workingDir" default:"charts"`
	// contains filtered or unexported fields
}

Chart represents the main chart in a given package

func GetChartFromOptions

func GetChartFromOptions(opt options.ChartOptions) (Chart, error)

GetChartFromOptions returns a Chart based on the options provided

func (*Chart) GenerateChart

func (c *Chart) GenerateChart(rootFs, pkgFs billy.Filesystem, packageVersion *int, version *semver.Version, packageAssetsDirpath, packageChartsDirpath string, omitBuildMetadataOnExport bool) error

GenerateChart generates the chart and stores it in the assets and charts directory

func (*Chart) GeneratePatch

func (c *Chart) GeneratePatch(rootFs, pkgFs billy.Filesystem) error

GeneratePatch generates a patch on a forked Helm chart based on local changes

func (*Chart) GeneratedChangesRootDir

func (c *Chart) GeneratedChangesRootDir() string

GeneratedChangesRootDir stored the directory rooted at the package level where generated changes for this chart can be found

func (*Chart) OriginalDir

func (c *Chart) OriginalDir() string

OriginalDir returns a working directory where we can place the original chart from upstream

func (*Chart) Prepare

func (c *Chart) Prepare(rootFs, pkgFs billy.Filesystem) error

Prepare pulls in a package based on the spec to the local git repository

type Local

type Local struct{}

Local represents a local chart that exists within the package itself

func (Local) GetOptions

func (u Local) GetOptions() options.UpstreamOptions

GetOptions returns the path used to construct this upstream

func (Local) IsWithinPackage

func (u Local) IsWithinPackage() bool

IsWithinPackage returns whether this upstream already exists within the package

func (Local) Pull

func (u Local) Pull(rootFs, fs billy.Filesystem, path string) error

Pull grabs the Helm chart by preparing the package itself

func (Local) String

func (u Local) String() string

type LocalPackage

type LocalPackage struct {
	// Name represents the name of the package
	Name         string
	Subdirectory *string
}

LocalPackage represents source that is a package

func (LocalPackage) GetOptions

func (u LocalPackage) GetOptions() options.UpstreamOptions

GetOptions returns the path used to construct this upstream

func (LocalPackage) IsWithinPackage

func (u LocalPackage) IsWithinPackage() bool

IsWithinPackage returns whether this upstream already exists within the package

func (LocalPackage) Pull

func (u LocalPackage) Pull(rootFs, fs billy.Filesystem, path string) error

Pull grabs the package

func (LocalPackage) String

func (u LocalPackage) String() string

type Package

type Package struct {
	Chart `yaml:",inline"`

	// Name is the name of the package
	Name string `yaml:"name"`
	// Version represents the version of the package. It will override other values if it exists
	Version *semver.Version `yaml:"version,omitempty"`
	// PackageVersion represents the current version of the package. It needs to be incremented whenever there are changes
	PackageVersion *int `yaml:"packageVersion"`
	// AdditionalCharts are other charts that should be packaged together with this
	AdditionalCharts []*AdditionalChart `yaml:"additionalCharts,omitempty"`
	// DoNotRelease represents a boolean flag that indicates a package should not be tracked in make charts
	DoNotRelease bool `yaml:"doNotRelease,omitempty"`
	// contains filtered or unexported fields
}

Package represents the configuration of a particular forked Helm chart

func GetPackage

func GetPackage(rootFs billy.Filesystem, name string) (*Package, error)

GetPackage returns a Package based on the options provided

func GetPackages

func GetPackages(repoRoot string, specificPackage string) ([]*Package, error)

GetPackages returns all packages found within the repository. If there is a specific package provided, it will return just that Package in the list

func (*Package) Clean

func (p *Package) Clean() error

Clean removes all other files except for the package.yaml, patch, and overlay/ files from a package

func (*Package) GenerateCharts

func (p *Package) GenerateCharts(omitBuildMetadataOnExport bool) error

GenerateCharts creates Helm chart archives for each chart after preparing it

func (*Package) GeneratePatch

func (p *Package) GeneratePatch() error

GeneratePatch generates a patch on a forked Helm chart based on local changes

func (*Package) Prepare

func (p *Package) Prepare() error

Prepare pulls in a package based on the spec to the local git repository

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL