Documentation ¶
Index ¶
- Constants
- Variables
- func GetHelmArchive(chartArchiveUri string) (*chart.Chart, error)
- func GetValuesFromFile(helmChart *chart.Chart, fileName string) (*chart.Config, error)
- func GetValuesFromFileIncludingExtra(helmChart *chart.Chart, fileName string, userValuesFileName string, ...) (*chart.Config, error)
- func IsEmptyManifest(manifest string) bool
- func Kubectl(stdin io.Reader, args ...string) error
- func KubectlApply(manifest []byte, extraArgs ...string) error
- func KubectlApplyOut(manifest []byte, extraArgs ...string) ([]byte, error)
- func KubectlDelete(manifest []byte, extraArgs ...string) error
- func KubectlOut(stdin io.Reader, args ...string) ([]byte, error)
- func RenderChart(helmChart *chart.Chart, overrideValues *chart.Config, ...) ([]byte, error)
- func SetVerbose(b bool)
- type CmdKubectl
- type KubeCli
- type ManifestFilterFunc
- type MockKubectl
- type ResourceMatcherFunc
- type ResourceType
- type ValuesCallback
Constants ¶
const ( YamlDocumentSeparator = "\n---\n" CrdKindName = "CustomResourceDefinition" NotesFileName = "NOTES.txt" )
Variables ¶
var ExcludeMatchingResources = func(matcherFunc ResourceMatcherFunc) ManifestFilterFunc { if matcherFunc == nil { return IdentityFilterFunc } return func(input []manifest.Manifest) (output []manifest.Manifest, err error) { manifest, _, err := excludeByMatcher(input, matcherFunc) return manifest, err } }
Functions ¶
func GetHelmArchive ¶
Returns the Helm chart archive located at the given URI (can be either an http(s) address or a file path)
func GetValuesFromFile ¶
func GetValuesFromFileIncludingExtra ¶ added in v0.13.0
func GetValuesFromFileIncludingExtra(helmChart *chart.Chart, fileName string, userValuesFileName string, extraValues chartutil.Values, valueOptions ...ValuesCallback) (*chart.Config, error)
Searches for the value file with the given name in the chart and returns its raw content. NOTE: this also sets the namespace.create attribute to 'true'.
func IsEmptyManifest ¶ added in v0.13.0
func KubectlApply ¶ added in v0.13.0
func KubectlApplyOut ¶ added in v0.20.3
func KubectlDelete ¶ added in v0.17.0
func RenderChart ¶
func RenderChart(helmChart *chart.Chart, overrideValues *chart.Config, renderOptions renderutil.Options, filterFunctions ...ManifestFilterFunc) ([]byte, error)
Renders the content of the given Helm chart archive:
- helmChart: the Gloo helm chart archive
- overrideValues: value to override the chart defaults. NOTE: passing `nil` means "ignore the chart's default values"!
- renderOptions: options to be used in the render
- filterFunctions: a collection of functions that can be used to filter and transform the contents of the manifest. Will be applied in the given order.
func SetVerbose ¶ added in v0.17.0
func SetVerbose(b bool)
Types ¶
type CmdKubectl ¶ added in v0.12.0
type CmdKubectl struct{}
func (*CmdKubectl) Kubectl ¶ added in v0.12.0
func (k *CmdKubectl) Kubectl(stdin io.Reader, args ...string) error
func (*CmdKubectl) KubectlOut ¶ added in v0.21.0
type ManifestFilterFunc ¶
This type represents a function that can be used to filter and transform a list of manifests. It returns three values:
- skip: if true, the input manifest will be excluded from the output
- content: if skip is false, this value will be included in the output manifest
- err: if != nil, the whole manifest retrieval operation will fail
var ExcludeCrds ManifestFilterFunc = func(input []manifest.Manifest) (output []manifest.Manifest, err error) {
manifest, _, err := excludeByMatcher(input, crdInstallMatcher)
return manifest, err
}
Filters out any CRD from each manifest
var ExcludeEmptyManifests ManifestFilterFunc = func(input []manifest.Manifest) ([]manifest.Manifest, error) { var output []manifest.Manifest for _, manifest := range input { if !IsEmptyManifest(manifest.Content) { output = append(output, manifest) } } return output, nil }
Returns only non-empty manifests
var ExcludeNotes ManifestFilterFunc = func(input []manifest.Manifest) (output []manifest.Manifest, err error) { for _, man := range input { if strings.HasSuffix(man.Name, NotesFileName) { continue } output = append(output, man) } return }
Filters out NOTES.txt files
var ExcludePreInstall ManifestFilterFunc = func(input []manifest.Manifest) (output []manifest.Manifest, err error) {
manifest, _, err := excludeByMatcher(input, preInstallMatcher)
return manifest, err
}
Filters out any pre-install from each manifest
var IncludeOnlyPreInstall ManifestFilterFunc = func(input []manifest.Manifest) (output []manifest.Manifest, err error) {
manifest, _, err := excludeByMatcher(input, nonPreInstallMatcher)
return manifest, err
}
Filters out anything but pre-install
func KnativeResourceFilterFunction ¶ added in v0.11.2
func KnativeResourceFilterFunction(skipKnative bool) ManifestFilterFunc
type MockKubectl ¶ added in v0.21.1
func NewMockKubectl ¶ added in v0.21.1
func NewMockKubectl(cmds []string, stdoutLines []string) *MockKubectl
func (*MockKubectl) Kubectl ¶ added in v0.21.1
func (k *MockKubectl) Kubectl(stdin io.Reader, args ...string) error
func (*MockKubectl) KubectlOut ¶ added in v0.21.1
type ResourceMatcherFunc ¶ added in v0.13.0
type ResourceMatcherFunc func(resource ResourceType) (bool, error)
type ResourceType ¶ added in v0.13.0
type ResourceType struct { Metadata v1.ObjectMeta v1.TypeMeta }
We need to define this ourselves, because if we unmarshal into `apiextensions.CustomResourceDefinition` we don't get the ObjectMeta (in the yaml they are nested under `metadata`, but the k8s struct has them as top level fields...)
func GetResources ¶ added in v0.13.0
func GetResources(manifest string) ([]ResourceType, error)
type ValuesCallback ¶ added in v0.18.9
type ValuesCallback func(config *generate.HelmConfig)
use to overwrite / modify values file before passing to helm