Documentation
¶
Overview ¶
Package k8s provides Kubernetes cluster interaction capabilities. This file contains caching functionality for cluster status.
Package k8s provides Kubernetes cluster interaction capabilities. This file contains helper functions for collecting cluster health data.
Package k8s provides Kubernetes cluster interaction capabilities. It handles kubeconfig parsing, cluster discovery, and status monitoring across multiple Kubernetes clusters with support for concurrent operations.
Package k8s provides Kubernetes cluster interaction capabilities. This file defines shared types used by the provider and collectors.
Index ¶
- Constants
- type CachedClusterStatus
- type ClusterInfo
- type ClusterStatus
- type NodeInfo
- type PodInfo
- type Provider
- func (p *Provider) ClearCache()
- func (p *Provider) GetAllClusterStatuses(ctx context.Context) []*ClusterStatus
- func (p *Provider) GetClusterByContext(contextName string) (*ClusterInfo, error)
- func (p *Provider) GetClusterStatus(ctx context.Context, contextName string) (*ClusterStatus, error)
- func (p *Provider) GetClusters() []*ClusterInfo
- func (p *Provider) GetCurrentContext() string
- func (p *Provider) SetCacheTTL(ttl time.Duration)
- func (p *Provider) SetCurrentContext(contextName string) error
Constants ¶
const ( // DefaultAPITimeout is the default timeout for Kubernetes API calls DefaultAPITimeout = 30 * time.Second // DiscoveryTimeout is the timeout for discovery API calls (version checks) DiscoveryTimeout = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedClusterStatus ¶
type CachedClusterStatus struct {
Status *ClusterStatus
ExpiresAt time.Time
}
CachedClusterStatus holds a cached cluster status with expiration
type ClusterInfo ¶
type ClusterInfo struct {
Name string
Server string
Context string
User string
Namespace string
IsCurrent bool
IsReachable bool
}
ClusterInfo represents information about a Kubernetes cluster
type ClusterStatus ¶
type ClusterStatus struct {
ClusterInfo
Version string
NodeCount int
HealthyNodes int
Nodes []NodeInfo
NamespaceList []string
APIServerURL string
Error string
PodCount int
HealthyPods int
UnhealthyPods []PodInfo
}
ClusterStatus represents detailed status information about a cluster
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider manages Kubernetes cluster information and operations
func NewProvider ¶
NewProvider creates a new Kubernetes provider
func (*Provider) ClearCache ¶
func (p *Provider) ClearCache()
ClearCache clears all cached cluster statuses
func (*Provider) GetAllClusterStatuses ¶
func (p *Provider) GetAllClusterStatuses(ctx context.Context) []*ClusterStatus
GetAllClusterStatuses returns status information for all clusters in parallel
func (*Provider) GetClusterByContext ¶
func (p *Provider) GetClusterByContext(contextName string) (*ClusterInfo, error)
GetClusterByContext returns cluster information for a specific context
func (*Provider) GetClusterStatus ¶
func (*Provider) GetClusters ¶
func (p *Provider) GetClusters() []*ClusterInfo
GetClusters returns a list of all clusters in the kubeconfig
func (*Provider) GetCurrentContext ¶
GetCurrentContext returns the current context name
func (*Provider) SetCacheTTL ¶
SetCacheTTL sets the cache time-to-live duration
func (*Provider) SetCurrentContext ¶
SetCurrentContext overrides the current context