package source

import "k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/source"

Package source provides a Source implementation that loads webhook configurations from manifest files.

Index

Functions

func SetReloadIntervalForTests

func SetReloadIntervalForTests(interval time.Duration) func()

SetReloadIntervalForTests sets the reload interval for testing and returns a function to restore the original value.

Types

type MutatingSource

type MutatingSource struct {
	// contains filtered or unexported fields
}

MutatingSource provides mutating webhook configurations loaded from manifest files.

func NewMutatingSource

func NewMutatingSource(manifestsDir, apiServerID string, loadFunc MutatingWebhookLoadFunc) *MutatingSource

NewMutatingSource creates a new mutating webhook source that loads configurations from the specified directory.

func (MutatingSource) HasSynced

func (s MutatingSource) HasSynced() bool

HasSynced returns true if the initial load has completed.

func (MutatingSource) LoadInitial

func (s MutatingSource) LoadInitial() error

LoadInitial performs the initial load of webhook manifests.

func (MutatingSource) RunReloadLoop

func (s MutatingSource) RunReloadLoop(ctx context.Context)

RunReloadLoop watches for configuration changes and reloads when detected. It blocks until ctx is canceled.

func (MutatingSource) Webhooks

func (s MutatingSource) Webhooks() []webhook.WebhookAccessor

Webhooks returns the list of webhook accessors.

type MutatingWebhookLoadFunc

type MutatingWebhookLoadFunc func(dir string) ([]*admissionregistrationv1.MutatingWebhookConfiguration, string, error)

MutatingWebhookLoadFunc loads mutating webhook configurations from a directory. Returns the configurations, a hash string for change detection, and any error.

type ValidatingSource

type ValidatingSource struct {
	// contains filtered or unexported fields
}

ValidatingSource provides validating webhook configurations loaded from manifest files.

func NewValidatingSource

func NewValidatingSource(manifestsDir, apiServerID string, loadFunc ValidatingWebhookLoadFunc) *ValidatingSource

NewValidatingSource creates a new validating webhook source that loads configurations from the specified directory.

func (ValidatingSource) HasSynced

func (s ValidatingSource) HasSynced() bool

HasSynced returns true if the initial load has completed.

func (ValidatingSource) LoadInitial

func (s ValidatingSource) LoadInitial() error

LoadInitial performs the initial load of webhook manifests.

func (ValidatingSource) RunReloadLoop

func (s ValidatingSource) RunReloadLoop(ctx context.Context)

RunReloadLoop watches for configuration changes and reloads when detected. It blocks until ctx is canceled.

func (ValidatingSource) Webhooks

func (s ValidatingSource) Webhooks() []webhook.WebhookAccessor

Webhooks returns the list of webhook accessors.

type ValidatingWebhookLoadFunc

type ValidatingWebhookLoadFunc func(dir string) ([]*admissionregistrationv1.ValidatingWebhookConfiguration, string, error)

ValidatingWebhookLoadFunc loads validating webhook configurations from a directory. Returns the configurations, a hash string for change detection, and any error.

Source Files

source.go

Version
v0.36.0 (latest)
Published
Apr 22, 2026
Platform
linux/amd64
Imports
12 packages
Last checked
4 days ago

Tools for package owners.