Documentation ¶
Index ¶
- func DefaultBuildConfigFunc() (*rest.Config, error)
- func DefaultNewClientsetFunc(config *rest.Config) (kubernetes.Interface, error)
- func GetKubernetesClient(buildConfigFunc func() (*rest.Config, error), ...) (*rest.Config, kubernetes.Interface, error)
- type PodScrapeDetails
- type PodScrapeWatcher
- func (pw *PodScrapeWatcher) DeletePodMetrics(pod *corev1.Pod)
- func (pw *PodScrapeWatcher) GetPodMetricsEndpoints() map[string]PodScrapeDetails
- func (pw *PodScrapeWatcher) UpdatePodMetrics(pod *corev1.Pod)
- func (pw *PodScrapeWatcher) WatchPods(clientset kubernetes.Interface, namespace string, labels map[string]string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultBuildConfigFunc ¶
Default functions to be used when not testing.
func DefaultNewClientsetFunc ¶
func DefaultNewClientsetFunc(config *rest.Config) (kubernetes.Interface, error)
func GetKubernetesClient ¶
func GetKubernetesClient( buildConfigFunc func() (*rest.Config, error), newClientsetFunc func(*rest.Config) (kubernetes.Interface, error), ) (*rest.Config, kubernetes.Interface, error)
GetKubernetesClient creates a Kubernetes clientset using in-cluster or kubeconfig setup.
Types ¶
type PodScrapeDetails ¶
PodScrapeDetails stores the metrics endpoint details and metadata for a pod.
type PodScrapeWatcher ¶
type PodScrapeWatcher struct { PodMetricsEndpoints map[string]PodScrapeDetails // Function variables for update and delete operations, to allow mocking during tests. UpdatePodMetricsFunc func(*corev1.Pod) DeletePodMetricsFunc func(*corev1.Pod) // contains filtered or unexported fields }
PodScrapeWatcher manages pod metrics and provides methods to handle updates and deletions.
func NewPodScrapeWatcher ¶
func NewPodScrapeWatcher() *PodScrapeWatcher
NewPodScrapeWatcher initializes a new PodScrapeWatcher with default function implementations.
func (*PodScrapeWatcher) DeletePodMetrics ¶
func (pw *PodScrapeWatcher) DeletePodMetrics(pod *corev1.Pod)
DeletePodMetrics removes the pod metrics entry when a pod is deleted.
func (*PodScrapeWatcher) GetPodMetricsEndpoints ¶
func (pw *PodScrapeWatcher) GetPodMetricsEndpoints() map[string]PodScrapeDetails
GetPodMetricsEndpoints returns a copy of the current pod metrics endpoints.
func (*PodScrapeWatcher) UpdatePodMetrics ¶
func (pw *PodScrapeWatcher) UpdatePodMetrics(pod *corev1.Pod)
UpdatePodMetrics updates or adds pod metrics based on the pod annotations.
func (*PodScrapeWatcher) WatchPods ¶
func (pw *PodScrapeWatcher) WatchPods(clientset kubernetes.Interface, namespace string, labels map[string]string)
WatchPods starts the SharedInformer to monitor pod events and updates the metrics endpoints accordingly.