install

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YamlDocumentSeparator = "\n---\n"
	CrdKindName           = "CustomResourceDefinition"
	NotesFileName         = "NOTES.txt"
)

Variables

View Source
var ExcludeNonCrds = func(input []manifest.Manifest) (output []manifest.Manifest, names []string, err error) {
	return excludeByMatcher(input, nonCrdInstallMatcher)
}

Functions

func CheckKnativeInstallation

func CheckKnativeInstallation() (isInstalled bool, isOurs bool, err error)

func GetHelmArchive

func GetHelmArchive(chartArchiveUri string) (*chart.Chart, error)

Returns the Helm chart archive located at the given URI (can be either an http(s) address or a file path)

func GetValuesFromFile

func GetValuesFromFile(helmChart *chart.Chart, fileName string) (*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 InstallManifest

func InstallManifest(manifest []byte, isDryRun bool, allowedKinds []string, expectedLabels map[string]string) error

noinspection GoNameStartsWithPackageName

func Kubectl

func Kubectl(stdin io.Reader, args ...string) error

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 SkipKnativeInstall added in v0.12.0

func SkipKnativeInstall() (bool, error)

If this is a knative deployment, we have to check whether knative itself is already installed in the cluster. If knative is already installed and we don't own it, don't install/upgrade/uninstall it (It's okay to update the installation if we own it).

func WaitForCrdsToBeRegistered

func WaitForCrdsToBeRegistered(crds []string, timeout, interval time.Duration) error

Blocks until the given CRDs have been registered.

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

type KubeCli added in v0.12.0

type KubeCli interface {
	Kubectl(stdin io.Reader, args ...string) error
}

type ManifestFilterFunc

type ManifestFilterFunc func(input []manifest.Manifest) (output []manifest.Manifest, err error)

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 ExcludeNonKnative ManifestFilterFunc = func(input []manifest.Manifest) (output []manifest.Manifest, err error) {
	for _, man := range input {
		if !strings.Contains(man.Name, "knative") {
			continue
		}
		output = append(output, man)
	}
	return output, nil
}
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(skipKnativeInstall bool) ManifestFilterFunc

Jump to

Keyboard shortcuts

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