gardener: github.com/gardener/gardener/pkg/utils/kubernetes Index | Files | Directories

package kubernetes

import "github.com/gardener/gardener/pkg/utils/kubernetes"

Index

Package Files

bootstrap_token.go controllerinstallation.go controllerregistration.go daemonset.go deployment.go etcd.go kubernetes.go namespace.go node.go object.go patch.go project.go seed.go shoot.go statefulset.go update.go worker.go

func BootstrapTokenFrom Uses

func BootstrapTokenFrom(data map[string][]byte) string

BootstrapTokenFrom returns the bootstrap token based on the secret data.

func ComputeBootstrapToken Uses

func ComputeBootstrapToken(ctx context.Context, c client.Client, tokenID, description string, validity time.Duration) (secret *corev1.Secret, err error)

ComputeBootstrapToken computes and creates a new bootstrap token, and returns it.

func CreateTwoWayMergePatch Uses

func CreateTwoWayMergePatch(obj1 metav1.Object, obj2 metav1.Object) ([]byte, error)

CreateTwoWayMergePatch creates a two way merge patch of the given objects. The two objects have to be pointers implementing the interfaces.

func GetLoadBalancerIngress Uses

func GetLoadBalancerIngress(ctx context.Context, client client.Client, namespace, name string) (string, error)

GetLoadBalancerIngress takes a context, a client, a namespace and a service name. It queries for a load balancer's technical name (ip address or hostname). It returns the value of the technical name whereby it always prefers the hostname (if given) over the IP address. It also returns the list of all load balancer ingresses.

func HasDeletionTimestamp Uses

func HasDeletionTimestamp(obj runtime.Object) (bool, error)

HasDeletionTimestamp checks if an object has a deletion timestamp

func HasMetaDataAnnotation Uses

func HasMetaDataAnnotation(meta metav1.Object, key, value string) bool

HasMetaDataAnnotation checks if the passed meta object has the given key, value set in the annotations section.

func IsEmptyPatch Uses

func IsEmptyPatch(patch []byte) bool

IsEmptyPatch checks if the given patch is empty. A patch is considered empty if it is the empty string or if it json-decodes to an empty json map.

func Key Uses

func Key(namespaceOrName string, nameOpt ...string) client.ObjectKey

Key creates a new client.ObjectKey from the given parameters. There are only two ways to call this function: - If only namespaceOrName is set, then a client.ObjectKey with name set to namespaceOrName is returned. - If namespaceOrName and one nameOpt is given, then a client.ObjectKey with namespace set to namespaceOrName

and name set to nameOpt[0] is returned.

For all other cases, this method panics.

func KeyFromObject Uses

func KeyFromObject(obj metav1.Object) client.ObjectKey

KeyFromObject obtains the client.ObjectKey from the given metav1.Object.

func ObjectMeta Uses

func ObjectMeta(namespaceOrName string, nameOpt ...string) metav1.ObjectMeta

ObjectMeta creates a new metav1.ObjectMeta from the given parameters. There are only two ways to call this function: - If only namespaceOrName is set, then a metav1.ObjectMeta with name set to namespaceOrName is returned. - If namespaceOrName and one nameOpt is given, then a metav1.ObjectMeta with namespace set to namespaceOrName

and name set to nameOpt[0] is returned.

For all other cases, this method panics.

func ObjectMetaFromKey Uses

func ObjectMetaFromKey(key client.ObjectKey) metav1.ObjectMeta

ObjectMetaFromKey returns an ObjectMeta with the namespace and name set to the values from the key.

func SetMetaDataAnnotation Uses

func SetMetaDataAnnotation(meta metav1.Object, key, value string)

SetMetaDataAnnotation sets the annotation on the given object. If the given Object did not yet have annotations, they are initialized.

func SetMetaDataLabel Uses

func SetMetaDataLabel(meta metav1.Object, key, value string)

SetMetaDataLabel sets the key value pair in the labels section of the given Object. If the given Object did not yet have labels, they are initialized.

func SubmitEmptyPatch Uses

func SubmitEmptyPatch(ctx context.Context, c client.Client, obj runtime.Object) error

