helm

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterRoleBindingSelector = func(o runtime.Object) bool {
	_, ok := o.(*rbacv1.ClusterRoleBinding)
	return ok
}

ClusterRoleBindingSelector is an ObjectSelector that selects ClusterRoleBinding objects.

View Source
var ClusterRoleSelector = func(o runtime.Object) bool {
	_, ok := o.(*rbacv1.ClusterRole)
	return ok
}

ClusterRoleSelector is an ObjectSelector that selects ClusterRole objects.

View Source
var ConfigMapSelector = func(o runtime.Object) bool {
	_, ok := o.(*corev1.ConfigMap)
	return ok
}

ConfigMapSelector is an ObjectSelector that selects ConfigMap objects.

View Source
var CronJobSelector = func(o runtime.Object) bool {
	_, ok := o.(*batchv1beta1.CronJob)
	return ok
}

CronJobSelector is an ObjectSelector that selects CronJob objects.

View Source
var DaemonSetSelector = func(o runtime.Object) bool {
	_, ok := o.(*appsv1.DaemonSet)
	return ok
}

DaemonSetSelector is an ObjectSelector that selects DaemonSet objects.

View Source
var DeploymentSelector = func(o runtime.Object) bool {
	_, ok := o.(*appsv1.Deployment)
	return ok
}

DeploymentSelector is an ObjectSelector that selects Deployment objects.

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

FalseSelector is an ObjectSelector that selects no object.

View Source
var HorizontalPodAutoscalerSelector = func(o runtime.Object) bool {
	_, ok := o.(*autoscalingv2beta1.HorizontalPodAutoscaler)
	return ok
}

HorizontalPodAutoscalerSelector is an ObjectSelector that selects HorizontalPodAutoscaler objects.

View Source
var IngressSelector = func(o runtime.Object) bool {
	_, ok := o.(*extensionsv1beta1.Ingress)
	if !ok {
		_, ok = o.(*networkingv1beta1.Ingress)
	}
	return ok
}

IngressSelector is an ObjectSelector that selects Ingress objects.

View Source
var JobSelector = func(o runtime.Object) bool {
	_, ok := o.(*batchv1.Job)
	return ok
}

JobSelector is an ObjectSelector that selects Job objects.

View Source
var NetworkPolicySelector = func(o runtime.Object) bool {
	_, ok := o.(*networkingv1.NetworkPolicy)
	return ok
}

NetworkPolicySelector is an ObjectSelector that selects NetworkPolicy objects.

View Source
var PersistentVolumeClaimSelector = func(o runtime.Object) bool {
	_, ok := o.(*corev1.PersistentVolumeClaim)
	return ok
}

PersistentVolumeClaimSelector is an ObjectSelector that selects PersistentVolumeClaim objects.

View Source
var PersistentVolumeSelector = func(o runtime.Object) bool {
	_, ok := o.(*corev1.PersistentVolume)
	return ok
}

PersistentVolumeSelector is an ObjectSelector that selects PersistentVolume objects.

View Source
var PodDisruptionBudgetSelector = func(o runtime.Object) bool {
	_, ok := o.(*policyv1beta1.PodDisruptionBudget)
	return ok
}

PodDisruptionBudgetSelector is an ObjectSelector that selects PodDisruptionBudget objects.

View Source
var PodSelector = func(o runtime.Object) bool {
	_, ok := o.(*corev1.Pod)
	return ok
}

PodSelector is an ObjectSelector that selects Pod objects.

View Source
var RoleBindingSelector = func(o runtime.Object) bool {
	_, ok := o.(*rbacv1.RoleBinding)
	return ok
}

RoleBindingSelector is an ObjectSelector that selects RoleBinding objects.

View Source
var RoleSelector = func(o runtime.Object) bool {
	_, ok := o.(*rbacv1.Role)
	return ok
}

RoleSelector is an ObjectSelector that selects Role objects.

View Source
var SecretSelector = func(o runtime.Object) bool {
	_, ok := o.(*corev1.Secret)
	return ok
}

SecretSelector is an ObjectSelector that selects Secret objects.

View Source
var ServiceAccountSelector = func(o runtime.Object) bool {
	_, ok := o.(*corev1.ServiceAccount)
	return ok
}

ServiceAccountSelector is an ObjectSelector that selects ServiceAccount objects.

View Source
var ServiceSelector = func(o runtime.Object) bool {
	_, ok := o.(*corev1.Service)
	return ok
}

ServiceSelector is an ObjectSelector that selects Service objects.

View Source
var StatefulSetSelector = func(o runtime.Object) bool {
	_, ok := o.(*appsv1.StatefulSet)
	return ok
}

StatefulSetSelector is an ObjectSelector that selects StatefulSet objects.

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

