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
- func AddCertRotator(mgr manager.Manager, o CertOptions, ready chan struct{}) error
- func EnsureCertSecret(ctx context.Context, c client.Client, key types.NamespacedName) error
- func ServiceDNSNames(service, namespace string) []string
- func Setup(mgr manager.Manager, inject *PodInjector) error
- type CertOptions
- type PodInjector
Constants ¶
const InjectPath = "/mutate-v1-pod"
InjectPath is the Pod webhook's path.
const MutatingConfigName = "inkwall-operator-mutating"
MutatingConfigName is the MutatingWebhookConfiguration of the Pod webhook; the certificate rotator injects its CA bundle.
const PodWebhookName = "pods.waf.inkwall.dev"
PodWebhookName is the Pod webhook in MutatingConfigName.
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 ¶
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 ¶
ServiceDNSNames returns the names of a Service, for CertOptions.DNSNames.
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.