helm

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

helm/history.go

Index

Constants

View Source
const (
	ColorReset   = "\033[0m"
	ColorRed     = "\033[31m"
	ColorGreen   = "\033[32m"
	ColorYellow  = "\033[33m"
	ColorBlue    = "\033[34m"
	ColorMagenta = "\033[35m"
	ColorCyan    = "\033[36m"
	ColorWhite   = "\033[37m"
	ColorGray    = "\033[90m"

	ColorBold   = "\033[1m"
	ColorItalic = "\033[3m"
)

ANSI color codes

Variables

This section is empty.

Functions

func CreateChart

func CreateChart(chartName, saveDir string) error

CreateChart generates a new Helm chart in the specified directory using Helm's chartutil package. It ensures that the target directory exists before creating the chart scaffolding. If successful, a success message is logged with the chart's location.

func DebugHelmPaths added in v0.0.6

func DebugHelmPaths()

Add this diagnostic function

func HelmHistory added in v0.0.6

func HelmHistory(releaseName, namespace string, max int, format string, useAI bool) error

HelmHistory shows the revision history of a Helm release using pterm.Table.

format selects the output shape: "table" (default) renders the existing human-facing table; "json"/"yaml" print the revision list as a single machine-readable document to stdout and suppress every other stdout write, so pipelines consuming stdout only ever see that document.

func HelmInstall

func HelmInstall(
	releaseName, chartRef, namespace string, valuesFiles []string,
	duration time.Duration, atomic, debug bool,
	setValues, setLiteralValues []string, repoURL, version string,
	wait bool, useAI bool,
) error

HelmInstall handles chart installation with three possible sources: 1. Remote repository URL (e.g., "https://prometheus-community.github.io/helm-charts") 2. Local repository reference (e.g., "prometheus-community/prometheus") 3. Local chart path (e.g., "./mychart")

func HelmLint

func HelmLint(chartPath string, fileValues []string, useAI bool) error

HelmLint runs Helm's built-in linting on a specified chart directory or tarball, optionally merging values from given YAML files and parsing additional values, passed through the --set mechanism. Upon completion, it displays any detected linting messages, listing severity and location, or indicates if no issues were found

func HelmPluginInstall added in v0.0.6

func HelmPluginInstall(plugins string) error

HelmPluginInstall installs one or more Helm plugins

func HelmProvision

func HelmProvision(releaseName, chartPath, namespace string, useAI bool) error

HelmProvision orchestrates a "provisioning" workflow that checks whether a specified Helm release already exists in the cluster and chooses either to install or upgrade. In parallel, it also runs linting and template rendering for the chart. If any step fails, a consolidated error is returned. Otherwise, a success message is printed.

func HelmReleaseExists

func HelmReleaseExists(releaseName, namespace string, debug, useAI bool) (bool, error)

HelmReleaseExists checks if a Helm release with the given name exists in the specified namespace. It initializes Helm's action configuration, runs the Helm list command, and returns true if a release with the given name is found in the specified namespace. Helper function to check if release exists

func HelmRollback added in v0.0.2

func HelmRollback(releaseName string, revision int, opts RollbackOptions, historyMax int, useAI bool) error

HelmRollback performs a rollback of a specified Helm release to a given revision. It initializes the Helm action configuration, sets up the rollback parameters, executes the rollback, and then retrieves the status of the release post-rollback. Detailed error logging is performed if any step fails.

func HelmStatus

func HelmStatus(releaseName, namespace, format string, useAI bool) error

HelmStatus retrieves and displays the status of a specified Helm release within a given namespace. It initializes the Helm action configuration, fetches the release status, and presents it in a formatted table. Additionally, it checks the readiness of the associated Kubernetes resources and provides detailed feedback.

format selects the output shape: "table" (default) renders the existing human-facing table, spinner, notes and readiness report; "json"/"yaml" print a single machine-readable document to stdout and suppress every other stdout write (spinner, tables, notes, AI explanations) so pipelines consuming stdout only ever see that document. Errors are still returned normally and land on stderr via the caller.

func HelmTemplate

func HelmTemplate(releaseName, chartPath, namespace, repoURL string, valuesFiles []string, useAI bool) error

HelmTemplate renders the Helm templates for a given chart, values files, and optionally a remote repo. HelmTemplate renders the Helm templates for a given chart, values files, and optionally a remote repo.

func HelmUninstall

func HelmUninstall(opts UninstallOptions, useAI bool) error

HelmUninstall performs a complete uninstallation of a Helm release

func HelmUpgrade

func HelmUpgrade(
	releaseName, chartRef, namespace string,
	setValues []string, valuesFiles []string, setLiteral []string,
	createNamespace, atomic bool,
	timeout time.Duration, debug bool,
	repoURL string, version string,
	wait bool,
	historyMax int,
	useAI bool, force bool,
) error

HelmUpgrade performs a Helm upgrade operation with repo + local support

func ListNamespaces added in v1.1.6

func ListNamespaces(ctx context.Context) ([]string, error)

