kubernetes

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNodeReady added in v0.59.0

func IsNodeReady(node *v1.Node) bool

IsNodeReady returns true if the NodeReady condition of node is set to true.

Copy of https://github.com/kubernetes/kubernetes/blob/886e04f1fffbb04faf8a9f9ee141143b2684ae68/pkg/api/v1/node/util.go#L40

Types

type Client

type Client interface {
	// ListPods returns Pods running on the passed in node.
	ListPods(node *v1.Node) (*v1.PodList, error)
	// ListPods returns all Pods running
	ListAllPods() (*v1.PodList, error)
	// ListNodes returns a list of Nodes registered in the api server.
	ListNodes() (*v1.NodeList, error)
	// ListNodesByOptions returns a list of Nodes registered in the api server.
	ListNodesByOptions(opts metav1.ListOptions) (*v1.NodeList, error)
	// ListServiceAccounts returns a list of Service Accounts in a namespace
	ListServiceAccounts(namespace string) (*v1.ServiceAccountList, error)
	// GetDaemonSet returns details about DaemonSet with passed in name.
	GetDaemonSet(namespace, name string) (*appsv1.DaemonSet, error)
	// GetDeployment returns a given deployment in a namespace.
	GetDeployment(namespace, name string) (*appsv1.Deployment, error)
	// GetNode returns details about node with passed in name.
	GetNode(name string) (*v1.Node, error)
	// UpdateNode updates the node in the api server with the passed in info.
	UpdateNode(node *v1.Node) (*v1.Node, error)
	// DeleteNode deregisters node in the api server.
	DeleteNode(name string) error
	// SupportEviction queries the api server to discover if it supports eviction, and returns supported type if it is supported.
	SupportEviction() (string, error)
	// DeleteClusterRole deletes the passed in ClusterRole.
	DeleteClusterRole(role *rbacv1.ClusterRole) error
	// DeleteDaemonSet deletes the passed in DaemonSet.
	DeleteDaemonSet(ds *appsv1.DaemonSet) error
	// DeleteDeployment deletes the passed in Deployment.
	DeleteDeployment(ds *appsv1.Deployment) error
	// DeletePod deletes the passed in pod.
	DeletePod(pod *v1.Pod) error
	// DeleteServiceAccount deletes the passed in service account.
	DeleteServiceAccount(sa *v1.ServiceAccount) error
	// EvictPod evicts the passed in pod using the passed in api version.
	EvictPod(pod *v1.Pod, policyGroupVersion string) error
	// WaitForDelete waits until all pods are deleted. Returns all pods not deleted and an error on failure.
	WaitForDelete(logger *log.Entry, pods []v1.Pod, usingEviction bool) ([]v1.Pod, error)
	// UpdateDeployment updates a deployment to match the given specification.
	UpdateDeployment(namespace string, deployment *appsv1.Deployment) (*appsv1.Deployment, error)
}

Client interface models client for interacting with kubernetes api server

type ClientSetClient added in v0.60.0

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

ClientSetClient is a Kubernetes client hooked up to a live api server.

func NewClient

func NewClient(apiserverURL, kubeConfig string, interval, timeout time.Duration) (*ClientSetClient, error)

NewClient returns a KubernetesClient hooked up to the api server at the apiserverURL.

func (*ClientSetClient) DeleteClusterRole added in v0.60.0

func (c *ClientSetClient) DeleteClusterRole(role *rbacv1.ClusterRole) error

DeleteClusterRole deletes the passed in cluster role.

func (*ClientSetClient) DeleteDaemonSet added in v0.60.0

func (c *ClientSetClient) DeleteDaemonSet(daemonset *appsv1.DaemonSet) error

DeleteDaemonSet deletes the passed in daemonset.

func (*ClientSetClient) DeleteDeployment added in v0.60.0

func (c *ClientSetClient) DeleteDeployment(deployment *appsv1.Deployment) error

DeleteDeployment deletes the passed in daemonset.

func (*ClientSetClient) DeleteNode added in v0.60.0

func (c *ClientSetClient) DeleteNode(name string) error

DeleteNode deregisters the node in the api server.

func (*ClientSetClient) DeletePod added in v0.60.0

func (c *ClientSetClient) DeletePod(pod *v1.Pod) error

DeletePod deletes the passed in pod.

func (*ClientSetClient) DeletePods added in v0.60.0

func (c *ClientSetClient) DeletePods(namespace string, opts metav1.ListOptions) error

DeletePods deletes all pods in a namespace that match the option filters.

func (*ClientSetClient) DeleteSecret added in v0.60.0

