helm

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitLabChartName = "gitlab"
)

Variables

View Source
var FalseSelector = func(_ runtime.Object) bool {
	return false
}

FalseSelector is an ObjectSelector that selects no object.

View Source
var TrueSelector = func(_ runtime.Object) bool {
	return true
}

TrueSelector is an ObjectSelector that selects all objects.

Functions

func AvailableChartVersions

func AvailableChartVersions() []string

AvailableChartVersions lists the version of available GitLab Charts.

func ChartVersionSupported

func ChartVersionSupported(version string) (bool, error)

func GetChartVersion

func GetChartVersion() string

func IsTypeMistmatchError

func IsTypeMistmatchError(err error) bool

IsTypeMistmatchError returns true if the error is raised because of type mistmatch.

func NewTypeMistmatchError

func NewTypeMistmatchError(expected, observed interface{}) error

Types

type Builder

type Builder interface {

	// Chart returns the Helm chart that will be rendered.
	Chart() *chart.Chart

	// Namespace returns namespace of the template.
	Namespace() string

	// SetNamespace sets namespace of the template. Changes will not take effect after rendering the
	// template.
	SetNamespace(namespace string)

	// ReleaseName returns release name of the template.
	ReleaseName() string

	// SetReleaseName sets release name of the template. Changes will not take effect after rendering
	// the template.
	SetReleaseName(releaseName string)

	// HooksDisabled returns true if hooks are disabled for the template.
	HooksDisabled() bool

	// DisableHooks disables hooks for the template. Changes will not take effect after rendering the
	// template.
	DisableHooks()

	// EnableHooks enables hooks for the template. Changes will not take effect after rendering the
	// template.
	EnableHooks()

	// Render renders the template with the provided values and parses the objects.
	Render(values support.Values) (Template, error)
}

Builder provides an interface to build and render a Helm template.

func NewBuilder

func NewBuilder(name, version string) (Builder, error)

NewBuilder creates a new builder interface for Helm template.

type ObjectEditor

type ObjectEditor = func(runtime.Object) error

ObjectEditor represents a method for editing objects.

type ObjectSelector

type ObjectSelector = func(runtime.Object) bool

ObjectSelector represents a boolean expression for selecting objects.

type Query

type Query interface {
	// Template returns the attached template that this interface queries.
	Template() Template

	// Reset clears the query cache when applicable.
	Reset()

	// ObjectsByKind returns all objects that match the kind specifier. Type specifier can be in the form of
	// Kind, Kind.group, Kind.version.group.
	ObjectsByKind(kindArg string) []client.Object

	// ObjectByKindAndName returns the object that match the kind specifier and has the provided name.
	ObjectByKindAndName(kindArg, name string) client.Object

	// ObjectByKindAndLabels returns the all objects that match the kind specifier and have the labels.
	ObjectsByKindAndLabels(kindArg string, labels map[string]string) []client.Object

	// ObjectByKindAndLabels returns the all objects that match the kind specifier and have the labels.
	ObjectByKindAndComponent(kindArg, component string) client.Object
}

Query provides access methods to query Helm templates.

type Template

type Template interface {
	// Namespace returns namespace of the template. Builder sets this value and it can not be changed.
	Namespace() string

	// ReleaseName returns release name of the template. Builder sets this value and it can not be
	// changed.
	ReleaseName() string

	// Warnings returns the list of warnings that occurred while rendering this template. Any error
	// that can be ignored is a warning.
	Warnings() []error

	// Objects returns the list of all available objects.
	Objects() []runtime.Object

	// GetObjects returns all objects that match the selector.
	GetObjects(selector ObjectSelector) ([]runtime.Object, error)

	// AddObject adds a new object to the template. Implementing this method is optional. When the
	// operation is not supported it returns an error.
	AddObject(object runtime.Object) error

	// DeleteObjects deletes all objects that match the selector and returns the number of deleted
	// objects. Implementing this method is optional. When the operation is not supported it returns
	// an error.
	DeleteObjects(selector ObjectSelector) (int, error)

	// ReplaceObject replaces the first object that matches the selector with the new object.
	// Implementing this method is optional. When the operation is not supported it returns an
	// error.
	ReplaceObject(selector ObjectSelector, object runtime.Object) (runtime.Object, error)

	// EditObjects edits all objects that the editor can handle in place and returns the number of
	// edited objects. Implementing this method is optional. When the operation is not supported it
	// returns an error.
	EditObjects(editor ObjectEditor) (int, error)

	// Query returns the query interface for this template. It is more convenient to use the query
	// interface to retrieve objects from a template.
	Query() Query
}

Template represents a Helm template and provides methods to query and edit objects that are loaded from the after rendering it.

Jump to

Keyboard shortcuts

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