TrueSelector is an ObjectSelector that selects all objects.

Functions

func IsTypeMistmatchError

func IsTypeMistmatchError(err error) bool

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

Types

type Builder

type Builder interface {

	// Chart return the source of the chart that will be rendered. This field is immutable and must
	// be specified when Builder is initialized.
	Chart() string

	// 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 Values) (Template, error)
}

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

func NewBuilder

func NewBuilder(chart string) Builder

NewBuilder creates a new builder interface for Helm template.

type ObjectEditor

type ObjectEditor = func(runtime.Object) error

ObjectEditor represents a method for editing objects

func NewClusterRoleBindingEditor

func NewClusterRoleBindingEditor(delegate func(*rbacv1.ClusterRoleBinding) error) ObjectEditor

NewClusterRoleBindingEditor builds a new ObjectEditor for ClusterRoleBinding objects with the provided delegate.

func NewClusterRoleEditor

func NewClusterRoleEditor(delegate func(*rbacv1.ClusterRole) error) ObjectEditor

NewClusterRoleEditor builds a new ObjectEditor for ClusterRole objects with the provided delegate.

func NewConfigMapEditor

func NewConfigMapEditor(delegate func(*corev1.ConfigMap) error) ObjectEditor

NewConfigMapEditor builds a new ObjectEditor for ConfigMap objects.

func NewCronJobEditor

func NewCronJobEditor(delegate func(*batchv1beta1.CronJob) error) ObjectEditor

NewCronJobEditor builds a new ObjectEditor for CronJob objects with the provided delegate.

func NewDaemonSetEditor

func NewDaemonSetEditor(delegate func(*appsv1.DaemonSet) error) ObjectEditor

NewDaemonSetEditor builds a new ObjectEditor for DaemonSet objects with the provided delegate.

func NewDeploymentEditor

func NewDeploymentEditor(delegate func(*appsv1.Deployment) error) ObjectEditor

NewDeploymentEditor builds a new ObjectEditor for Deployment objects with the provided delegate.

func NewHorizontalPodAutoscalerEditor

func NewHorizontalPodAutoscalerEditor(delegate func(*autoscalingv2beta1.HorizontalPodAutoscaler) error) ObjectEditor

NewHorizontalPodAutoscalerEditor builds a new ObjectEditor for HorizontalPodAutoscaler objects with the provided delegate.

func NewIngressEditor

func NewIngressEditor(delegate func(*extensionsv1beta1.Ingress) error) ObjectEditor

NewIngressEditor builds a new ObjectEditor for Ingress objects with the provided delegate.

func NewJobEditor

func NewJobEditor(delegate func(*batchv1.Job) error) ObjectEditor

NewJobEditor builds a new ObjectEditor for Job objects with the provided delegate.

func NewNetworkPolicyEditor

func NewNetworkPolicyEditor(delegate func(*networkingv1.NetworkPolicy) error) ObjectEditor

NewNetworkPolicyEditor builds a new ObjectEditor for NetworkPolicy objects with the provided delegate.

func NewPersistentVolumeClaimEditor

func NewPersistentVolumeClaimEditor(delegate func(*corev1.PersistentVolumeClaim) error) ObjectEditor

NewPersistentVolumeClaimEditor builds a new ObjectEditor for PersistentVolumeClaim objects with the provided delegate.

func NewPersistentVolumeEditor

func NewPersistentVolumeEditor(delegate func(*corev1.PersistentVolume) error) ObjectEditor

NewPersistentVolumeEditor builds a new ObjectEditor for PersistentVolume objects with the provided delegate.

func NewPodDisruptionBudgetEditor

func NewPodDisruptionBudgetEditor(delegate func(*policyv1beta1.PodDisruptionBudget) error) ObjectEditor

NewPodDisruptionBudgetEditor builds a new ObjectEditor for PodDisruptionBudget objects with the provided delegate.

func NewPodEditor

func NewPodEditor(delegate func(*corev1.Pod) error) ObjectEditor

NewPodEditor builds a new ObjectEditor for Pod objects with the provided delegate.

func NewRoleBindingEditor

func NewRoleBindingEditor(delegate func(*rbacv1.RoleBinding) error) ObjectEditor

NewRoleBindingEditor builds a new ObjectEditor for RoleBinding objects with the provided delegate.

func NewRoleEditor

func NewRoleEditor(delegate func(*rbacv1.Role) error) ObjectEditor

NewRoleEditor builds a new ObjectEditor for Role objects with the provided delegate.

func NewSecretEditor

func NewSecretEditor(delegate func(*corev1.Secret) error) ObjectEditor

NewSecretEditor builds a new ObjectEditor for Secret objects with the provided delegate.

func NewServiceAccountEditor

func NewServiceAccountEditor(delegate func(*corev1.ServiceAccount) error) ObjectEditor

