admission

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdmissionRequest

func AdmissionRequest(ctx context.Context) admission.Request

AdmissionRequest returns admission request from context

func DefaultingWebhookFor

func DefaultingWebhookFor(ctx context.Context, defaulter Defaulter, transforms ...TransformFunc) *admission.Webhook

DefaultingWebhookFor creates a new Webhook for Defaulting the provided type.

func RegisterDefaultWebhookFor

func RegisterDefaultWebhookFor(ctx context.Context, mgr ctrl.Manager, defaulter Defaulter, transforms ...TransformFunc) (err error)

RegisterDefaultWebhookFor registers a mutate webhook for the defaulter with transforms

func SubjectFromRequest

func SubjectFromRequest(req admission.Request) *rbacv1.Subject

returns a user based on the request information

func WithAdmissionRequest

func WithAdmissionRequest(ctx context.Context, req admission.Request) context.Context

WithAdmissionRequest adds an admission request to the context

Types

type Defaulter

type Defaulter interface {
	runtime.Object
	metav1.Object
	Default(context.Context)
}

Defaulter defines functions for setting defaults on resources

type DefaulterWebhook added in v0.2.0

type DefaulterWebhook interface {
	Defaulter
	sharedmain.WebhookSetup
	sharedmain.WebhookRegisterSetup
	WithTransformer(transformers ...TransformFunc) DefaulterWebhook
}

func NewDefaulterWebhook added in v0.2.0

func NewDefaulterWebhook(defaulter Defaulter) DefaulterWebhook

type TransformFunc

type TransformFunc func(context.Context, runtime.Object, admission.Request)

TransformFuncused to make common defaulting logic amongst multiple resource using a context, an object and a request

func WithCreatedBy added in v0.2.0

func WithCreatedBy() TransformFunc

WithCreatedBy adds a createdBy annotation to the object using the request information when an object already has the createdBy annotation it will only increment missing data

func WithTriggeredBy

func WithTriggeredBy() TransformFunc

WithTriggeredBy adds a triggeredBy annotation to the object using the request information when an object already has the triggeredBy annotation it will only increment missing data

Jump to

Keyboard shortcuts

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