helm

package
v0.26.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoManifest = errors.New("Object is no Kubernetes Object")
View Source
var ErrObjectNotUnstructured = errors.New("Helm object is not of type unstructured.Unstructured")

Functions

func Init

Init setups a Helm config with a Kubernetes client capable of doing SSA and overrides any default namespace with given namespace.

func ParseVersion

func ParseVersion(version string) (string, string)

Parses a Helm Chart version into two parts: version and digest. Digest is optional and will be an empty string if not found. Input format must be eiter "version" or "version@digest".

Types

type CRDs

type CRDs struct {
	// Helm only supports installation by default.
	// This option extends Helm to allow Navecd to upgrade CRDs packaged with a Chart.
	AllowUpgrade bool `json:"allowUpgrade"`
}

Helm CRD handling configuration.

type Chart

type Chart struct {
	Name string `json:"name"`

	// URL of the repository where the Helm chart is hosted.
	RepoURL string `json:"repoURL"`

	Version string `json:"version"`

	// Authentication information for private repositories.
	Auth *cloud.Auth `json:"auth,omitempty"`
}

A Helm package that contains information sufficient for installing a set of Kubernetes resources into a Kubernetes cluster.

type ChartReconciler

type ChartReconciler struct {
	Log logr.Logger

	KubeConfig   *rest.Config
	Client       *kube.ExtendedDynamicClient
	FieldManager string

	// Instance is a representation of an inventory.
	// It can store, delete and read items.
	// The object does not include the storage itself, it only holds a reference to the storage.
	InventoryInstance *inventory.Instance

	// InsecureSkipVerify controls whether the Helm client verifies the server's
	// certificate chain and host name.
	InsecureSkipTLSverify bool

	// Force http for Helm registries.
	PlainHTTP bool

	// Root directory where the charts are stored/cached.
	ChartCacheRoot string

	// Endpoint to the microsoft azure login server.
	// Default is usually: https://login.microsoftonline.com/.
	AzureLoginURL string

	// Endpoint to the google metadata server, which provides access tokens.
	// Default is: http://metadata.google.internal.
	GCPMetadataServerURL string
}

ChartReconciler reads Helm Packages with their desired state and applies them on a Kubernetes cluster. It stores releases in the inventory, but never collects it.

func (*ChartReconciler) Delete

func (c *ChartReconciler) Delete(name string, namespace string) error

func (*ChartReconciler) Reconcile

func (c *ChartReconciler) Reconcile(
	ctx context.Context,
	component *ReleaseComponent,
) (*Release, error)

Reconcile reads a declared Helm Release with its desired state and applies it on a Kubernetes cluster. It upgrades a Helm Chart based on whether it is already installed or not. A successful run stores the release in the inventory, but never collects it. In case an upgrade or installation is interrupted and left in a dangling state, the dangling release secret will be removed and a new upgrade/installation will be run.

type ChartVersionIter

type ChartVersionIter struct {
	Versions repo.ChartVersions
}

func (*ChartVersionIter) ForEach

func (iter *ChartVersionIter) ForEach(do func(item string, idx int))

type Client

type Client struct {
	*helmKube.Client
	DynamicClient kube.Client[kube.ExtendedUnstructured, unstructured.Unstructured]
	FieldManager  string
	Patches       *Patches
}

Client is a dedicated Kubernetes client for Helm with Server-Side Apply. TODO: remove when Helm supports SSA.

func (*Client) Create

func (c *Client) Create(resources helmKube.ResourceList) (*helmKube.Result, error)

taken from helm.sh/helm/v3/pkg/kube and patched with SSA.

func (*Client) Update

func (c *Client) Update(
	original helmKube.ResourceList,
	target helmKube.ResourceList,
	force bool,
) (*helmKube.Result, error)

taken from helm.sh/helm/v3/pkg/kube and patched with SSA.

type Patches

type Patches struct {
	Unstructureds map[string]kube.ExtendedUnstructured
}

Patches allow to overwrite rendered manifests before installing/upgrading. Additionally they can be used to attach build attributes to fields.

func NewPatches

func NewPatches() *Patches

func (*Patches) Get

func (p *Patches) Get(
	name string,
	namespace string,
	typeMeta v1.TypeMeta,
) *kube.ExtendedUnstructured

func (*Patches) Put

func (p *Patches) Put(unstructured kube.ExtendedUnstructured)

type PostRenderer

type PostRenderer struct {
	Patches *Patches
}

func (*PostRenderer) Run

func (pr *PostRenderer) Run(
	renderedManifests *bytes.Buffer,
) (modifiedManifests *bytes.Buffer, err error)

type Release

type Release = ReleaseDeclaration

type ReleaseComponent

type ReleaseComponent struct {
	ID           string
	Dependencies []string
	Content      ReleaseDeclaration
}

ReleaseComponent represents a Navecd component with its id, dependencies and content. It is the Go equivalent of the CUE definition the user interacts with. See ReleaseDeclaration for more.

func (*ReleaseComponent) GetDependencies

func (hr *ReleaseComponent) GetDependencies() []string

func (*ReleaseComponent) GetID

func (hr *ReleaseComponent) GetID() string

type ReleaseDeclaration

type ReleaseDeclaration struct {
	// Name influences the name of the installed objects of a Helm Chart.
	// When set, the installed objects are suffixed with the chart name.
	// Defaults to the chart name.
	Name string `json:"name"`

	// Namespace specifies the Kubernetes namespace to which the Helm Chart is installed to.
	// Defaults to default.
	Namespace string `json:"namespace"`

	// A Helm package that contains information
	// sufficient for installing a set of Kubernetes resources into a Kubernetes cluster.
	Chart *Chart `json:"chart"`

	// Values provide a way to override Helm Chart template defaults with custom information.
	Values Values `json:"values"`

	// Patches allow to overwrite rendered manifests before installing/upgrading.
	// Additionally they can be used to attach build attributes to fields.
	Patches *Patches `json:"patches"`

	// Helm CRD handling configuration.
	CRDs CRDs `json:"crds"`

	// Version is an int which represents the revision of the release.
	// Not declared by users.
	Version int `json:"-"`
}

ReleaseDeclaration is a Declaration of the desired state (Release) in a Git repository. A Helm Release is a running instance of a Chart and the current state in a Kubernetes Cluster.

type Values

type Values map[string]interface{}

Values provide a way to override Helm Chart template defaults with custom information.

Jump to

Keyboard shortcuts

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