NewServiceAccountEditor builds a new ObjectEditor for ServiceAccount objects with the provided delegate.

func NewServiceEditor

func NewServiceEditor(delegate func(*corev1.Service) error) ObjectEditor

NewServiceEditor builds a new ObjectEditor for Service objects with the provided delegate.

func NewStatefulSetEditor

func NewStatefulSetEditor(delegate func(*appsv1.StatefulSet) error) ObjectEditor

NewStatefulSetEditor builds a new ObjectEditor for StatefulSet objects with the provided delegate.

type ObjectSelector

type ObjectSelector = func(runtime.Object) bool

ObjectSelector represents a boolean expression for selecting objects

func NewClusterRoleBindingSelector

func NewClusterRoleBindingSelector(delegate func(*rbacv1.ClusterRoleBinding) bool) ObjectSelector

NewClusterRoleBindingSelector builds a new ObjectSelector that selects ClusterRoleBinding objects with the provided delegate.

func NewClusterRoleSelector

func NewClusterRoleSelector(delegate func(*rbacv1.ClusterRole) bool) ObjectSelector

NewClusterRoleSelector builds a new ObjectSelector that selects ClusterRole objects with the provided delegate.

func NewConfigMapSelector

func NewConfigMapSelector(delegate func(*corev1.ConfigMap) bool) ObjectSelector

NewConfigMapSelector builds a new ObjectSelector that selects ConfigMap objects objects with the provided delegate.

func NewCronJobSelector

func NewCronJobSelector(delegate func(*batchv1beta1.CronJob) bool) ObjectSelector

NewCronJobSelector builds a new ObjectSelector that selects CronJob objects with the provided delegate.

func NewDaemonSetSelector

func NewDaemonSetSelector(delegate func(*appsv1.DaemonSet) bool) ObjectSelector

NewDaemonSetSelector builds a new ObjectSelector that selects DaemonSet objects with the provided delegate.

func NewDeploymentSelector

func NewDeploymentSelector(delegate func(*appsv1.Deployment) bool) ObjectSelector

NewDeploymentSelector builds a new ObjectSelector that selects Deployment objects with the provided delegate.

func NewHorizontalPodAutoscalerSelector

func NewHorizontalPodAutoscalerSelector(delegate func(*autoscalingv2beta1.HorizontalPodAutoscaler) bool) ObjectSelector

NewHorizontalPodAutoscalerSelector builds a new ObjectSelector that selects HorizontalPodAutoscaler objects with the provided delegate.

func NewIngressSelector

func NewIngressSelector(delegate func(*extensionsv1beta1.Ingress) bool) ObjectSelector

NewIngressSelector builds a new ObjectSelector that selects Ingress objects with the provided delegate.

func NewJobSelector

func NewJobSelector(delegate func(*batchv1.Job) bool) ObjectSelector

NewJobSelector builds a new ObjectSelector that selects Job objects with the provided delegate.

func NewNetworkPolicySelector

func NewNetworkPolicySelector(delegate func(*networkingv1.NetworkPolicy) bool) ObjectSelector

NewNetworkPolicySelector builds a new ObjectSelector that selects NetworkPolicy objects with the provided delegate.

func NewPersistentVolumeClaimSelector

func NewPersistentVolumeClaimSelector(delegate func(*corev1.PersistentVolumeClaim) bool) ObjectSelector

NewPersistentVolumeClaimSelector builds a new ObjectSelector that selects PersistentVolumeClaim objects with the provided delegate.

func NewPersistentVolumeSelector

func NewPersistentVolumeSelector(delegate func(*corev1.PersistentVolume) bool) ObjectSelector

NewPersistentVolumeSelector builds a new ObjectSelector that selects PersistentVolume objects with the provided delegate.

func NewPodDisruptionBudgetSelector

func NewPodDisruptionBudgetSelector(delegate func(*policyv1beta1.PodDisruptionBudget) bool) ObjectSelector

NewPodDisruptionBudgetSelector builds a new ObjectSelector that selects PodDisruptionBudget objects with the provided delegate.

func NewPodSelector

func NewPodSelector(delegate func(*corev1.Pod) bool) ObjectSelector

NewPodSelector builds a new ObjectSelector that selects Pod objects with the provided delegate.

func NewRoleBindingSelector

func NewRoleBindingSelector(delegate func(*rbacv1.RoleBinding) bool) ObjectSelector

NewRoleBindingSelector builds a new ObjectSelector that selects RoleBinding objects with the provided delegate.

func NewRoleSelector

func NewRoleSelector(delegate func(*rbacv1.Role) bool) ObjectSelector

NewRoleSelector builds a new ObjectSelector that selects Role objects with the provided delegate.

func NewSecretSelector

