client

package
v2.6.13 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExcludedFromDiscovery

func IsExcludedFromDiscovery(objectMeta metav1.ObjectMeta) bool

func PrepareClient

func PrepareClient(stopCh <-chan struct{})

Types

type Client

type Client struct {
	Distribution string
	// contains filtered or unexported fields
}
var K8S *Client

func CreateClient

func CreateClient(clientset kubernetes.Interface, stopCh <-chan struct{}, rootApiPath string, permissions *PermissionCheckResult) *Client

CreateClient is visible for testing

func (*Client) DaemonSetByNamespaceAndName

func (c *Client) DaemonSetByNamespaceAndName(namespace string, name string) *appsv1.DaemonSet

func (*Client) DaemonSets

func (c *Client) DaemonSets() []*appsv1.DaemonSet

func (*Client) DeploymentByNamespaceAndName

func (c *Client) DeploymentByNamespaceAndName(namespace string, name string) *appsv1.Deployment

func (*Client) Deployments

func (c *Client) Deployments() []*appsv1.Deployment

func (*Client) Events

func (c *Client) Events(since time.Time) *[]corev1.Event

func (*Client) ExecInPod added in v2.6.9

func (c *Client) ExecInPod(_ context.Context, namespace, podName, containerName string, command []string) (string, error)

ExecInPod executes a command in a pod container and returns the output

func (*Client) FileExistsInPod added in v2.6.9

func (c *Client) FileExistsInPod(ctx context.Context, namespace, podName, containerName, filePath string) (bool, error)

FileExistsInPod checks if a file exists in a pod container

func (*Client) GetConfig added in v2.6.4

func (c *Client) GetConfig() *rest.Config

GetConfig returns the kubernetes config used by the client

func (*Client) GetHAProxyIngressClasses added in v2.6.4

func (c *Client) GetHAProxyIngressClasses() ([]string, bool)

func (*Client) GetIngressControllerByClassName added in v2.6.4

func (c *Client) GetIngressControllerByClassName(className string) string

func (*Client) GetNginxIngressClasses added in v2.6.9

func (c *Client) GetNginxIngressClasses() ([]string, bool)

func (*Client) HorizontalPodAutoscalerByNamespaceAndDeployment

func (c *Client) HorizontalPodAutoscalerByNamespaceAndDeployment(namespace string, reference string) *autoscalingv2.HorizontalPodAutoscaler

func (*Client) IngressByNamespaceAndName added in v2.6.4

func (c *Client) IngressByNamespaceAndName(namespace string, name string, forceUpdate ...bool) (*networkingv1.Ingress, error)

func (*Client) IngressClasses added in v2.6.4

func (c *Client) IngressClasses() []*networkingv1.IngressClass

func (*Client) Ingresses added in v2.6.4

func (c *Client) Ingresses() []*networkingv1.Ingress

func (*Client) Namespaces

func (c *Client) Namespaces() []*corev1.Namespace

func (*Client) Nodes

func (c *Client) Nodes() []*corev1.Node

func (*Client) NodesReadyCount

func (c *Client) NodesReadyCount() int

func (*Client) Notify

func (c *Client) Notify(ch chan<- interface{})

func (*Client) Permissions

func (c *Client) Permissions() *PermissionCheckResult

func (*Client) PodByNamespaceAndName

func (c *Client) PodByNamespaceAndName(namespace string, name string) *corev1.Pod

func (*Client) Pods

func (c *Client) Pods() []*corev1.Pod

func (*Client) PodsByLabelSelector

func (c *Client) PodsByLabelSelector(labelSelector *metav1.LabelSelector, namespace string) []*corev1.Pod

func (*Client) PrintMemoryUsage added in v2.6.11

func (c *Client) PrintMemoryUsage()

func (*Client) RemoveAnnotationBlock added in v2.6.4

func (c *Client) RemoveAnnotationBlock(ctx context.Context, namespace string, ingressName string, annotationKey string, executionId uuid.UUID, startMarker string, endMarker string) error

func (*Client) ReplicaSetByNamespaceAndName

func (c *Client) ReplicaSetByNamespaceAndName(namespace string, name string) *appsv1.ReplicaSet

func (*Client) ReplicaSets added in v2.6.9

func (c *Client) ReplicaSets() []*appsv1.ReplicaSet

