kubernetes

package
v2.25.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// RevisionAnnotation is the revision annotation of a deployment's replica sets which records its rollout sequence.
	RevisionAnnotation = "deployment.kubernetes.io/revision"
	// NodeControlPlaneLabel is the label on kubernetes control plane nodes.
	NodeControlPlaneLabel = "node-role.kubernetes.io/control-plane"
)

Variables

This section is empty.

Functions

func AddFinalizer

func AddFinalizer(obj metav1.Object, finalizers ...string)

AddFinalizer will add the given finalizer to the object. It uses a StringSet to avoid duplicates.

func ContainerFromString added in v2.20.0

func ContainerFromString(containerSpec string) (*corev1.Container, error)

func EnsureAnnotationContains added in v2.24.5

func EnsureAnnotationContains(o metav1.Object, annotation string, separator string, toEnsure ...string)

func EnsureAnnotations added in v2.24.5

func EnsureAnnotations(o metav1.Object, toEnsure map[string]string)

func EnsureLabels added in v2.21.0

func EnsureLabels(o metav1.Object, toEnsure map[string]string)

func EnsureOwnerReference added in v2.21.0

func EnsureOwnerReference(o metav1.Object, ref metav1.OwnerReference)

EnsureOwnerReference will add the given owner reference to the object if it doesn't exist yet. Other references with the same name can exist.

func EnsureUniqueOwnerReference added in v2.21.0

func EnsureUniqueOwnerReference(o metav1.Object, ref metav1.OwnerReference)

EnsureUniqueOwnerReference will remove any owner ref with the same APIVersion and Kind, and then add the given ref to the owner references. This ensures that only one ref with a given kind exists.

func ExternalClusterPausedChecker added in v2.22.0

func ExternalClusterPausedChecker(ctx context.Context, externalClusterName string, masterClient ctrlruntimeclient.Client) (bool, error)

func GenerateToken

func GenerateToken() string

GenerateToken generates a new, random token that can be used as an admin and kubelet token.

func GetClusterClient added in v2.22.0

func GetClusterClient(ctx context.Context, cluster *kubermaticv1.ExternalCluster, masterClient ctrlruntimeclient.Client) (*kubernetes.Clientset, error)

func GetContainerRuntime added in v2.22.0

func GetContainerRuntime(ctx context.Context,
	clusterClient *kubernetes.Clientset,
) (string, error)

func GetDeploymentCondition added in v2.17.0

func GetDeploymentCondition(status appsv1.DeploymentStatus, condType appsv1.DeploymentConditionType) *appsv1.DeploymentCondition

GetDeploymentCondition returns the condition with the provided type.

func GetNodeGroupReadyCount added in v2.21.0

func GetNodeGroupReadyCount(nodes *corev1.NodeList, providerNodeLabel, providerNodePoolName string) int32

func GetVersion added in v2.22.0

func GetVersion(client *kubernetes.Clientset) (*ksemver.Semver, error)

func HasAnyFinalizer

func HasAnyFinalizer(o metav1.Object, names ...string) bool

func HasFinalizer

func HasFinalizer(o metav1.Object, names ...string) bool

HasFinalizer tells if a object has all the given finalizers.

func HasFinalizerSuperset added in v2.21.0

func HasFinalizerSuperset(o metav1.Object, names ...string) bool

HasFinalizerSuperset tells if the given finalizer(s) are a superset of the actual finalizers.

func HasOnlyFinalizer

func HasOnlyFinalizer(o metav1.Object, names ...string) bool

HasOnlyFinalizer tells if an object has only the given finalizer(s).

func HasOwnerReference added in v2.21.0

func HasOwnerReference(o metav1.Object, ref metav1.OwnerReference) bool

func IsDeploymentRolloutComplete added in v2.17.0

func IsDeploymentRolloutComplete(deployment *appsv1.Deployment, revision int64) (bool, error)

IsDeploymentRolloutComplete returns a bool saying whether the deployment completed and an error in case an unexpected condition arrives.

based on: https://github.com/kubernetes/kubernetes/blob/252887e39f905389156d2bc9c5932688857588e4/staging/src/k8s.io/kubectl/pkg/polymorphichelpers/rollout_status.go#L59

func IsNodeReady added in v2.21.0

func IsNodeReady(node *corev1.Node) bool

IsNodeReady returns true if a node is ready; false otherwise.

func RemoveFinalizer

func RemoveFinalizer(obj metav1.Object, toRemove ...string)

RemoveFinalizer removes the given finalizers from the object.

func RemoveOwnerReferenceKinds added in v2.21.0

func RemoveOwnerReferenceKinds(o metav1.Object, refKindsToRemove ...metav1.OwnerReference)

RemoveOwnerReferenceKinds removes any reference with the same APIVersion and Kind, notably ignoring the name.

func RemoveOwnerReferences added in v2.21.0

func RemoveOwnerReferences(o metav1.Object, refToRemoves ...metav1.OwnerReference)

RemoveOwnerReference removes any reference that has the same APIVersion, Kind and Name.

func Revision added in v2.17.0

func Revision(obj runtime.Object) (int64, error)

Revision returns the revision number of the input object.

func SortOwnerReferences added in v2.21.0

func SortOwnerReferences(refs []metav1.OwnerReference)

func TryAddFinalizer added in v2.21.0

func TryAddFinalizer(ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, finalizers ...string) error

func TryRemoveFinalizer added in v2.21.0

func TryRemoveFinalizer(ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, finalizers ...string) error

func ValidateKubernetesToken

func ValidateKubernetesToken(token string) error

ValidateKubernetesToken checks if a given token is syntactically correct.

func ValidateSecretKeySelector

func ValidateSecretKeySelector(selector *providerconfig.GlobalSecretKeySelector, key string) error

Types

type SeedClientMap added in v2.21.0

type SeedClientMap map[string]ctrlruntimeclient.Client

func (SeedClientMap) Each added in v2.21.0

func (m SeedClientMap) Each(ctx context.Context, log *zap.SugaredLogger, visitor SeedVisitorFunc) error

type SeedVisitorFunc added in v2.21.0

type SeedVisitorFunc func(seedName string, seedClient ctrlruntimeclient.Client, log *zap.SugaredLogger) error

Jump to

Keyboard shortcuts

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