helm

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package helm is a generated GoMock package.

Index

Constants

View Source
const (
	ContourChartDefaultVersion = "11.1.1"
)
View Source
const (
	RadiusSystemNamespace = "radius-system"
)

Variables

This section is empty.

Functions

func AddContourValues

func AddContourValues(helmChart *chart.Chart, options ContourOptions) error

// AddContourValues adds values to the helm chart to enable host networking for the Envoy pod, and sets the default LoadBalancer service ports to 8080 and 8443 so that they don't conflict with Envoy while using Host Networking. It returns an error if any of the nodes in the chart values are not found.

func AddRadiusValues

func AddRadiusValues(helmChart *chart.Chart, options *RadiusOptions) error

AddRadiusValues parses the --set arguments in order and adds them to the helm chart values, returning an error if any of the arguments are invalid.

func ApplyContourHelmChart

func ApplyContourHelmChart(options ContourOptions, kubeContext string) error

// ApplyContourHelmChart checks if a Contour Helm chart has been installed, and if not, installs it with the given options. If an error occurs, it returns an error with the Helm output.

func ApplyRadiusHelmChart

func ApplyRadiusHelmChart(options RadiusOptions, kubeContext string) (bool, error)

ApplyRadiusHelmChart checks if a Helm chart is already installed, and if not, installs it or upgrades it if the "Reinstall" option is set. It returns a boolean indicating if the chart was already installed and an error if one occurred.

func HelmConfig

func HelmConfig(builder *strings.Builder, flags *genericclioptions.ConfigFlags) (*helm.Configuration, error)

HelmConfig initializes a helm configuration object and sets the backend storage driver to use kubernetes secrets, returning the configuration object and an error if one occurs.

func Install

func Install(ctx context.Context, clusterOptions ClusterOptions, kubeContext string) (bool, error)

Install takes in a context, clusterOptions and kubeContext and returns a boolean and an error. If an error is encountered, it is returned.

func InstallOnCluster

func InstallOnCluster(ctx context.Context, options ClusterOptions, kubeContext string) (bool, error)

InstallOnCluster applies the Helm charts for Radius and Contour to the cluster, and returns whether an existing installation was found. If an error occurs, it is returned.

func RunContourHelmInstall

func RunContourHelmInstall(helmConf *helm.Configuration, helmChart *chart.Chart) error

RunContourHelmInstall creates a new helm install client with the given configuration and chart, sets the release name and namespace, and then runs the install. It returns an error if the install fails.

func RunContourHelmUninstall

func RunContourHelmUninstall(helmConf *helm.Configuration) error

This function "RunContourHelmUninstall" uses the Helm configuration to uninstall Contour from the specified namespace, and returns an error if the uninstall fails.

func RunRadiusHelmUninstall

func RunRadiusHelmUninstall(helmConf *helm.Configuration) error

RunRadiusHelmUninstall attempts to uninstall Radius from the Radius system namespace using a helm configuration, and returns an error if the uninstall fails.

func UninstallOnCluster

func UninstallOnCluster(kubeContext string) error

UninstallOnCluster retrieves the Helm configuration and runs the Contour and Radius Helm uninstall commands to remove the Helm releases from the cluster.

Types

type CLIClusterOptions

type CLIClusterOptions struct {
	Radius RadiusOptions
}

type ClusterOptions

type ClusterOptions struct {
	Contour ContourOptions
	Radius  RadiusOptions
}

func NewDefaultClusterOptions

func NewDefaultClusterOptions() ClusterOptions

NewDefaultClusterOptions sets the default values for the ClusterOptions struct, using the chart version that matches the channel of the CLI (major.minor) or the latest available version if it is an edge build.

func PopulateDefaultClusterOptions

func PopulateDefaultClusterOptions(cliOptions CLIClusterOptions) ClusterOptions

PopulateDefaultClusterOptions compares the CLI options provided by the user to the default options and returns a ClusterOptions object with the CLI options overriding the default options if they are provided.

type ContourOptions

type ContourOptions struct {
	ChartVersion string
	HostNetwork  bool
}

type Impl

type Impl struct {
}

func (*Impl) CheckRadiusInstall

