Documentation
¶
Index ¶
- Constants
- Variables
- type APIBatchConfig
- type APIBatcherStats
- type APICall
- type APICallBatcher
- func (ab *APICallBatcher) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (ab *APICallBatcher) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (ab *APICallBatcher) Flush() error
- func (ab *APICallBatcher) Get(ctx context.Context, key types.NamespacedName, obj client.Object, ...) error
- func (ab *APICallBatcher) GetStats() APIBatcherStats
- func (ab *APICallBatcher) Patch(ctx context.Context, obj client.Object, patch client.Patch, ...) error
- func (ab *APICallBatcher) Stop() error
- func (ab *APICallBatcher) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type APICallResult
- type APICallTimer
- type APICallType
- type BackoffConfig
- type BackoffEntry
- type BackoffManager
- func (bm *BackoffManager) ClassifyError(err error) ErrorType
- func (bm *BackoffManager) CleanupStaleEntries(ctx context.Context, maxAge time.Duration)
- func (bm *BackoffManager) GetBackoffStats() BackoffStats
- func (bm *BackoffManager) GetNextDelay(resourceKey string, errorType ErrorType, err error) time.Duration
- func (bm *BackoffManager) GetRetryCount(resourceKey string) int
- func (bm *BackoffManager) RecordSuccess(resourceKey string)
- func (bm *BackoffManager) SetConfig(errorType ErrorType, config BackoffConfig)
- func (bm *BackoffManager) ShouldRetry(resourceKey string, errorType ErrorType) bool
- type BackoffStats
- type BackoffStrategy
- type BatchConfig
- type ControllerMetrics
- func (cm *ControllerMetrics) NewAPICallTimer(controller, operation, resource string) *APICallTimer
- func (cm *ControllerMetrics) NewReconcileTimer(controller, namespace, name, phase string) *ReconcileTimer
- func (cm *ControllerMetrics) RecordBackoffDelay(controller string, errorType ErrorType, strategy BackoffStrategy, ...)
- func (cm *ControllerMetrics) RecordBackoffReset(controller, resourceType string)
- func (cm *ControllerMetrics) RecordBackoffRetries(controller string, errorType ErrorType, retries int, success bool)
- func (cm *ControllerMetrics) RecordReconcileError(controller string, errorType ErrorType, category string)
- func (cm *ControllerMetrics) RecordReconcileResult(controller, result string)
- func (cm *ControllerMetrics) RecordRequeue(controller, requeueType string, strategy BackoffStrategy)
- func (cm *ControllerMetrics) RecordStatusBatch(controller string, size int, duration time.Duration, priority string)
- func (cm *ControllerMetrics) RecordStatusUpdate(controller, priority, resourceType, outcome string)
- func (cm *ControllerMetrics) UpdateActiveReconcilers(controller string, count int)
- func (cm *ControllerMetrics) UpdateGoroutineCount(controller string, count int)
- func (cm *ControllerMetrics) UpdateMemoryUsage(controller, memType string, bytes int64)
- func (cm *ControllerMetrics) UpdateStatusQueueSize(controller string, size int)
- type E2NodeSetReconcileContext
- type ErrorType
- type OptimizedE2NodeSetReconciler
- type OptimizedNetworkIntentReconciler
- type ReconcileContext
- type ReconcileTimer
- type StatusBatcher
- func (sb *StatusBatcher) Flush() error
- func (sb *StatusBatcher) GetStats() StatusBatcherStats
- func (sb *StatusBatcher) QueueE2NodeSetUpdate(namespacedName types.NamespacedName, readyReplicas, totalReplicas int32, ...) error
- func (sb *StatusBatcher) QueueNetworkIntentUpdate(namespacedName types.NamespacedName, conditionUpdates []metav1.Condition, ...) error
- func (sb *StatusBatcher) QueueUpdate(namespacedName types.NamespacedName, updateFunc func(obj client.Object) error, ...) error
- func (sb *StatusBatcher) Stop() error
- type StatusBatcherStats
- type StatusUpdate
- type UpdatePriority
Constants ¶
View Source
const ( OptimizedE2NodeSetController = "optimized-e2nodeset" E2NodeSetFinalizer = "nephoran.com/e2nodeset-finalizer" E2NodeSetLabelKey = "nephoran.com/e2-nodeset" E2NodeAppLabelKey = "app" E2NodeAppLabelValue = "e2-node-simulator" E2NodeIDLabelKey = "nephoran.com/node-id" E2NodeIndexLabelKey = "nephoran.com/node-index" )
View Source
const ( OptimizedNetworkIntentController = "optimized-networkintent" NetworkIntentFinalizer = "networkintent.nephoran.com/finalizer" )
Variables ¶
View Source
var DefaultAPIBatchConfig = APIBatchConfig{ MaxBatchSize: 5, BatchTimeout: 500 * time.Millisecond, FlushInterval: 1 * time.Second, MaxQueueSize: 500, EnablePriority: true, ParallelBatches: 3, }
View Source
var DefaultBackoffConfigs = map[ErrorType]BackoffConfig{ TransientError: { Strategy: ExponentialBackoff, BaseDelay: 2 * time.Second, MaxDelay: 5 * time.Minute, Multiplier: 2.0, JitterEnabled: true, MaxRetries: 5, }, PermanentError: { Strategy: ConstantBackoff, BaseDelay: 30 * time.Second, MaxDelay: 30 * time.Second, Multiplier: 1.0, JitterEnabled: false, MaxRetries: 2, }, ResourceError: { Strategy: LinearBackoff, BaseDelay: 5 * time.Second, MaxDelay: 2 * time.Minute, Multiplier: 1.5, JitterEnabled: true, MaxRetries: 4, }, ThrottlingError: { Strategy: ExponentialBackoff, BaseDelay: 10 * time.Second, MaxDelay: 10 * time.Minute, Multiplier: 2.5, JitterEnabled: true, MaxRetries: 3, }, ValidationError: { Strategy: ConstantBackoff, BaseDelay: 15 * time.Second, MaxDelay: 15 * time.Second, Multiplier: 1.0, JitterEnabled: false, MaxRetries: 1, }, }
View Source
var DefaultBatchConfig = BatchConfig{ MaxBatchSize: 10, BatchTimeout: 2 * time.Second, FlushInterval: 5 * time.Second, MaxRetries: 3, RetryDelay: 1 * time.Second, EnablePriority: true, MaxQueueSize: 1000, }
Functions ¶
This section is empty.
Types ¶
type APIBatchConfig ¶
type APIBatchConfig struct {
MaxBatchSize int // Maximum number of calls per batch
BatchTimeout time.Duration // Maximum time to wait for a batch
FlushInterval time.Duration // Periodic flush interval
MaxQueueSize int // Maximum queue size
EnablePriority bool // Whether to prioritize calls
ParallelBatches int // Number of parallel batch processors
}
type APIBatcherStats ¶
type APICall ¶
type APICall struct {
Type APICallType
Object client.Object
Key types.NamespacedName
Options []client.GetOption
ListOptions []client.ListOption
PatchOptions []client.PatchOption
CreateOptions []client.CreateOption
UpdateOptions []client.UpdateOption
DeleteOptions []client.DeleteOption
Patch client.Patch
ResultChannel chan APICallResult
Timestamp time.Time
Priority UpdatePriority
}
type APICallBatcher ¶
type APICallBatcher struct {
// contains filtered or unexported fields
}
func NewAPICallBatcher ¶
func NewAPICallBatcher(client client.Client, config APIBatchConfig) *APICallBatcher
func (*APICallBatcher) Create ¶
func (ab *APICallBatcher) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
func (*APICallBatcher) Delete ¶
func (ab *APICallBatcher) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error
func (*APICallBatcher) Flush ¶
func (ab *APICallBatcher) Flush() error
func (*APICallBatcher) Get ¶
func (ab *APICallBatcher) Get(ctx context.Context, key types.NamespacedName, obj client.Object, opts ...client.GetOption) error
func (*APICallBatcher) GetStats ¶
func (ab *APICallBatcher) GetStats() APIBatcherStats
func (*APICallBatcher) Patch ¶
func (ab *APICallBatcher) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
func (*APICallBatcher) Stop ¶
func (ab *APICallBatcher) Stop() error
func (*APICallBatcher) Update ¶
func (ab *APICallBatcher) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
type APICallResult ¶
type APICallTimer ¶
type APICallTimer struct {
// contains filtered or unexported fields
}
func (*APICallTimer) FinishWithResult ¶
func (act *APICallTimer) FinishWithResult(success bool, errorType string)
type APICallType ¶
type APICallType string
const ( GetCall APICallType = "get" ListCall APICallType = "list" CreateCall APICallType = "create" UpdateCall APICallType = "update" DeleteCall APICallType = "delete" PatchCall APICallType = "patch" )
type BackoffConfig ¶
type BackoffEntry ¶
type BackoffManager ¶
type BackoffManager struct {
// contains filtered or unexported fields
}
func NewBackoffManager ¶
func NewBackoffManager() *BackoffManager
func (*BackoffManager) ClassifyError ¶
func (bm *BackoffManager) ClassifyError(err error) ErrorType
func (*BackoffManager) CleanupStaleEntries ¶
func (bm *BackoffManager) CleanupStaleEntries(ctx context.Context, maxAge time.Duration)
func (*BackoffManager) GetBackoffStats ¶
func (bm *BackoffManager) GetBackoffStats() BackoffStats
func (*BackoffManager) GetNextDelay ¶
func (*BackoffManager) GetRetryCount ¶
func (bm *BackoffManager) GetRetryCount(resourceKey string) int
func (*BackoffManager) RecordSuccess ¶
func (bm *BackoffManager) RecordSuccess(resourceKey string)
func (*BackoffManager) SetConfig ¶
func (bm *BackoffManager) SetConfig(errorType ErrorType, config BackoffConfig)
func (*BackoffManager) ShouldRetry ¶
func (bm *BackoffManager) ShouldRetry(resourceKey string, errorType ErrorType) bool
type BackoffStats ¶
type BackoffStrategy ¶
type BackoffStrategy string
const ( ExponentialBackoff BackoffStrategy = "exponential" LinearBackoff BackoffStrategy = "linear" ConstantBackoff BackoffStrategy = "constant" )
func (BackoffStrategy) String ¶
func (b BackoffStrategy) String() string
type BatchConfig ¶
type BatchConfig struct {
MaxBatchSize int // Maximum number of updates per batch
BatchTimeout time.Duration // Maximum time to wait for a batch
FlushInterval time.Duration // Periodic flush interval
MaxRetries int // Maximum retries per update
RetryDelay time.Duration // Base delay between retries
EnablePriority bool // Whether to prioritize updates
MaxQueueSize int // Maximum queue size before dropping updates
}
type ControllerMetrics ¶
type ControllerMetrics struct {
ReconcileDuration *prometheus.HistogramVec
ReconcileTotal *prometheus.CounterVec
ReconcileErrors *prometheus.CounterVec
ReconcileRequeue *prometheus.CounterVec
BackoffDelay *prometheus.HistogramVec
BackoffRetries *prometheus.HistogramVec
BackoffResets *prometheus.CounterVec
StatusBatchSize *prometheus.HistogramVec
StatusBatchDuration *prometheus.HistogramVec
StatusUpdatesQueued *prometheus.CounterVec
StatusUpdatesDropped *prometheus.CounterVec
StatusUpdatesFailed *prometheus.CounterVec
StatusQueueSize *prometheus.GaugeVec
APICallDuration *prometheus.HistogramVec
APICallTotal *prometheus.CounterVec
APICallErrors *prometheus.CounterVec
ActiveReconcilers *prometheus.GaugeVec
MemoryUsage *prometheus.GaugeVec
GoroutineCount *prometheus.GaugeVec
}
func NewControllerMetrics ¶
func NewControllerMetrics() *ControllerMetrics
func (*ControllerMetrics) NewAPICallTimer ¶
func (cm *ControllerMetrics) NewAPICallTimer(controller, operation, resource string) *APICallTimer
func (*ControllerMetrics) NewReconcileTimer ¶
func (cm *ControllerMetrics) NewReconcileTimer(controller, namespace, name, phase string) *ReconcileTimer
func (*ControllerMetrics) RecordBackoffDelay ¶
func (cm *ControllerMetrics) RecordBackoffDelay(controller string, errorType ErrorType, strategy BackoffStrategy, delay time.Duration)
func (*ControllerMetrics) RecordBackoffReset ¶
func (cm *ControllerMetrics) RecordBackoffReset(controller, resourceType string)
func (*ControllerMetrics) RecordBackoffRetries ¶
func (cm *ControllerMetrics) RecordBackoffRetries(controller string, errorType ErrorType, retries int, success bool)
func (*ControllerMetrics) RecordReconcileError ¶
func (cm *ControllerMetrics) RecordReconcileError(controller string, errorType ErrorType, category string)
func (*ControllerMetrics) RecordReconcileResult ¶
func (cm *ControllerMetrics) RecordReconcileResult(controller, result string)
func (*ControllerMetrics) RecordRequeue ¶
func (cm *ControllerMetrics) RecordRequeue(controller, requeueType string, strategy BackoffStrategy)
func (*ControllerMetrics) RecordStatusBatch ¶
func (*ControllerMetrics) RecordStatusUpdate ¶
func (cm *ControllerMetrics) RecordStatusUpdate(controller, priority, resourceType, outcome string)
func (*ControllerMetrics) UpdateActiveReconcilers ¶
func (cm *ControllerMetrics) UpdateActiveReconcilers(controller string, count int)
func (*ControllerMetrics) UpdateGoroutineCount ¶
func (cm *ControllerMetrics) UpdateGoroutineCount(controller string, count int)
func (*ControllerMetrics) UpdateMemoryUsage ¶
func (cm *ControllerMetrics) UpdateMemoryUsage(controller, memType string, bytes int64)
func (*ControllerMetrics) UpdateStatusQueueSize ¶
func (cm *ControllerMetrics) UpdateStatusQueueSize(controller string, size int)
type E2NodeSetReconcileContext ¶
type E2NodeSetReconcileContext struct {
StartTime time.Time
E2NodeSet *nephoranv1.E2NodeSet
ExistingConfigMaps []*corev1.ConfigMap
ProcessingMetrics map[string]float64
NodesCreated int
NodesUpdated int
NodesDeleted int
ErrorCount int
}
func (*E2NodeSetReconcileContext) Reset ¶
func (ctx *E2NodeSetReconcileContext) Reset()
type ErrorType ¶
type ErrorType string
const ( TransientError ErrorType = "transient" // Network timeouts, temporary unavailability PermanentError ErrorType = "permanent" // Invalid configuration, auth failures ResourceError ErrorType = "resource" // Resource conflicts, quota exceeded ThrottlingError ErrorType = "throttling" // API rate limiting ValidationError ErrorType = "validation" // Schema validation failures )
type OptimizedE2NodeSetReconciler ¶
type OptimizedE2NodeSetReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
// contains filtered or unexported fields
}
func NewOptimizedE2NodeSetReconciler ¶
func NewOptimizedE2NodeSetReconciler( client client.Client, scheme *runtime.Scheme, recorder record.EventRecorder, ) *OptimizedE2NodeSetReconciler
func (*OptimizedE2NodeSetReconciler) SetupWithManager ¶
func (r *OptimizedE2NodeSetReconciler) SetupWithManager(mgr ctrl.Manager) error
func (*OptimizedE2NodeSetReconciler) Shutdown ¶
func (r *OptimizedE2NodeSetReconciler) Shutdown() error
type OptimizedNetworkIntentReconciler ¶
type OptimizedNetworkIntentReconciler struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
// contains filtered or unexported fields
}
func NewOptimizedNetworkIntentReconciler ¶
func NewOptimizedNetworkIntentReconciler( client client.Client, scheme *runtime.Scheme, recorder record.EventRecorder, config controllers.Config, deps controllers.Dependencies, ) *OptimizedNetworkIntentReconciler
func (*OptimizedNetworkIntentReconciler) SetupWithManager ¶
func (r *OptimizedNetworkIntentReconciler) SetupWithManager(mgr ctrl.Manager) error
func (*OptimizedNetworkIntentReconciler) Shutdown ¶
func (r *OptimizedNetworkIntentReconciler) Shutdown() error
type ReconcileContext ¶
type ReconcileContext struct {
StartTime time.Time
NetworkIntent *nephoranv1.NetworkIntent
ProcessingPhase string
ProcessingMetrics map[string]float64
ResourcePlan map[string]interface{}
Manifests map[string]string
ErrorCount int
LastError error
}
func (*ReconcileContext) Reset ¶
func (rc *ReconcileContext) Reset()
type ReconcileTimer ¶
type ReconcileTimer struct {
// contains filtered or unexported fields
}
func (*ReconcileTimer) Finish ¶
func (rt *ReconcileTimer) Finish()
type StatusBatcher ¶
type StatusBatcher struct {
// contains filtered or unexported fields
}
func NewStatusBatcher ¶
func NewStatusBatcher(client client.Client, config BatchConfig) *StatusBatcher
func (*StatusBatcher) Flush ¶
func (sb *StatusBatcher) Flush() error
func (*StatusBatcher) GetStats ¶
func (sb *StatusBatcher) GetStats() StatusBatcherStats
func (*StatusBatcher) QueueE2NodeSetUpdate ¶
func (sb *StatusBatcher) QueueE2NodeSetUpdate(namespacedName types.NamespacedName, readyReplicas, totalReplicas int32, conditions []metav1.Condition, priority UpdatePriority) error
func (*StatusBatcher) QueueNetworkIntentUpdate ¶
func (sb *StatusBatcher) QueueNetworkIntentUpdate(namespacedName types.NamespacedName, conditionUpdates []metav1.Condition, phase string, priority UpdatePriority) error
func (*StatusBatcher) QueueUpdate ¶
func (sb *StatusBatcher) QueueUpdate(namespacedName types.NamespacedName, updateFunc func(obj client.Object) error, priority UpdatePriority) error
func (*StatusBatcher) Stop ¶
func (sb *StatusBatcher) Stop() error
type StatusBatcherStats ¶
type StatusBatcherStats struct {
QueueSize int `json:"queue_size"`
BatchesProcessed int64 `json:"batches_processed"`
UpdatesProcessed int64 `json:"updates_processed"`
UpdatesDropped int64 `json:"updates_dropped"`
UpdatesFailed int64 `json:"updates_failed"`
AverageBatchSize float64 `json:"average_batch_size"`
}
type StatusUpdate ¶
type StatusUpdate struct {
NamespacedName types.NamespacedName
UpdateFunc func(obj client.Object) error
Priority UpdatePriority
Timestamp time.Time
RetryCount int
}
type UpdatePriority ¶
type UpdatePriority int
const ( LowPriority UpdatePriority = iota MediumPriority HighPriority CriticalPriority )
func (UpdatePriority) String ¶
func (p UpdatePriority) String() string
Click to show internal directories.
Click to hide internal directories.