webhook

package
v0.1.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 27 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package webhook holds the operator's admission webhooks. The validating webhook checks what the CRD schemas can't (0004 §3.1, level 2): rule sets must compile the way the engine loads them, and policy paths must be ones the engine's router can match.

Index

Constants

View Source
const InjectPath = "/mutate-v1-pod"

InjectPath is the Pod webhook's path.

View Source
const MutatingConfigName = "inkwall-operator-mutating"

MutatingConfigName is the MutatingWebhookConfiguration of the Pod webhook; the certificate rotator injects its CA bundle.

View Source
const PodWebhookName = "pods.waf.inkwall.dev"

PodWebhookName is the Pod webhook in MutatingConfigName.

View Source
const ValidatingConfigName = "inkwall-operator-validating"

ValidatingConfigName is the ValidatingWebhookConfiguration the webhooks below are registered in; the certificate rotator injects its CA bundle.

Variables

This section is empty.

Functions

func AddCertRotator

func AddCertRotator(mgr manager.Manager, o CertOptions, ready chan struct{}) error

AddCertRotator keeps a self-signed CA and serving certificate in the Secret, writes the certificate to CertDir and injects the CA into the validating webhook configuration, renewing them before they expire. ready is closed once the certificate files are in place and the CA is injected. It runs on every replica, so each one can serve; the replicas share the Secret. The Secret must exist (EnsureCertSecret).

func EnsureCertSecret

func EnsureCertSecret(ctx context.Context, c client.Client, key types.NamespacedName) error

EnsureCertSecret creates the empty certificate Secret if it doesn't exist; the rotator only fills an existing one. It runs before the manager starts, so it uses a direct client.

func ServiceDNSNames

func ServiceDNSNames(service, namespace string) []string

ServiceDNSNames returns the names of a Service, for CertOptions.DNSNames.

func Setup

func Setup(mgr manager.Manager, inject *PodInjector) error

Setup registers the validating webhooks with mgr's webhook server, and the Pod webhook when inject is set.

Types

type CertOptions

type CertOptions struct {
	// Secret holds the CA and the serving certificate, shared by every
	// replica.
	Secret types.NamespacedName
	// CertDir is where the certificate files are written for the webhook
	// server.
	CertDir string
	// DNSNames are the names the certificate is valid for: the webhook
	// Service's, and the distribution Service's.
	DNSNames []string
	// InjectWebhooks injects the CA into the validating webhook
	// configuration; off when the webhook is disabled.
	InjectWebhooks bool
	// InjectPodWebhook also injects it into the mutating configuration of
	// the Pod webhook.
	InjectPodWebhook bool
}

CertOptions configures the webhook's serving certificate.

type PodInjector

type PodInjector struct {
	// Client reads the InkwallConfig.
	Client client.Reader
	// Decoder decodes pods.
	Decoder admission.Decoder
	// Image and PullPolicy are the engine's, unless InkwallConfig sets one.
	Image      string
	PullPolicy corev1.PullPolicy
	// OperatorAddr is the distribution server engines connect to.
	OperatorAddr string
	// Integrations recognise proxy pods; nil: the defaults.
	Integrations *integrations.Selectors
	// BundleSecret is the bundle Secret, namespace/name, engines read when
	// the operator is unreachable.
	BundleSecret string
}

PodInjector adds the engine to proxy pods.

func (*PodInjector) Handle

Handle injects the engine into a pod of a known proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL