Documentation
¶
Index ¶
- func ComputeStrategyFingerprint(strategies []*domain.SchedulingStrategy) string
- func GetKubernetesPod(podUID string) (apiv1.Pod, bool)
- func SetKubernetesPodCache(podUID string, pod apiv1.Pod)
- func StartPodWatcher(cache *StrategyCache, kubeClient *kubernetes.Clientset) (stopCh chan struct{}, err error)
- type PodChangeDetector
- type PodEvent
- type PodFingerprint
- type PodWatcher
- type ProcessFingerprint
- type StrategyCache
- func (c *StrategyCache) GetCacheHits() int
- func (c *StrategyCache) GetCacheMisses() int
- func (c *StrategyCache) GetStats() map[string]interface{}
- func (c *StrategyCache) GetStrategies(currentPods []*domain.PodInfo, inputStrategies []*domain.SchedulingStrategy) []*domain.SchedulingStrategy
- func (c *StrategyCache) GetStrategiesQuick(inputStrategies []*domain.SchedulingStrategy) []*domain.SchedulingStrategy
- func (c *StrategyCache) HasPodsChanged(pods []*domain.PodInfo) bool
- func (c *StrategyCache) Invalidate()
- func (c *StrategyCache) IsValid() bool
- func (c *StrategyCache) SetStrategies(strategies []*domain.SchedulingStrategy)
- func (c *StrategyCache) UpdatePodSnapshot(pods []*domain.PodInfo)
- func (c *StrategyCache) UpdateStrategySnapshot(strategies []*domain.SchedulingStrategy)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeStrategyFingerprint ¶
func ComputeStrategyFingerprint(strategies []*domain.SchedulingStrategy) string
ComputeStrategyFingerprint generates a unique fingerprint for scheduling strategies This excludes PID field as PIDs are calculated, not part of input strategy
func GetKubernetesPod ¶
GetKubernetesPod retrieves pod information from the cache if available
func SetKubernetesPodCache ¶
SetKubernetesPodCache sets the pod information in the cache
func StartPodWatcher ¶
func StartPodWatcher(cache *StrategyCache, kubeClient *kubernetes.Clientset) (stopCh chan struct{}, err error)
StartPodWatcher starts watching Kubernetes pod events and invalidates cache on changes
Types ¶
type PodChangeDetector ¶
type PodChangeDetector struct{}
PodChangeDetector computes fingerprints for pod states
func NewPodChangeDetector ¶
func NewPodChangeDetector() *PodChangeDetector
NewPodChangeDetector creates a new pod change detector
func (*PodChangeDetector) ComputeFingerprint ¶
func (d *PodChangeDetector) ComputeFingerprint(pods []*domain.PodInfo) string
ComputeFingerprint generates a unique fingerprint for pod state
type PodFingerprint ¶
type PodFingerprint struct {
UID string
Processes []ProcessFingerprint
}
PodFingerprint represents essential pod information for change detection
type PodWatcher ¶
type PodWatcher struct {
// contains filtered or unexported fields
}
PodWatcher watches for Kubernetes pod changes
func (*PodWatcher) OnPodChange ¶
func (w *PodWatcher) OnPodChange(callback func())
OnPodChange registers a callback for pod changes
func (*PodWatcher) SimulateEvent ¶
func (w *PodWatcher) SimulateEvent(event PodEvent)
SimulateEvent simulates a pod event (for testing)
type ProcessFingerprint ¶
ProcessFingerprint represents essential process information
type StrategyCache ¶
type StrategyCache struct {
// contains filtered or unexported fields
}
StrategyCache manages caching of scheduling strategies
func NewStrategyCache ¶
func NewStrategyCache() *StrategyCache
NewStrategyCache creates a new strategy cache with default TTL
func NewStrategyCacheWithTTL ¶
func NewStrategyCacheWithTTL(ttl time.Duration) *StrategyCache
NewStrategyCacheWithTTL creates a cache with custom TTL
func (*StrategyCache) GetCacheHits ¶
func (c *StrategyCache) GetCacheHits() int
GetCacheHits returns number of cache hits
func (*StrategyCache) GetCacheMisses ¶
func (c *StrategyCache) GetCacheMisses() int
GetCacheMisses returns number of cache misses
func (*StrategyCache) GetStats ¶
func (c *StrategyCache) GetStats() map[string]interface{}
GetStats returns cache statistics
func (*StrategyCache) GetStrategies ¶
func (c *StrategyCache) GetStrategies(currentPods []*domain.PodInfo, inputStrategies []*domain.SchedulingStrategy) []*domain.SchedulingStrategy
GetStrategies returns cached strategies if valid, otherwise returns nil This version still checks pod fingerprint for backward compatibility
func (*StrategyCache) GetStrategiesQuick ¶
func (c *StrategyCache) GetStrategiesQuick(inputStrategies []*domain.SchedulingStrategy) []*domain.SchedulingStrategy
GetStrategiesQuick returns cached strategies without checking pod state Relies on Kubernetes Watch to invalidate cache when pods change
func (*StrategyCache) HasPodsChanged ¶
func (c *StrategyCache) HasPodsChanged(pods []*domain.PodInfo) bool
HasPodsChanged checks if pods have changed since last snapshot
func (*StrategyCache) Invalidate ¶
func (c *StrategyCache) Invalidate()
Invalidate marks cache as invalid
func (*StrategyCache) IsValid ¶
func (c *StrategyCache) IsValid() bool
IsValid returns whether cache is valid
func (*StrategyCache) SetStrategies ¶
func (c *StrategyCache) SetStrategies(strategies []*domain.SchedulingStrategy)
SetStrategies stores strategies in cache
func (*StrategyCache) UpdatePodSnapshot ¶
func (c *StrategyCache) UpdatePodSnapshot(pods []*domain.PodInfo)
UpdatePodSnapshot updates the pod fingerprint
func (*StrategyCache) UpdateStrategySnapshot ¶
func (c *StrategyCache) UpdateStrategySnapshot(strategies []*domain.SchedulingStrategy)
UpdateStrategySnapshot updates the strategy fingerprint