SubmitEmptyPatch submits an empty patch to the given `obj` with the given `client` instance.

func TruncateLabelValue Uses

func TruncateLabelValue(s string) string

TruncateLabelValue truncates a string at 63 characters so it's suitable for a label value.

func TryUpdate Uses

func TryUpdate(ctx context.Context, backoff wait.Backoff, c client.Client, obj runtime.Object, transform func() error) error

TryUpdate tries to apply the given transformation function onto the given object, and to update it afterwards. It retries the update with an exponential backoff.

func TryUpdateControllerInstallation Uses

func TryUpdateControllerInstallation(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.ControllerInstallation) (*gardencorev1beta1.ControllerInstallation, error)) (*gardencorev1beta1.ControllerInstallation, error)

TryUpdateControllerInstallation tries to update the status of the controllerInstallation matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the ControllerInstallation object. If the transformation yields a semantically equal ControllerInstallation, no update is done and the operation returns normally.

func TryUpdateControllerInstallationStatus Uses

func TryUpdateControllerInstallationStatus(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.ControllerInstallation) (*gardencorev1beta1.ControllerInstallation, error)) (*gardencorev1beta1.ControllerInstallation, error)

TryUpdateControllerInstallationStatus tries to update the status of the controllerInstallation matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the ControllerInstallation object. If the transformation yields a semantically equal ControllerInstallation, no update is done and the operation returns normally.

func TryUpdateControllerInstallationStatusWithEqualFunc Uses

func TryUpdateControllerInstallationStatusWithEqualFunc(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.ControllerInstallation) (*gardencorev1beta1.ControllerInstallation, error), equal func(cur, updated *gardencorev1beta1.ControllerInstallation) bool) (*gardencorev1beta1.ControllerInstallation, error)

TryUpdateControllerInstallationStatusWithEqualFunc tries to update the status of the controllerInstallation matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the ControllerInstallation object. If the equal func concludes a semantically equal ControllerInstallation, no update is done and the operation returns normally.

func TryUpdateControllerInstallationWithEqualFunc Uses

func TryUpdateControllerInstallationWithEqualFunc(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.ControllerInstallation) (*gardencorev1beta1.ControllerInstallation, error), equal func(cur, updated *gardencorev1beta1.ControllerInstallation) bool) (*gardencorev1beta1.ControllerInstallation, error)

TryUpdateControllerInstallationWithEqualFunc tries to update the status of the controllerInstallation matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the ControllerInstallation object. If the equal func concludes a semantically equal ControllerInstallation, no update is done and the operation returns normally.

func TryUpdateControllerRegistration Uses

func TryUpdateControllerRegistration(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.ControllerRegistration) (*gardencorev1beta1.ControllerRegistration, error)) (*gardencorev1beta1.ControllerRegistration, error)

TryUpdateControllerRegistration tries to update the status of the controllerRegistration matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the ControllerRegistration object. If the transformation yields a semantically equal ControllerRegistration, no update is done and the operation returns normally.

func TryUpdateControllerRegistrationWithEqualFunc Uses

func TryUpdateControllerRegistrationWithEqualFunc(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.ControllerRegistration) (*gardencorev1beta1.ControllerRegistration, error), equal func(cur, updated *gardencorev1beta1.ControllerRegistration) bool) (*gardencorev1beta1.ControllerRegistration, error)

TryUpdateControllerRegistrationWithEqualFunc tries to update the status of the controllerRegistration matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the ControllerRegistration object. If the equal func concludes a semantically equal ControllerRegistration, no update is done and the operation returns normally.

func TryUpdateNamespace Uses

func TryUpdateNamespace(k k8s.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*corev1.Namespace) (*corev1.Namespace, error)) (*corev1.Namespace, error)

TryUpdateNamespace tries to update a namespace and retries the operation with the given <backoff>.

func TryUpdateNamespaceLabels Uses

func TryUpdateNamespaceLabels(k k8s.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*corev1.Namespace) (*corev1.Namespace, error)) (*corev1.Namespace, error)