ListNamespaces returns the names of all namespaces visible to the configured Kubernetes client, for use in shell completion. It never prints and honors ctx's deadline, so a slow or unreachable cluster can't hang shell completion; callers should pass a context with a short (2-3s) timeout.

It intentionally builds its own client instead of reusing getKubeClient: that helper prints an error message as a side effect of the first failed call (cached for the process via kubeClientOnce), which is fine for regular command output but would violate the "completion functions never print" rule.

func ListReleaseNames added in v1.1.6

func ListReleaseNames(namespace string, timeout time.Duration) ([]string, error)

ListReleaseNames returns just the names of Helm releases in the given namespace (all namespaces if empty), for use in shell completion. Unlike ListReleases it never prints anything and never blocks longer than timeout: the Helm/Kubernetes call runs in the background and, if it has not finished by the deadline, a timeout error is returned immediately so a slow or unreachable cluster can't hang shell completion.

func ListReleases added in v0.0.6

func ListReleases(namespace, format string, useAI bool) ([]*release.Release, error)

ListReleases returns and displays Helm releases with flexible output formats

func LoadChart added in v0.0.5

func LoadChart(chartRef, repoURL, version string, settings *cli.EnvSettings) (*chart.Chart, error)

LoadChart determines the chart source and loads it appropriately

func LoadFromLocalRepo added in v0.0.5

func LoadFromLocalRepo(chartRef, version string, settings *cli.EnvSettings) (*chart.Chart, error)

loadFromLocalRepo loads a chart from a local repository

func LoadOCIChart added in v0.1.2

func LoadOCIChart(chartRef, version string, settings *cli.EnvSettings, debug bool) (*chart.Chart, error)

LoadOCIChart loads a chart from an OCI registry

func LoadRemoteChart added in v0.0.5

func LoadRemoteChart(chartName, repoURL string, version string, settings *cli.EnvSettings) (*chart.Chart, error)

loadRemoteChart downloads and loads a chart from a remote repository

func Pull added in v0.0.6

func Pull(chartRef, version, destination string, untar bool, untarDir string,
	verify bool, keyring string, repoURL string, username string, password string,
	certFile string, keyFile string, caFile string, insecure bool, plainHttp bool,
	passCredentials bool, devel bool, prov bool, helmConfigDir string, useAI bool) error

func Repo_Add added in v0.0.5

func Repo_Add(args []string,
	username, password, certFile, keyFile, caFile, helmConfigDir string,
	useAI bool,
) error

func Repo_Update added in v0.0.5

func Repo_Update(args []string, helmConfigDir string, useAI bool) error

Types

type ConfigMapInfo added in v0.0.6

type ConfigMapInfo struct {
	Name string
}

type DeploymentInfo added in v0.0.6

type DeploymentInfo struct {
	Name      string
	Replicas  int32
	Ready     int32
	Available int32
	UpToDate  int32
}

type IngressInfo added in v0.0.6

type IngressInfo struct {
	Name    string
	Hosts   []string
	Address string
}

type PodInfo added in v0.0.6

type PodInfo struct {
	Name     string
	Ready    string
	Status   string
	Node     string
	Restarts int32
}

type ReleaseInfo added in v0.0.6

type ReleaseInfo struct {
	Name      string
	Chart     string
	Namespace string
	Status    string
	Revision  int
}

type ReplicaSetInfo added in v0.0.6

type ReplicaSetInfo struct {
	Name              string
	DesiredReplicas   int32
	ReadyReplicas     int32
	AvailableReplicas int32
}

type Resource added in v0.0.3

type Resource struct {
	Kind      string
	Name      string
	Namespace string
}

Resource represents a Kubernetes resource.

type ResourceChecker added in v0.0.6

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

ResourceChecker provides generic resource checking functionality

func NewResourceChecker added in v0.0.6

func NewResourceChecker(clientset *kubernetes.Clientset, namespace, releaseName string, debug bool) *ResourceChecker

type ResourceDetails added in v0.0.6

type ResourceDetails struct {
	ReleaseInfo *ReleaseInfo
	Deployments []DeploymentInfo
	ReplicaSets []ReplicaSetInfo
	Pods        []PodInfo
	Services    []ServiceInfo
	Ingresses   []IngressInfo
	Secrets     []SecretInfo
	ConfigMaps  []ConfigMapInfo
}

ResourceDetails stores detailed information about resources

type RollbackOptions added in v0.0.2

type RollbackOptions struct {
	Namespace string
	Debug     bool
	Force     bool
	Timeout   int
	Wait      bool
}

RollbackOptions holds the options for rolling back a Helm release.

type SecretInfo added in v0.0.6

type SecretInfo struct {
	Name string
	Type string
}

type ServiceInfo added in v0.0.6

type ServiceInfo struct {
	Name      string
	Type      string
	ClusterIP string
	Ports     []string
}

type UninstallOptions added in v0.0.6

type UninstallOptions struct {
	ReleaseName  string
	Namespace    string
	Force        bool
	Timeout      time.Duration
	DisableHooks bool
	Cascade      string // "background", "foreground", or "orphan"
}

UninstallOptions contains configuration for the uninstall operation

Jump to

Keyboard shortcuts

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