helmdeployer

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	BundleIDAnnotation           = "fleet.cattle.io/bundle-id"
	CommitAnnotation             = "fleet.cattle.io/commit"
	AgentNamespaceAnnotation     = "fleet.cattle.io/agent-namespace"
	ServiceAccountNameAnnotation = "fleet.cattle.io/service-account"
	DefaultServiceAccount        = "fleet-default"
	KeepResourcesAnnotation      = "fleet.cattle.io/keep-resources"
	HelmUpgradeInterruptedError  = "another operation (install/upgrade/rollback) is in progress"
	MaxHelmHistory               = 2
)
View Source
const CRDKind = "CustomResourceDefinition"

Variables

View Source
var (
	ErrNoRelease    = errors.New("failed to find release")
	ErrNoResourceID = errors.New("no resource ID available")
	DefaultKey      = "values.yaml"
)

Functions

func Template

func Template(ctx context.Context, bundleID string, manifest *manifest.Manifest, options fleet.BundleDeploymentOptions, kubeVersionString string) ([]runtime.Object, error)

Template runs helm template and returns the resources as a list of objects, without applying them.

Types

type DeployedBundle

type DeployedBundle struct {
	// BundleID is the bundledeployment.Name
	BundleID string
	// ReleaseName is actually in the form "namespace/release name"
	ReleaseName string
	// KeepResources indicate if resources should be kept when deleting a GitRepo or Bundle
	KeepResources bool
}

DeployedBundle is the link between a bundledeployment and a helm release

type Helm

type Helm struct {
	// contains filtered or unexported fields
}

func New added in v0.10.0

func New(agentNamespace, defaultNamespace, labelPrefix, labelSuffix string) *Helm

New returns a new helm deployer * agentNamespace is the system namespace, which is the namespace the agent is running in, e.g. cattle-fleet-system

func (*Helm) Delete

func (h *Helm) Delete(ctx context.Context, bundleID string) error

Delete the release for the given bundleID. The bundleID is the name of the bundledeployment.

func (*Helm) DeleteRelease added in v0.10.0

func (h *Helm) DeleteRelease(ctx context.Context, deployment DeployedBundle) error

DeleteRelease deletes the release for the DeployedBundle.

func (*Helm) Deploy

func (h *Helm) Deploy(ctx context.Context, bundleID string, manifest *manifest.Manifest, options fleet.BundleDeploymentOptions) (*Resources, error)

Deploy deploys an unpacked content resource with helm. bundleID is the name of the bundledeployment.

func (*Helm) EnsureInstalled

func (h *Helm) EnsureInstalled(bundleID, resourcesID string) (bool, error)

func (*Helm) ListDeployments

func (h *Helm) ListDeployments(list ListAction) ([]DeployedBundle, error)

ListDeployments returns a list of deployedBundles by listing all helm releases via helm's storage driver (secrets) It only returns deployedBundles for helm releases which have the "fleet.cattle.io/bundle-id" annotation.

func (*Helm) NewListAction added in v0.10.0

func (h *Helm) NewListAction() *action.List

func (*Helm) RemoveExternalChanges

func (h *Helm) RemoveExternalChanges(ctx context.Context, bd *fleet.BundleDeployment) (string, error)

RemoveExternalChanges does a helm rollback to remove changes made outside of fleet. It removes the helm history entry if the rollback fails.

func (*Helm) Resources

func (h *Helm) Resources(bundleID, resourcesID string) (*Resources, error)

Resources returns the resources from the helm release history

func (*Helm) ResourcesFromPreviousReleaseVersion

func (h *Helm) ResourcesFromPreviousReleaseVersion(bundleID, resourcesID string) (*Resources, error)

func (*Helm) Setup added in v0.10.0

func (h *Helm) Setup(ctx context.Context, client client.Client, getter genericclioptions.RESTClientGetter) error

type ListAction added in v0.10.0

type ListAction interface {
	Run() ([]*release.Release, error)
}

type Resources

type Resources struct {
	ID               string           `json:"id,omitempty"`
	DefaultNamespace string           `json:"defaultNamespace,omitempty"`
	Objects          []runtime.Object `json:"objects,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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