TryUpdateNamespaceLabels tries to update a namespace's labels and retries the operation with the given <backoff>.

func TryUpdateProject Uses

func TryUpdateProject(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Project) (*gardencorev1beta1.Project, error)) (*gardencorev1beta1.Project, error)

TryUpdateProject tries to update a project and retries the operation with the given <backoff>.

func TryUpdateProjectStatus Uses

func TryUpdateProjectStatus(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Project) (*gardencorev1beta1.Project, error)) (*gardencorev1beta1.Project, error)

TryUpdateProjectStatus tries to update a project's status and retries the operation with the given <backoff>.

func TryUpdateSeed Uses

func TryUpdateSeed(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Seed) (*gardencorev1beta1.Seed, error)) (*gardencorev1beta1.Seed, error)

TryUpdateSeed tries to update the status of the seed matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Seed object. If the transformation yields a semantically equal Seed, no update is done and the operation returns normally.

func TryUpdateSeedConditions Uses

func TryUpdateSeedConditions(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Seed) (*gardencorev1beta1.Seed, error)) (*gardencorev1beta1.Seed, error)

TryUpdateSeedConditions tries to update the status of the seed matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Seed object. If the transformation yields a semantically equal Seed (regarding conditions), no update is done and the operation returns normally.

func TryUpdateSeedStatus Uses

func TryUpdateSeedStatus(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Seed) (*gardencorev1beta1.Seed, error)) (*gardencorev1beta1.Seed, error)

TryUpdateSeedStatus tries to update the status of the seed matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Seed object. If the transformation yields a semantically equal Seed (regarding Status), no update is done and the operation returns normally.

func TryUpdateSeedWithEqualFunc Uses

func TryUpdateSeedWithEqualFunc(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Seed) (*gardencorev1beta1.Seed, error), equal func(cur, updated *gardencorev1beta1.Seed) bool) (*gardencorev1beta1.Seed, error)

TryUpdateSeedWithEqualFunc tries to update the status of the seed matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Seed object. If the equal func concludes a semantically equal Seed, no update is done and the operation returns normally.

func TryUpdateShoot Uses

func TryUpdateShoot(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Shoot) (*gardencorev1beta1.Shoot, error)) (*gardencorev1beta1.Shoot, error)

TryUpdateShoot tries to update the shoot matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Shoot object. If the transformation yields a semantically equal Shoot, no update is done and the operation returns normally.

func TryUpdateShootAnnotations Uses

func TryUpdateShootAnnotations(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Shoot) (*gardencorev1beta1.Shoot, error)) (*gardencorev1beta1.Shoot, error)

TryUpdateShootAnnotations tries to update the annotations of the shoot matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Shoot object. If the transformation yields a semantically equal Shoot (regarding conditions), no update is done and the operation returns normally.

func TryUpdateShootHibernation Uses

func TryUpdateShootHibernation(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Shoot) (*gardencorev1beta1.Shoot, error)) (*gardencorev1beta1.Shoot, error)

TryUpdateShootHibernation tries to update the status of the shoot matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Shoot object. If the transformation yields a semantically equal Shoot, no update is done and the operation returns normally.

func TryUpdateShootLabels Uses

func TryUpdateShootLabels(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Shoot) (*gardencorev1beta1.Shoot, error)) (*gardencorev1beta1.Shoot, error)

TryUpdateShootLabels tries to update the status of the shoot matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Shoot object. If the transformation yields a semantically equal Shoot (regarding labels), no update is done and the operation returns normally.

func TryUpdateShootStatus Uses

func TryUpdateShootStatus(g gardencore.Interface, backoff wait.Backoff, meta metav1.ObjectMeta, transform func(*gardencorev1beta1.Shoot) (*gardencorev1beta1.Shoot, error)) (*gardencorev1beta1.Shoot, error)

TryUpdateShootStatus tries to update the status of the shoot matching the given <meta>. It retries with the given <backoff> characteristics as long as it gets Conflict errors. The transformation function is applied to the current state of the Shoot object. If the transformation yields a semantically equal Shoot (regarding Status), no update is done and the operation returns normally.