func (i *Impl) CheckRadiusInstall(kubeContext string) (InstallState, error)

Checks if radius is installed based on kubeContext.

func (*Impl) InstallRadius

func (i *Impl) InstallRadius(ctx context.Context, clusterOptions ClusterOptions, kubeContext string) (bool, error)

Installs radius on a cluster based on kubeContext.

func (*Impl) UninstallRadius

func (i *Impl) UninstallRadius(ctx context.Context, kubeContext string) error

UninstallRadius uninstalls RADIUS from the specified Kubernetes cluster, and returns an error if it fails.

type InstallState

type InstallState struct {
	// Installed denotes whether the Radius helm chart is installed on the cluster.
	Installed bool

	// Version is the version of the Radius helm chart installed on the cluster. Will be blank if Radius is not installed.
	Version string
}

InstallState represents the state of the Radius helm chart installation on a Kubernetes cluster.

func CheckRadiusInstall

func CheckRadiusInstall(kubeContext string) (InstallState, error)

CheckRadiusInstall checks if the Radius release is installed in the given kubeContext and returns an InstallState object with the version of the release if installed, or an error if an error occurs while checking.

type Interface

type Interface interface {
	// CheckRadiusInstall checks whether Radius is installed on the cluster, based on the specified Kubernetes context.
	CheckRadiusInstall(kubeContext string) (InstallState, error)

	// InstallRadius installs Radius on the cluster, based on the specified Kubernetes context.
	InstallRadius(ctx context.Context, clusterOptions ClusterOptions, kubeContext string) (bool, error)

	// UninstallRadius uninstalls Radius from the cluster based on the specified Kubernetes context. Will succeed regardless of whether Radius is installed.
	UninstallRadius(ctx context.Context, kubeContext string) error
}

Interface provides an abstraction over Helm operations for installing Radius.

type MockInterface

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

MockInterface is a mock of Interface interface.

func NewMockInterface

func NewMockInterface(ctrl *gomock.Controller) *MockInterface

NewMockInterface creates a new mock instance.

func (*MockInterface) CheckRadiusInstall

func (m *MockInterface) CheckRadiusInstall(arg0 string) (InstallState, error)

CheckRadiusInstall mocks base method.

func (*MockInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockInterface) InstallRadius

func (m *MockInterface) InstallRadius(arg0 context.Context, arg1 ClusterOptions, arg2 string) (bool, error)

InstallRadius mocks base method.

func (*MockInterface) UninstallRadius

func (m *MockInterface) UninstallRadius(arg0 context.Context, arg1 string) error

UninstallRadius mocks base method.

type MockInterfaceMockRecorder

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

MockInterfaceMockRecorder is the mock recorder for MockInterface.

func (*MockInterfaceMockRecorder) CheckRadiusInstall

func (mr *MockInterfaceMockRecorder) CheckRadiusInstall(arg0 interface{}) *gomock.Call

CheckRadiusInstall indicates an expected call of CheckRadiusInstall.

func (*MockInterfaceMockRecorder) InstallRadius

func (mr *MockInterfaceMockRecorder) InstallRadius(arg0, arg1, arg2 interface{}) *gomock.Call

InstallRadius indicates an expected call of InstallRadius.

func (*MockInterfaceMockRecorder) UninstallRadius

func (mr *MockInterfaceMockRecorder) UninstallRadius(arg0, arg1 interface{}) *gomock.Call

UninstallRadius indicates an expected call of UninstallRadius.

type RadiusOptions

type RadiusOptions struct {
	// Reinstall specifies whether to reinstall the chart (helm upgrade).
	Reinstall bool

	// ChartPath specifies an override for the chart location.
	ChartPath string

	// ChartVersion specifies the chart version.
	ChartVersion string

	// SetArgs specifies as set of additional "values" to pass to helm. These are specified using the command-line syntax accepted
	// by helm, in the order they appear on the command line (last one wins).
	SetArgs []string

	// SetFileArgs specifies as set of additional "values" from file to pass it to helm.
	SetFileArgs []string
}

RadiusOptions describes the options for the Radius helm chart.

Jump to

Keyboard shortcuts

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