func (c *ClientSetClient) DeleteSecret(secret *v1.Secret) error

DeleteSecret deletes the passed in secret.

func (*ClientSetClient) DeleteServiceAccount added in v0.60.0

func (c *ClientSetClient) DeleteServiceAccount(sa *v1.ServiceAccount) error

DeleteServiceAccount deletes the passed in service account.

func (*ClientSetClient) EvictPod added in v0.60.0

func (c *ClientSetClient) EvictPod(pod *v1.Pod, policyGroupVersion string) error

EvictPod evicts the passed in pod using the passed in api version.

func (*ClientSetClient) GetDaemonSet added in v0.60.0

func (c *ClientSetClient) GetDaemonSet(namespace, name string) (*appsv1.DaemonSet, error)

GetDaemonSet returns a given daemonset in a namespace.

func (*ClientSetClient) GetDeployment added in v0.60.0

func (c *ClientSetClient) GetDeployment(namespace, name string) (*appsv1.Deployment, error)

GetDeployment returns a given deployment in a namespace.

func (*ClientSetClient) GetNode added in v0.60.0

func (c *ClientSetClient) GetNode(name string) (*v1.Node, error)

GetNode returns details about node with passed in name.

func (*ClientSetClient) ListAllPods added in v0.60.0

func (c *ClientSetClient) ListAllPods() (*v1.PodList, error)

ListAllPods returns all Pods running.

func (*ClientSetClient) ListDaemonSets added in v0.60.0

func (c *ClientSetClient) ListDaemonSets(namespace string, opts metav1.ListOptions) (*appsv1.DaemonSetList, error)

ListDaemonSets returns a list of daemonsets in the provided namespace.

func (*ClientSetClient) ListDeployments added in v0.60.0

func (c *ClientSetClient) ListDeployments(namespace string, opts metav1.ListOptions) (*appsv1.DeploymentList, error)

ListDeployments returns a list of deployments in the provided namespace.

func (*ClientSetClient) ListNodes added in v0.60.0

func (c *ClientSetClient) ListNodes() (*v1.NodeList, error)

ListNodes returns a list of Nodes registered in the api server.

func (*ClientSetClient) ListNodesByOptions added in v0.60.0

func (c *ClientSetClient) ListNodesByOptions(opts metav1.ListOptions) (*v1.NodeList, error)

ListNodesByOptions returns a list of Nodes registered in the api server.

func (*ClientSetClient) ListPods added in v0.60.0

func (c *ClientSetClient) ListPods(node *v1.Node) (*v1.PodList, error)

ListPods returns Pods running on the passed in node.

func (*ClientSetClient) ListPodsByOptions added in v0.60.0

func (c *ClientSetClient) ListPodsByOptions(namespace string, opts metav1.ListOptions) (*v1.PodList, error)

ListPodsByOptions returns Pods based on the passed in list options.

func (*ClientSetClient) ListSecrets added in v0.60.0

func (c *ClientSetClient) ListSecrets(namespace string, opts metav1.ListOptions) (*v1.SecretList, error)

ListSecrets returns a list of secrets in the provided namespace.

func (*ClientSetClient) ListServiceAccounts added in v0.60.0

func (c *ClientSetClient) ListServiceAccounts(namespace string) (*v1.ServiceAccountList, error)

ListServiceAccounts returns a list of Service Accounts in the provided namespace.

func (*ClientSetClient) ListServiceAccountsByOptions added in v0.60.0

func (c *ClientSetClient) ListServiceAccountsByOptions(namespace string, opts metav1.ListOptions) (*v1.ServiceAccountList, error)

ListServiceAccountsByOptions returns a list of Service Accounts in the provided namespace.

func (*ClientSetClient) PatchDaemonSet added in v0.60.0

func (c *ClientSetClient) PatchDaemonSet(namespace, name, jsonPatch string) (*appsv1.DaemonSet, error)

PatchDaemonSet applies a JSON patch to a daemonset in the provided namespace.

func (*ClientSetClient) PatchDeployment added in v0.60.0

func (c *ClientSetClient) PatchDeployment(namespace, name, jsonPatch string) (*appsv1.Deployment, error)

PatchDeployment applies a JSON patch to a deployment in the provided namespace.

func (*ClientSetClient) SupportEviction added in v0.60.0

func (c *ClientSetClient) SupportEviction() (string, error)

SupportEviction queries the api server to discover if it supports eviction, and returns supported type if it is supported.

func (*ClientSetClient) UpdateDeployment added in v0.60.0

