internal

package
v0.1.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructInClusterKubeconfig

func ConstructInClusterKubeconfig(ctx context.Context, restConfig *rest.Config, namespace string) (*clientcmdapi.Config, error)

GetClusterKubeconfig generates a kubeconfig file for the management cluster using a rest.Config. This is a bit of a workaround since the k8s.io/client-go/tools/clientcmd/api expects to be run from a CLI context, but within a pod we don't have that. As a result, we have to manually fill in the fields that would normally be present in ~/.kube/config. This seems to work for now.

func GetActionConfig

func GetActionConfig(ctx context.Context, namespace string, config *rest.Config) (*helmAction.Configuration, error)

GetActionConfig returns a new Helm action configuration.

func GetClusterField

func GetClusterField(ctx context.Context, c ctrlClient.Client, cluster *clusterv1.Cluster, fields []string) (string, error)

GetClusterField returns the value of a field in a selected Cluster.

func GetClusterKubeconfig

func GetClusterKubeconfig(ctx context.Context, cluster *clusterv1.Cluster) (string, error)

GetClusterKubeconfig returns the kubeconfig for a selected Cluster as a string.

func GetCustomResource

func GetCustomResource(ctx context.Context, c ctrlClient.Client, kind string, apiVersion string, namespace string, name string) (*unstructured.Unstructured, error)

GetCustomResource returns the unstructured object for a selected Custom Resource.

func GetHelmRelease

func GetHelmRelease(ctx context.Context, kubeconfig string, spec addonsv1alpha1.HelmReleaseProxySpec) (*release.Release, error)

GetHelmRelease returns a Helm release if it exists.

func HelmInit

func HelmInit(ctx context.Context, namespace string, kubeconfig string) (*helmCli.EnvSettings, *helmAction.Configuration, error)

HelmInit initializes Helm.

func InitInClusterKubeconfig

func InitInClusterKubeconfig(ctx context.Context) (*cluster.Kubeconfig, error)

InitInClusterKubeconfig generates a kubeconfig file for the management cluster. Note: The k8s.io/client-go/tools/clientcmd/api package and associated tools require a path to a kubeconfig file rather than the data stored in an object.

func InstallHelmRelease

func InstallHelmRelease(ctx context.Context, kubeconfig string, spec addonsv1alpha1.HelmReleaseProxySpec) (*release.Release, error)

InstallHelmRelease installs a Helm release.

func InstallOrUpgradeHelmRelease

func InstallOrUpgradeHelmRelease(ctx context.Context, kubeconfig string, spec addonsv1alpha1.HelmReleaseProxySpec) (*release.Release, bool, error)

InstallOrUpgradeHelmRelease installs a Helm release if it does not exist, or upgrades it if it does and differs from the spec. It returns a boolean indicating whether an install or upgrade was performed.

func ListHelmReleases

func ListHelmReleases(ctx context.Context, kubeconfig string, spec addonsv1alpha1.HelmReleaseProxySpec) ([]*release.Release, error)

ListHelmReleases lists all Helm releases in a namespace.

func ParseValues

ParseValues parses the values template and returns the expanded template. It attempts to populate a map of supported templating objects.

func RollbackHelmRelease

func RollbackHelmRelease(ctx context.Context, kubeconfig string, spec addonsv1alpha1.HelmReleaseProxySpec) error

RollbackHelmRelease rolls back a Helm release.

func UninstallHelmRelease

func UninstallHelmRelease(ctx context.Context, kubeconfig string, spec addonsv1alpha1.HelmReleaseProxySpec) (*release.UninstallReleaseResponse, error)

UninstallHelmRelease uninstalls a Helm release.

func UpgradeHelmReleaseIfChanged

func UpgradeHelmReleaseIfChanged(ctx context.Context, kubeconfig string, spec addonsv1alpha1.HelmReleaseProxySpec, existing *release.Release) (*release.Release, bool, error)

UpgradeHelmReleaseIfChanged upgrades a Helm release.

func WriteClusterKubeconfigToFile

func WriteClusterKubeconfigToFile(ctx context.Context, cluster *clusterv1.Cluster) (string, error)

WriteClusterKubeconfigToFile writes the kubeconfig for a selected Cluster to a file.

func WriteInClusterKubeconfigToFile

func WriteInClusterKubeconfigToFile(ctx context.Context, filePath string, clientConfig clientcmdapi.Config) error

WriteInClusterKubeconfigToFile writes the clientcmdapi.Config to a kubeconfig file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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