func TryUpdateStatus Uses

func TryUpdateStatus(ctx context.Context, backoff wait.Backoff, c client.Client, obj runtime.Object, transform func() error) error

TryUpdateStatus tries to apply the given transformation function onto the given object, and to update its status afterwards. It retries the status update with an exponential backoff.

func ValidDeploymentContainerImageVersion Uses

func ValidDeploymentContainerImageVersion(deploymentToCheck *appsv1.Deployment, containerName, minimumVersion string) (bool, error)

ValidDeploymentContainerImageVersion validates compliance of a deployment container image to a minimum version

func WaitUntilResourceDeleted Uses

func WaitUntilResourceDeleted(ctx context.Context, c client.Client, obj runtime.Object, interval time.Duration) error

WaitUntilResourceDeleted deletes the given resource and then waits until it has been deleted. It respects the given interval and timeout.

func WaitUntilResourceDeletedWithDefaults Uses

func WaitUntilResourceDeletedWithDefaults(ctx context.Context, c client.Client, obj runtime.Object) error

WaitUntilResourceDeletedWithDefaults deletes the given resource and then waits until it has been deleted. It uses a default interval and timeout

func WaitUntilResourcesDeleted Uses

func WaitUntilResourcesDeleted(ctx context.Context, c client.Client, obj runtime.Object, interval time.Duration, opts ...client.ListOption) error

WaitUntilResourcesDeleted waits until the given resources are gone. It respects the given interval and timeout.

type DaemonSetLister Uses

type DaemonSetLister interface {
    // List lists all DaemonSets that match the given selector.
    List(selector labels.Selector) ([]*appsv1.DaemonSet, error)
    // DaemonSets yields a DaemonSetNamespaceLister for the given namespace.
    DaemonSets(namespace string) DaemonSetNamespaceLister
}

DaemonSetLister is a lister of DaemonSets.

func NewDaemonSetLister Uses

func NewDaemonSetLister(source DaemonSetSource) DaemonSetLister

NewDaemonSetLister creates a new DaemonSetLister from the given DaemonSetSource.

type DaemonSetNamespaceLister Uses

type DaemonSetNamespaceLister interface {
    // List lists all DaemonSets that match the given selector in the current namespace.
    List(selector labels.Selector) ([]*appsv1.DaemonSet, error)
    // Get retrieves the DaemonSet with the given name in the current namespace.
    Get(name string) (*appsv1.DaemonSet, error)
}

DaemonSetNamespaceLister is a lister of deployments for a specific namespace.

type DaemonSetSource Uses

type DaemonSetSource func() ([]*appsv1.DaemonSet, error)

DaemonSetSource is a function that produces a slice of DaemonSets or an error.

type DeploymentLister Uses

type DeploymentLister interface {
    // List lists all Deployments that match the given selector.
    List(selector labels.Selector) ([]*appsv1.Deployment, error)
    // Deployments yields a DeploymentNamespaceLister for the given namespace.
    Deployments(namespace string) DeploymentNamespaceLister
}

DeploymentLister is a lister of Deployments.

func NewDeploymentLister Uses

func NewDeploymentLister(source DeploymentSource) DeploymentLister

NewDeploymentLister creates a new DeploymentLister from the given DeploymentSource.

type DeploymentNamespaceLister Uses

type DeploymentNamespaceLister interface {
    // List lists all Deployments that match the given selector in the current namespace.
    List(selector labels.Selector) ([]*appsv1.Deployment, error)
    // Get retrieves the Deployment with the given name in the current namespace.
    Get(name string) (*appsv1.Deployment, error)
}

DeploymentNamespaceLister is a lister of deployments for a specific namespace.

type DeploymentSource Uses

type DeploymentSource func() ([]*appsv1.Deployment, error)

DeploymentSource is a function that produces a slice of Deployments or an error.

type EtcdLister Uses

type EtcdLister interface {
    // List lists all Etcds that match the given selector.
    List(selector labels.Selector) ([]*druidv1alpha1.Etcd, error)
    // Etcds yields a EtcdNamespaceLister for the given namespace.
    Etcds(namespace string) EtcdNamespaceLister
}

