Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var New = component.Declare( func(_ Args) string { return "webhook-handler" }, func(_ Args, fs *flag.FlagSet) Options { return Options{ ColdStartDelay: fs.Duration( "cold-start-delay", 0, "delay period before the first update of an inactive PodProtector", ), RetryBackoffBase: fs.Duration( "retry-backoff-base", time.Millisecond*100, "base retry period after a PodProtector update fails due to conflict", ), RetryJitter: fs.Duration( "retry-jitter", time.Millisecond*100, "the actual retry backoff is uniformly distributed between [base, base+jitter)", ), } }, func(args Args, requests *component.DepRequests) Deps { return Deps{ getSourceProvider: args.SourceProvider(requests), pprInformer: component.DepPtr( requests, pprutil.NewIndexedInformer(pprutil.IndexedInformerArgs{ Suffix: "", SourceProvider: args.SourceProvider, Elector: optional.None[kube.ElectorArgs](), }), ), observer: o11y.Request[observer.Observer](requests), retrybatchObs: o11y.Request[retrybatchobserver.Observer](requests), defaultConfig: component.DepPtr(requests, defaultconfig.New(util.Empty{})), } }, func(_ context.Context, _ Args, options Options, deps Deps) (*State, error) { sourceProvider := deps.getSourceProvider() poolReader, poolWriter := util.NewLateInit[retrybatch.Pool[pprutil.PodProtectorKey, BatchArg, pprutil.DisruptionResult]]() return &State{ sourceProvider: sourceProvider, informerHasSynced: deps.pprInformer.Get().HasSynced, poolConfig: retrybatch.NewPool( deps.retrybatchObs.Get(), PoolAdapter{ sourceProvider: sourceProvider, pprInformer: deps.pprInformer.Get(), observer: deps.observer.Get(), clock: clock.RealClock{}, retryBackoff: func() time.Duration { return jitterDuration( *options.RetryBackoffBase, *options.RetryBackoffBase+*options.RetryJitter, ) }, defaultConfig: deps.defaultConfig.Get(), }, *options.ColdStartDelay, batchGoroutineIdleTimeout, ), poolWriter: poolWriter, poolReader: poolReader, }, nil }, component.Lifecycle[Args, Options, Deps, State]{ Start: func(ctx context.Context, _ *Args, _ *Options, _ *Deps, state *State) error { pool := state.poolConfig.Create(ctx) pool.StartMonitor(ctx) state.poolWriter(pool) return nil }, Join: nil, HealthChecks: nil, }, func(d *component.Data[Args, Options, Deps, State]) Api { return Api{ state: d.State, observer: d.Deps.observer.Get(), pprInformer: d.Deps.pprInformer.Get(), } }, )
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
func (Api) Handle ¶
func (api Api) Handle( ctx context.Context, req *admissionv1.AdmissionRequest, cellId string, auditAnnotations map[string]string, ) HandleResult
type Args ¶
type Args struct {
SourceProvider pprutil.SourceProviderRequest
}
type HandleResult ¶
type PoolAdapter ¶
type PoolAdapter struct {
// contains filtered or unexported fields
}
func (PoolAdapter) Execute ¶
func (adapter PoolAdapter) Execute( ctx context.Context, key pprutil.PodProtectorKey, args []BatchArg, ) retrybatch.ExecuteResult[pprutil.DisruptionResult]
func (PoolAdapter) PoolName ¶
func (PoolAdapter) PoolName() string
Click to show internal directories.
Click to hide internal directories.