kubernetes

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContainers

func GetContainers(pod *corev1.Pod) []string

func GetHealthyReplicasCount

func GetHealthyReplicasCount(replicaset *appsv1.ReplicaSet) (int64, error)

func GetOwnerName

func GetOwnerName(pod corev1.Pod) (string, error)

func Init

func Init() error

func PodKind

func PodKind(pod corev1.Pod) string

PodKind returns the type of the pod if no owner reference is found, the pod is considered as a standalone pod

Types

type Client

type Client struct {
	*k8s.Clientset
	RestConfig *rest.Config
}

func GetClient

func GetClient() *Client

func (Client) CreateEphemeralContainer

func (client Client) CreateEphemeralContainer(pod *corev1.Pod, container, name, image string, ttl int) error

func (Client) EvictPod

func (client Client) EvictPod(pod corev1.Pod) error

func (Client) Exec

func (client Client) Exec(namespace, pod, container string, command []string, script string) (*bytes.Buffer, error)

func (Client) GetClusterRole

func (client Client) GetClusterRole(name, namespace string) (*rbacv1.ClusterRole, error)

func (Client) GetConfigMap

func (client Client) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)

func (Client) GetDaemonSet

func (client Client) GetDaemonSet(name, namespace string) (*appsv1.DaemonSet, error)

func (Client) GetDaemonsetFromPod

func (client Client) GetDaemonsetFromPod(pod *corev1.Pod) (*appsv1.DaemonSet, error)

func (Client) GetDeployment

func (client Client) GetDeployment(name, namespace string) (*appsv1.Deployment, error)

func (Client) GetDeploymentFromPod

func (client Client) GetDeploymentFromPod(pod *corev1.Pod) (*appsv1.Deployment, error)

func (Client) GetLeaseHolder

func (client Client) GetLeaseHolder() (<-chan string, error)

func (Client) GetNamespace

func (client Client) GetNamespace(name string) (*corev1.Namespace, error)

func (Client) GetNode

func (client Client) GetNode(name string) (*corev1.Node, error)

func (Client) GetNodeFromPod

func (client Client) GetNodeFromPod(pod *corev1.Pod) (*corev1.Node, error)

func (Client) GetPod

func (client Client) GetPod(pod, namespace string) (*corev1.Pod, error)

func (Client) GetReplicaSet

func (client Client) GetReplicaSet(name, namespace string) (*appsv1.ReplicaSet, error)

func (Client) GetReplicasetFromPod

func (client Client) GetReplicasetFromPod(pod *corev1.Pod) (*appsv1.ReplicaSet, error)

func (Client) GetRole

func (client Client) GetRole(name, namespace string) (*rbacv1.Role, error)

func (Client) GetSecret

func (client Client) GetSecret(name, namespace string) (*corev1.Secret, error)

func (Client) GetService

func (client Client) GetService(name, namespace string) (*corev1.Service, error)

func (Client) GetServiceAccount

func (client Client) GetServiceAccount(name, namespace string) (*corev1.ServiceAccount, error)

func (Client) GetStatefulSet

func (client Client) GetStatefulSet(name, namespace string) (*appsv1.StatefulSet, error)

func (Client) GetStatefulsetFromPod

func (client Client) GetStatefulsetFromPod(pod *corev1.Pod) (*appsv1.StatefulSet, error)

func (Client) GetTarget

func (client Client) GetTarget(resource, name, namespace string) (any, error)

func (Client) GetWatcherEndpointSlices

func (client Client) GetWatcherEndpointSlices(labelSelector, namespace string) (<-chan watch.Event, error)

func (Client) ListPods

func (client Client) ListPods(ctx context.Context, opts metav1.ListOptions) (*corev1.PodList, error)

type DrainClient

type DrainClient interface {
	GetPod(name, namespace string) (*corev1.Pod, error)
	GetNodeFromPod(pod *corev1.Pod) (*corev1.Node, error)
	ListPods(ctx context.Context, options metav1.ListOptions) (*corev1.PodList, error)
	EvictPod(pod corev1.Pod) error
	GetReplicaSet(name, namespace string) (*appsv1.ReplicaSet, error)
}

type KubernetesClient

type KubernetesClient interface {
	GetPod(pod, namespace string) (*corev1.Pod, error)
	GetDeployment(name, namespace string) (*appsv1.Deployment, error)
	GetDaemonSet(name, namespace string) (*appsv1.DaemonSet, error)
	GetStatefulSet(name, namespace string) (*appsv1.StatefulSet, error)
	GetReplicaSet(name, namespace string) (*appsv1.ReplicaSet, error)
	GetNode(name string) (*corev1.Node, error)
	GetDeploymentFromPod(pod *corev1.Pod) (*appsv1.Deployment, error)
	GetDaemonsetFromPod(pod *corev1.Pod) (*appsv1.DaemonSet, error)
	GetStatefulsetFromPod(pod *corev1.Pod) (*appsv1.StatefulSet, error)
	GetReplicasetFromPod(pod *corev1.Pod) (*appsv1.ReplicaSet, error)
	GetNodeFromPod(pod *corev1.Pod) (*corev1.Node, error)
	GetTarget(resource, name, namespace string) (any, error)
	GetNamespace(name string) (*corev1.Namespace, error)
	GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)
	GetSecret(name, namespace string) (*corev1.Secret, error)
	GetService(name, namespace string) (*corev1.Service, error)
	GetServiceAccount(name, namespace string) (*corev1.ServiceAccount, error)
	GetRole(name, namespace string) (*rbacv1.Role, error)
	GetClusterRole(name, namespace string) (*rbacv1.ClusterRole, error)
	GetWatcherEndpointSlices(labelSelector, namespace string) (<-chan watch.Event, error)
	GetLeaseHolder() (<-chan string, error)
	Exec(namespace, pod, container string, command []string, script string) (*bytes.Buffer, error)
	CreateEphemeralContainer(pod *corev1.Pod, container, name string, ttl int) error
	ListPods(ctx context.Context, opts metav1.ListOptions) (*corev1.PodList, error)
	EvictPod(pod corev1.Pod) error
}

need to be renamed to Client all the actionners need to depend on this interface so we can rename it to Client without generating errors

Jump to

Keyboard shortcuts

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