func NewSecretSelector(delegate func(*corev1.Secret) bool) ObjectSelector

NewSecretSelector builds a new ObjectSelector that selects Secret objects with the provided delegate.

func NewServiceAccountSelector

func NewServiceAccountSelector(delegate func(*corev1.ServiceAccount) bool) ObjectSelector

NewServiceAccountSelector builds a new ObjectSelector that selects ServiceAccount objects with the provided delegate.

func NewServiceSelector

func NewServiceSelector(delegate func(*corev1.Service) bool) ObjectSelector

NewServiceSelector builds a new ObjectSelector that selects Service objects with the provided delegate.

func NewStatefulSetSelector

func NewStatefulSetSelector(delegate func(*appsv1.StatefulSet) bool) ObjectSelector

NewStatefulSetSelector builds a new ObjectSelector that selects StatefulSet objects with the provided delegate.

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) []runtime.Object

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

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

	// ConfigMapByName returns the ConfigMap with the specified name.
	ConfigMapByName(name string) *corev1.ConfigMap

	// ConfigMapsByLabels lists all ConfigMaps that match the labels.
	ConfigMapsByLabels(labels map[string]string) []*corev1.ConfigMap

	// ConfigMapByComponent lists all ConfigMaps for a specific component.
	ConfigMapByComponent(component string) *corev1.ConfigMap

	// DeploymentByName returns the Deployment with the specified name.
	DeploymentByName(name string) *appsv1.Deployment

	// DeploymentsByLabels lists all Deployments that match the labels.
	DeploymentsByLabels(labels map[string]string) []*appsv1.Deployment

	// DeploymentByComponent returns the Deployment for a specific component.
	DeploymentByComponent(component string) *appsv1.Deployment

	// JobByName returns the Job with the specified name.
	JobByName(name string) *batchv1.Job

	// JobsByLabels lists all Jobs that match the labels.
	JobsByLabels(labels map[string]string) []*batchv1.Job

	// JobByComponent lists all Jobs for a specific component.
	JobByComponent(component string) *batchv1.Job

	// SecretByName returns the Secret with the specified name.
	SecretByName(name string) *corev1.Secret

	// SecretByLabels lists all Secrets that match the labels.
	SecretsByLabels(labels map[string]string) []*corev1.Secret

	// ServiceByName returns the Service with the specified name.
	ServiceByName(name string) *corev1.Service

	// ServicesByLabels lists all Services that match the labels.
	ServicesByLabels(labels map[string]string) []*corev1.Service

	// ServiceByComponent returns the Service for a specific component.
	ServiceByComponent(component string) *corev1.Service

	// StatefulSetByName returns the StatefulSet with the specified name.
	StatefulSetByName(name string) *appsv1.StatefulSet

	// StatefulSetsByLabels lists all StatefulSets that match the labels.
	StatefulSetsByLabels(labels map[string]string) []*appsv1.StatefulSet

	// StatefulSetByComponent returns the StatefulSet for a specific component.
	StatefulSetByComponent(component string) *appsv1.StatefulSet

	// IngressesByLabels lists all Ingresses that match the labels.
	IngressesByLabels(labels map[string]string) []*extensionsv1beta1.Ingress

	// IngressByComponent returns the INgress for a specific component.
	IngressByComponent(component string) *extensionsv1beta1.Ingress
}

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.

type Values

type Values interface {
	// AsMap returns values in a map.
	AsMap() map[string]interface{}

	// AddValue merges the value using the key. The key conforms to Helm format.
	AddValue(key, value string) error

	// AddStringValue merges the string value using the key. The key conforms to Helm format.
	AddStringValue(key, value string) error

	// AddFileValue merges the content of the file using the key. The key conforms to Helm format.
	AddFileValue(key, filePath string) error

	// AddFromYAML merges the values from the YAML formatted string.
	AddFromYAML(yamlContent []byte) error

	// AddFromFile reads the specified file in YAML format and merges its content.
	AddFromFile(filePath string) error

	// GetValue returns the value of the specified key or an error when the key not present. The key
	// is limited to dot-separated field names and array indexing is not supported. It is the
	// responsibility of the caller to determine the type of the value.
	GetValue(key string) (interface{}, error)

	// SetValue sets the value of the specified key . Retruns error when the key is not writable. The
	// key is limited to dot-separated field names and array indexing is not supported. It is the
	// responsibility of the caller to pass the choose the right value type.
	SetValue(key string, value interface{}) error
}

Values provides an interface to manipulate and store the values that are needed to render a Helm template.

func EmptyValues

func EmptyValues() Values

EmptyValues returns an empty value store.

func FromMap

func FromMap(container map[string]interface{}) Values

FromMap returns a value store that is populated with the provided map.

Jump to

Keyboard shortcuts

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