func (c *ClientSetClient) UpdateDeployment(namespace string, deployment *appsv1.Deployment) (*appsv1.Deployment, error)

UpdateDeployment updates a deployment to match the given specification.

func (*ClientSetClient) UpdateNode added in v0.60.0

func (c *ClientSetClient) UpdateNode(node *v1.Node) (*v1.Node, error)

UpdateNode updates the node in the api server with the passed in info.

func (*ClientSetClient) WaitForDelete added in v0.60.0

func (c *ClientSetClient) WaitForDelete(logger *log.Entry, pods []v1.Pod, usingEviction bool) ([]v1.Pod, error)

WaitForDelete waits until all pods are deleted. Returns all pods not deleted and an error on failure.

type CompositeClientSet added in v0.60.0

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

CompositeClientSet wraps a pair of Kubernetes clients hooked up to a live api server.

Prefer this client when the cluster CA is expected to change (ex.: secret rotation operations).

func NewCompositeClient added in v0.60.0

func NewCompositeClient(oldCAClient, newCAClient internal.Client, interval, timeout time.Duration) *CompositeClientSet

NewCompositeClient returns a KubernetesClient hooked up to the api server at the apiserverURL.

func (*CompositeClientSet) DeletePods added in v0.60.0

func (c *CompositeClientSet) DeletePods(namespace string, opts metav1.ListOptions) error

DeletePods deletes all pods in a namespace that match the option filters.

func (*CompositeClientSet) DeleteSecret added in v0.60.0

func (c *CompositeClientSet) DeleteSecret(secret *v1.Secret) error

DeleteSecret deletes the passed in secret.

func (*CompositeClientSet) DeleteServiceAccount added in v0.60.0

func (c *CompositeClientSet) DeleteServiceAccount(serviceAccount *v1.ServiceAccount) error

DeleteServiceAccount deletes the passed in service account.

func (*CompositeClientSet) GetDeployment added in v0.60.0

func (c *CompositeClientSet) GetDeployment(namespace, name string) (*appsv1.Deployment, error)

GetDeployment blah.

func (*CompositeClientSet) ListDaemonSets added in v0.60.0

func (c *CompositeClientSet) ListDaemonSets(namespace string, opts metav1.ListOptions) (*appsv1.DaemonSetList, error)

ListDaemonSets returns a list of daemonsets in the provided namespace.

func (*CompositeClientSet) ListDeployments added in v0.60.0

func (c *CompositeClientSet) ListDeployments(namespace string, opts metav1.ListOptions) (*appsv1.DeploymentList, error)

ListDeployments returns a list of deployments in the provided namespace.

func (*CompositeClientSet) ListNodes added in v0.60.0

func (c *CompositeClientSet) ListNodes() (x *v1.NodeList, err error)

ListNodes returns a list of Nodes registered in the api server.

func (*CompositeClientSet) ListPods added in v0.60.0

func (c *CompositeClientSet) ListPods(namespace string, opts metav1.ListOptions) (*v1.PodList, error)

ListPods returns Pods based on the passed in list options.

func (*CompositeClientSet) ListSecrets added in v0.60.0

func (c *CompositeClientSet) ListSecrets(namespace string, opts metav1.ListOptions) (*v1.SecretList, error)

ListSecrets returns a list of secrets in the provided namespace.

func (*CompositeClientSet) ListServiceAccounts added in v0.60.0

func (c *CompositeClientSet) ListServiceAccounts(namespace string, opts metav1.ListOptions) (*v1.ServiceAccountList, error)

ListServiceAccounts returns a list of Service Accounts in the provided namespace.

func (*CompositeClientSet) PatchDaemonSet added in v0.60.0

func (c *CompositeClientSet) PatchDaemonSet(namespace, name, jsonPatch string) (*appsv1.DaemonSet, error)

PatchDaemonSet applies a JSON patch to a daemonset in the provided namespace.

func (*CompositeClientSet) PatchDeployment added in v0.60.0

func (c *CompositeClientSet) PatchDeployment(namespace, name, jsonPatch string) (*appsv1.Deployment, error)

PatchDeployment applies a JSON patch to a deployment in the provided namespace.

type NodeLister

type NodeLister interface {
	ListNodes() (*v1.NodeList, error)
}

NodeLister is an interface implemented by Kubernetes clients that are able to list cluster nodes

Directories

Path Synopsis
mock_internal
Package mock_internal is a generated GoMock package.
Package mock_internal is a generated GoMock package.
Package mock_kubernetes is a generated GoMock package.
Package mock_kubernetes is a generated GoMock package.

Jump to

Keyboard shortcuts

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