func (*Client) ServicesByPod

func (c *Client) ServicesByPod(pod *corev1.Pod) []*corev1.Service

func (*Client) ServicesMatchingToPodLabels

func (c *Client) ServicesMatchingToPodLabels(namespace string, labelSelector map[string]string) []*corev1.Service

func (*Client) StatefulSetByNamespaceAndName

func (c *Client) StatefulSetByNamespaceAndName(namespace string, name string) *appsv1.StatefulSet

func (*Client) StatefulSets

func (c *Client) StatefulSets() []*appsv1.StatefulSet

func (*Client) StopNotify

func (c *Client) StopNotify(ch chan<- interface{})

func (*Client) UpdateIngressAnnotation added in v2.6.4

func (c *Client) UpdateIngressAnnotation(ctx context.Context, namespace string, ingressName string, annotationKey string, newAnnotationSuffix string) error

func (*Client) UpdateIngressAnnotationWithReturn added in v2.6.9

func (c *Client) UpdateIngressAnnotationWithReturn(ctx context.Context, namespace string, ingressName string, annotationKey string, newAnnotationSuffix string) (string, error)

type OwnerRefListWithResource

type OwnerRefListWithResource struct {
	OwnerRefs  []OwnerReference
	Deployment *appsv1.Deployment
	Daemonset  *appsv1.DaemonSet
}

func OwnerReferences

func OwnerReferences(k8s *Client, meta *metav1.ObjectMeta) OwnerRefListWithResource

func (OwnerRefListWithResource) ContainerSpec

func (o OwnerRefListWithResource) ContainerSpec(containerName string) *corev1.Container

type OwnerReference

type OwnerReference struct {
	Name string
	Kind string
}

type PermissionCheckOutcome

type PermissionCheckOutcome string
const (
	WARN  PermissionCheckOutcome = "warn"
	ERROR PermissionCheckOutcome = "error"
	OK    PermissionCheckOutcome = "ok"
)

type PermissionCheckResult

type PermissionCheckResult struct {
	Permissions map[string]PermissionCheckOutcome
}

func MockAllPermitted

func MockAllPermitted() *PermissionCheckResult

func (*PermissionCheckResult) CanReadHorizontalPodAutoscalers

func (p *PermissionCheckResult) CanReadHorizontalPodAutoscalers() bool

func (*PermissionCheckResult) CanReadNamespaces

func (p *PermissionCheckResult) CanReadNamespaces() bool

func (*PermissionCheckResult) IsCrashLoopPodPermitted

func (p *PermissionCheckResult) IsCrashLoopPodPermitted() bool

func (*PermissionCheckResult) IsDeletePodPermitted

func (p *PermissionCheckResult) IsDeletePodPermitted() bool

func (*PermissionCheckResult) IsDrainNodePermitted

func (p *PermissionCheckResult) IsDrainNodePermitted() bool

func (*PermissionCheckResult) IsListIngressClassesPermitted added in v2.6.4

func (p *PermissionCheckResult) IsListIngressClassesPermitted() bool

func (*PermissionCheckResult) IsListIngressPermitted added in v2.6.4

func (p *PermissionCheckResult) IsListIngressPermitted() bool

func (*PermissionCheckResult) IsModifyIngressPermitted added in v2.6.4

func (p *PermissionCheckResult) IsModifyIngressPermitted() bool

func (*PermissionCheckResult) IsRolloutRestartPermitted

func (p *PermissionCheckResult) IsRolloutRestartPermitted() bool

func (*PermissionCheckResult) IsScaleDeploymentPermitted

func (p *PermissionCheckResult) IsScaleDeploymentPermitted() bool

func (*PermissionCheckResult) IsScaleReplicaSetPermitted added in v2.6.9

func (p *PermissionCheckResult) IsScaleReplicaSetPermitted() bool

func (*PermissionCheckResult) IsScaleStatefulSetPermitted

func (p *PermissionCheckResult) IsScaleStatefulSetPermitted() bool

func (*PermissionCheckResult) IsSetImageDeploymentPermitted added in v2.6.9

func (p *PermissionCheckResult) IsSetImageDeploymentPermitted() bool

func (*PermissionCheckResult) IsTaintNodePermitted

func (p *PermissionCheckResult) IsTaintNodePermitted() bool

Jump to

Keyboard shortcuts

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