kubernetes

package
v0.80.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNodeReady

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)
	// ListPodSecurityPolices returns the list of Pod Security Policies
	ListPodSecurityPolices(opts metav1.ListOptions) (*policyv1.PodSecurityPolicyList, 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

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

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

DeleteClusterRole deletes the passed in cluster role.

func (*ClientSetClient) DeleteDaemonSet

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

DeleteDaemonSet deletes the passed in daemonset.

func (*ClientSetClient) DeleteDeployment

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

DeleteDeployment deletes the passed in daemonset.

func (*ClientSetClient) DeleteNode

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

DeleteNode deregisters the node in the api server.

func (*ClientSetClient) DeletePod

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

DeletePod deletes the passed in pod.

func (*ClientSetClient) DeletePods

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

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

DeleteSecret deletes the passed in secret.

func (*ClientSetClient) DeleteServiceAccount

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

DeleteServiceAccount deletes the passed in service account.

func (*ClientSetClient) EvictPod

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

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

GetDaemonSet returns a given daemonset in a namespace.

func (*ClientSetClient) GetDeployment

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

GetDeployment returns a given deployment in a namespace.

func (*ClientSetClient) GetNode

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

GetNode returns details about node with passed in name.

func (*ClientSetClient) ListAllPods

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

ListAllPods returns all Pods running.

func (*ClientSetClient) ListDaemonSets

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

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

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

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

func (*ClientSetClient) ListNodesByOptions

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

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

func (*ClientSetClient) ListPodSecurityPolices added in v0.75.4

func (c *ClientSetClient) ListPodSecurityPolices(opts metav1.ListOptions) (*policyv1.PodSecurityPolicyList, error)

ListPodSecurityPolices returns the list of Pod Security Policies

func (*ClientSetClient) ListPods

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

ListPods returns Pods running on the passed in node.

func (*ClientSetClient) ListPodsByOptions

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

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

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

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

func (*ClientSetClient) ListServiceAccountsByOptions

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

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

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

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

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

UpdateDeployment updates a deployment to match the given specification.

func (*ClientSetClient) UpdateNode

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

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

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

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

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

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

DeleteSecret deletes the passed in secret.

func (*CompositeClientSet) DeleteServiceAccount

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

DeleteServiceAccount deletes the passed in service account.

func (*CompositeClientSet) GetDeployment

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

GetDeployment blah.

func (*CompositeClientSet) ListDaemonSets

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

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

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

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

func (*CompositeClientSet) ListPods

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

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

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

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

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