utils

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegistryAddonRootCASecretName = "registry-addon-root-ca"
)

Variables

This section is empty.

Functions

func CopySecretToRemoteCluster

func CopySecretToRemoteCluster(
	ctx context.Context,
	cl ctrlclient.Client,
	srcSecretName string,
	dstSecretKey ctrlclient.ObjectKey,
	cluster *clusterv1.Cluster,
) error

CopySecretToRemoteCluster will get the Secret from srcSecretName and create it on the remote cluster, copying Data and StringData to dstSecretKey Secret.

func EnsureCRSForClusterFromObjects

func EnsureCRSForClusterFromObjects(
	ctx context.Context,
	crsName string,
	c ctrlclient.Client,
	cluster *clusterv1.Cluster,
	opts EnsureCRSForClusterFromObjectsOptions,
	objects ...runtime.Object,
) error

func EnsureClusterOwnerReferenceForObject added in v0.26.0

func EnsureClusterOwnerReferenceForObject(
	ctx context.Context,
	cl ctrlclient.Client,
	objectRef corev1.TypedLocalObjectReference,
	cluster *clusterv1.Cluster,
) error

EnsureClusterOwnerReferenceForObject ensures that OwnerReference of the cluster is added on provided object.

func EnsureNamespace

func EnsureNamespace(ctx context.Context, c ctrlclient.Client, ns *corev1.Namespace) error

EnsureNamespace will create the namespace if it does not exist.

func EnsureNamespaceWithMetadata

func EnsureNamespaceWithMetadata(ctx context.Context,
	c ctrlclient.Client,
	name string,
	labels, annotations map[string]string,
) error

EnsureNamespaceWithMetadata will create the namespace with the specified name, labels, and/or annotations, if it does not exist.

func EnsureNamespaceWithName

func EnsureNamespaceWithName(ctx context.Context, c ctrlclient.Client, name string) error

EnsureNamespaceWithName will create the namespace with the specified name if it does not exist.

func EnsureSecretForLocalCluster added in v0.29.0

func EnsureSecretForLocalCluster(
	ctx context.Context,
	cl ctrlclient.Client,
	secret *corev1.Secret,
	cluster *clusterv1.Cluster,
) error

func EnsureSecretOnRemoteCluster added in v0.29.0

func EnsureSecretOnRemoteCluster(
	ctx context.Context,
	cl ctrlclient.Client,
	secret *corev1.Secret,
	cluster *clusterv1.Cluster,
) error

EnsureSecretOnRemoteCluster ensures that the given Secret exists on the remote cluster.

func GetDeploymentNamespace added in v0.29.0

func GetDeploymentNamespace() string

func RetrieveValuesTemplate

func RetrieveValuesTemplate(
	ctx context.Context,
	c ctrlclient.Client,
	configMapName,
	namespace string,
) (string, error)

func RetrieveValuesTemplateConfigMap

func RetrieveValuesTemplateConfigMap(
	ctx context.Context,
	c ctrlclient.Client,
	configMapName,
	namespace string,
) (*corev1.ConfigMap, error)

func SecretForClusterRegistryAddonCA added in v0.29.0

func SecretForClusterRegistryAddonCA(
	ctx context.Context,
	c ctrlclient.Reader,
	cluster *clusterv1.Cluster,
) (*corev1.Secret, error)

func SecretForImageRegistryCredentials

func SecretForImageRegistryCredentials(
	ctx context.Context,
	c ctrlclient.Reader,
	credentials *v1alpha1.RegistryCredentials,
	objectNamespace string,
) (*corev1.Secret, error)

SecretForImageRegistryCredentials returns the Secret for the given ImageRegistryCredentials. Returns nil if the secret field is empty.

func SecretForRegistryAddonRootCA added in v0.29.0

func SecretForRegistryAddonRootCA(
	ctx context.Context,
	c ctrlclient.Reader,
) (*corev1.Secret, error)

func SecretNameForImageRegistryCredentials

func SecretNameForImageRegistryCredentials(credentials *v1alpha1.RegistryCredentials) string

SecretNameForImageRegistryCredentials returns the name of the Secret for the given RegistryCredentials. Returns an empty string if the credentials or secret field is empty.

func SecretNameForRegistryAddonCA added in v0.29.0

func SecretNameForRegistryAddonCA(cluster *clusterv1.Cluster) string

SecretNameForRegistryAddonCA returns the name of the registry addon CA Secret.

func SetTLSConfigForHelmChartProxyIfNeeded

func SetTLSConfigForHelmChartProxyIfNeeded(hcp *caaphv1.HelmChartProxy)

Types

type EnsureCRSForClusterFromObjectsOptions added in v0.13.0

type EnsureCRSForClusterFromObjectsOptions struct {
	// OwnerCluster holds the owning cluster for the ClusterResourceSet.
	// This allows setting the owner to something other than the workload cluster, which is
	// needed specifically for the ClusterAutoscaler addon which can be deployed in a different
	// namespace to the target cluster as it must exist in the management cluster.
	OwnerCluster *clusterv1.Cluster
}

func DefaultEnsureCRSForClusterFromObjectsOptions added in v0.13.0

func DefaultEnsureCRSForClusterFromObjectsOptions() EnsureCRSForClusterFromObjectsOptions

func (EnsureCRSForClusterFromObjectsOptions) WithOwnerCluster added in v0.13.4

Jump to

Keyboard shortcuts

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