Documentation
¶
Overview ¶
Package admission keeps pods in package namespaces on the images their packages pin: a tag a package pins becomes that tag at its digest, and in enforce mode an image no installed package vouches for is refused.
Index ¶
Constants ¶
const ( ModeOff = "off" ModeWarn = "warn" ModeEnforce = "enforce" )
Modes of the image policy.
const LabelImagePolicy = "kubepkg.dev/image-policy"
LabelImagePolicy on a namespace turns the image policy on there; the value is warn or enforce. The operator sets it on package namespaces.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Certs ¶
type Certs struct {
Client client.Client
// Namespace and Service name the webhook Service; Secret holds the
// certificates; Dir is the webhook server's certificate directory;
// Webhook names the MutatingWebhookConfiguration.
Namespace, Service, Secret, Dir, Webhook string
// Now is the clock; time.Now when nil.
Now func() time.Time
}
Certs keeps the webhook's serving certificate: a CA and a certificate for the webhook Service, in a Secret all replicas share, written to the directory the webhook server reads and given to the webhook configuration as its CA bundle. kubepkg issues them itself, so it does not depend on a certificate manager it might be the one installing.
func (*Certs) Ensure ¶
Ensure makes sure a valid certificate exists, is written to Dir and is trusted by the webhook configuration.
func (*Certs) NeedLeaderElection ¶
NeedLeaderElection is false: every replica serves the webhook.
type Handler ¶
type Handler struct {
// Reader reads PackageSources and Namespaces, from the cache.
Reader client.Reader
Decoder admission.Decoder
// Recorder, when set, gets an Event on the pod's owner for every
// image no package pins. Admission warnings go back to whoever made
// the pod, usually a controller, so without Events nobody sees them.
Recorder events.EventRecorder
}
Handler is the pod admission webhook.