EtcdLister is a lister of Etcds.

func NewEtcdLister Uses

func NewEtcdLister(source EtcdSource) EtcdLister

NewEtcdLister creates a new EtcdLister from the given EtcdSource.

type EtcdNamespaceLister Uses

type EtcdNamespaceLister interface {
    // List lists all Etcds that match the given selector in the current namespace.
    List(selector labels.Selector) ([]*druidv1alpha1.Etcd, error)
    // Get retrieves the Etcd with the given name in the current namespace.
    Get(name string) (*druidv1alpha1.Etcd, error)
}

EtcdNamespaceLister is a lister of etcds for a specific namespace.

type EtcdSource Uses

type EtcdSource func() ([]*druidv1alpha1.Etcd, error)

EtcdSource is a function that produces a slice of Etcds or an error.

type NodeLister Uses

type NodeLister interface {
    // List lists all Nodes that match the given selector.
    List(selector labels.Selector) ([]*corev1.Node, error)
}

NodeLister is a lister of Nodes.

func NewNodeLister Uses

func NewNodeLister(source NodeSource) NodeLister

NewNodeLister creates a new NodeLister from the given NodeSource.

type NodeSource Uses

type NodeSource func() ([]*corev1.Node, error)

NodeSource is a function that produces a slice of Nodes or an error.

type Object Uses

type Object interface {
    runtime.Object
    metav1.Object
}

Object is wrapper interface combining runtime.Object and metav1.Object interfaces together.

type StatefulSetLister Uses

type StatefulSetLister interface {
    // List lists all StatefulSets that match the given selector.
    List(selector labels.Selector) ([]*appsv1.StatefulSet, error)
    // StatefulSets yields a StatefulSetNamespaceLister for the given namespace.
    StatefulSets(namespace string) StatefulSetNamespaceLister
}

StatefulSetLister is a lister of StatefulSets.

func NewStatefulSetLister Uses

func NewStatefulSetLister(source StatefulSetSource) StatefulSetLister

NewStatefulSetLister creates a new StatefulSetLister form the given StatefulSetSource.

type StatefulSetNamespaceLister Uses

type StatefulSetNamespaceLister interface {
    // List lists all StatefulSets that match the given selector in the current namespace.
    List(selector labels.Selector) ([]*appsv1.StatefulSet, error)
    // Get retrieves the StatefulSet with the given name in the current namespace.
    Get(name string) (*appsv1.StatefulSet, error)
}

StatefulSetNamespaceLister is a lister of StatefulSets for a specific namespace.

type StatefulSetSource Uses

type StatefulSetSource func() ([]*appsv1.StatefulSet, error)

StatefulSetSource is a function that produces a slice of StatefulSets or an error.

type WorkerLister Uses

type WorkerLister interface {
    // List lists all Workers that match the given selector in the current namespace.
    List(selector labels.Selector) ([]*extensionsv1alpha1.Worker, error)
    // Workers yields a WorkerNamespaceLister for the given namespace.
    Workers(namespace string) WorkerNamespaceLister
}

WorkerLister is a lister of Workers for a specific namespace.

func NewWorkerLister Uses

func NewWorkerLister(source WorkerSource) WorkerLister

NewWorkerLister creates a new WorkerLister from the given WorkerSource.

type WorkerNamespaceLister Uses

type WorkerNamespaceLister interface {
    // List lists all Workers that match the given selector in the current namespace.
    List(selector labels.Selector) ([]*extensionsv1alpha1.Worker, error)
    // Get retrieves the MachineDeployment with the given name in the current namespace.
    Get(name string) (*extensionsv1alpha1.Worker, error)
}

WorkerNamespaceLister is a lister of Workers for a specific namespace.

type WorkerSource Uses

type WorkerSource func() ([]*extensionsv1alpha1.Worker, error)

WorkerSource is a function that produces a slice of Workers or an error.

Directories

PathSynopsis
client
health

Package kubernetes imports 32 packages (graph) and is imported by 47 packages. Updated 2020-04-07. Refresh now. Tools for package owners.