...

Package kubernetes

import "k8s-connector/kubernetes"
Overview
Index

Overview ▾

Index ▾

func LoadKubeconfig(pathOverride string, logger *logr.Logger) (*rest.Config, error)
type KubernetesClusterClient
type KubernetesClusterClientImpl
    func NewKubernetesClusterClientImpl(clusterName string, kubeconfig *rest.Config, parentComponentName string, logger *logr.Logger) (*KubernetesClusterClientImpl, error)
    func (c *KubernetesClusterClientImpl) ClientSet() clientset.Interface
    func (c *KubernetesClusterClientImpl) ClusterName() string
    func (c *KubernetesClusterClientImpl) CommitSchedulingDecision(ctx context.Context, schedulingDecision *client.ClusterSchedulingDecision) (*client.CommitSchedulingDecisionSuccess, error)
    func (c *KubernetesClusterClientImpl) EventRecorder() record.EventRecorder
    func (c *KubernetesClusterClientImpl) FetchNode(ctx context.Context, name string) (*core.Node, error)
    func (c *KubernetesClusterClientImpl) FetchPodsScheduledOnNode(ctx context.Context, nodeName string) ([]core.Pod, error)
type KubernetesClusterClientsManager
    func NewKubernetesClusterClientsManager(clusterConfigs map[string]*rest.Config, parentComponentName string, logger *logr.Logger) (*KubernetesClusterClientsManager, error)
type KubernetesNodesCache
    func NewKubernetesNodesCache(clusterClient KubernetesClusterClient, updateInterval time.Duration, queueSize int) *KubernetesNodesCache
    func (knc *KubernetesNodesCache) Nodes() collections.ConcurrentObjectStore[*client.ClusterNode]
    func (knc *KubernetesNodesCache) QueuePodOnNode(pod *core.Pod, nodeName string) client.PodQueuedOnNode
    func (knc *KubernetesNodesCache) StartWatch(ctx context.Context) error
type KubernetesPodSource
    func NewKubernetesPodSource(clusterClientsMgr *KubernetesClusterClientsManager, schedConfig *config.SchedulerConfig) *KubernetesPodSource
    func (kps *KubernetesPodSource) IncomingPods() chan *pipeline.IncomingPod
    func (kps *KubernetesPodSource) StartWatching() error
    func (kps *KubernetesPodSource) StopWatching() error

Package files

kubeconfig_utils.go kubernetes_cluster_client.go kubernetes_cluster_client_impl.go kubernetes_cluster_clients_manager.go kubernetes_nodes_cache.go kubernetes_pod_source.go

func LoadKubeconfig

func LoadKubeconfig(pathOverride string, logger *logr.Logger) (*rest.Config, error)

Loads the Kubernetes config. If the pathOverride is set, we load the KUBECONFIG from there, otherwise we attempt to load it from a pod environment (i.e., when operating inside a cluster). If this fails, we try to use the local KUBECONFIG file.

type KubernetesClusterClient

Kubernetes-specific extension of the ClusterClient.

type KubernetesClusterClient interface {
    client.LocalClusterClient

    // Gets the ClientSet for communicating with a Kubernetes cluster.
    ClientSet() clientset.Interface

    // Gets the EventRecorder for this cluster.
    EventRecorder() record.EventRecorder
}

type KubernetesClusterClientImpl

Default KubernetesClusterClient implementation.

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

func NewKubernetesClusterClientImpl

func NewKubernetesClusterClientImpl(
    clusterName string,
    kubeconfig *rest.Config,
    parentComponentName string,
    logger *logr.Logger,
) (*KubernetesClusterClientImpl, error)

Creates a new KubernetesClusterClientImpl using the specified kubeconfig.

- clusterName is the name of the cluster to connect to - kubeconfig is the respective kubeconfig - parentComponentName is the name of the component that creates this client (this is used as the source name in the event recorder) - logger the Logger that should be used for logging

func (*KubernetesClusterClientImpl) ClientSet

func (c *KubernetesClusterClientImpl) ClientSet() clientset.Interface

func (*KubernetesClusterClientImpl) ClusterName

func (c *KubernetesClusterClientImpl) ClusterName() string

func (*KubernetesClusterClientImpl) CommitSchedulingDecision

func (c *KubernetesClusterClientImpl) CommitSchedulingDecision(ctx context.Context, schedulingDecision *client.ClusterSchedulingDecision) (*client.CommitSchedulingDecisionSuccess, error)

func (*KubernetesClusterClientImpl) EventRecorder

func (c *KubernetesClusterClientImpl) EventRecorder() record.EventRecorder

func (*KubernetesClusterClientImpl) FetchNode

func (c *KubernetesClusterClientImpl) FetchNode(ctx context.Context, name string) (*core.Node, error)

func (*KubernetesClusterClientImpl) FetchPodsScheduledOnNode

func (c *KubernetesClusterClientImpl) FetchPodsScheduledOnNode(ctx context.Context, nodeName string) ([]core.Pod, error)

type KubernetesClusterClientsManager

ClusterClientsManager for Kubernetes.

type KubernetesClusterClientsManager struct {
    *client.GenericClusterClientsManager[KubernetesClusterClient]
}

func NewKubernetesClusterClientsManager

func NewKubernetesClusterClientsManager(clusterConfigs map[string]*rest.Config, parentComponentName string, logger *logr.Logger) (*KubernetesClusterClientsManager, error)

Creates a new KubernetesClusterClientsManager and initializes it with clients for the specified cluster configurations.

type KubernetesNodesCache

NodesCache implementation for Kubernetes.

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

func NewKubernetesNodesCache

func NewKubernetesNodesCache(
    clusterClient KubernetesClusterClient,
    updateInterval time.Duration,
    queueSize int,
) *KubernetesNodesCache

func (*KubernetesNodesCache) Nodes

func (knc *KubernetesNodesCache) Nodes() collections.ConcurrentObjectStore[*client.ClusterNode]

func (*KubernetesNodesCache) QueuePodOnNode

func (knc *KubernetesNodesCache) QueuePodOnNode(pod *core.Pod, nodeName string) client.PodQueuedOnNode

func (*KubernetesNodesCache) StartWatch

func (knc *KubernetesNodesCache) StartWatch(ctx context.Context) error

type KubernetesPodSource

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

func NewKubernetesPodSource

func NewKubernetesPodSource(clusterClientsMgr *KubernetesClusterClientsManager, schedConfig *config.SchedulerConfig) *KubernetesPodSource

Creates a new KubernetesPodSource for all clusters in the specified ClusterClientsManager.

func (*KubernetesPodSource) IncomingPods

func (kps *KubernetesPodSource) IncomingPods() chan *pipeline.IncomingPod

func (*KubernetesPodSource) StartWatching

func (kps *KubernetesPodSource) StartWatching() error

Creates the channel available through IncomingPods() and starts watching for pods.

func (*KubernetesPodSource) StopWatching

func (kps *KubernetesPodSource) StopWatching() error

Stops watching for pods and closes the channel available through IncomingPods().