facade

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

nolint:dupl

nolint:dupl

Index

Constants

View Source
const InvalidAdmissionReviewMsg = "invalid k8s admission review"

Variables

This section is empty.

Functions

This section is empty.

Types

type AdmissionRequest

type AdmissionRequest interface {
	// Kind returns the metav1.GroupVersionKind of the request object
	Kind() metav1.GroupVersionKind
	// Object returns the runtime.RawExtension representing the request object
	Object() *runtime.RawExtension
	// OldObject returns the runtime.RawExtension representing the request old object
	OldObject() *runtime.RawExtension
	// ResourceKind returns the metav1.GroupVersionResource for the request object
	ResourceKind() metav1.GroupVersionResource
	// ResourceId returns the namespaced name of the requested resource
	ResourceID() types.NamespacedName
	// Namespace returns the name of the namespace which is source to this request
	Namespace() string
}

AdmissionRequest facades the AdmissionReview request

type AdmissionResponse

type AdmissionResponse interface {
	// Allow allows the review
	Allow()
	// Deny denies the review using the provided status
	Deny(status *metav1.Status)
	// PatchJSON will apply a json patch to the response
	PatchJSON(bytes []byte)
	// ResponseType returns the ResponseType for statistics
	ResponseType() ResponseType
	// IsSet returns true if the response is set
	IsSet() bool
}

AdmissionResponse facades the AdmissionReview response

type AdmissionReview

type AdmissionReview interface {
	// ClearRequest clears the request
	ClearRequest()
	// Request returns the request
	Request() AdmissionRequest
	// Response returns the response
	Response() AdmissionResponse
	// Version returns the version string of the admission review itself
	Version() string
	// Marshal marshals the object again
	Marshal() ([]byte, error)
}

AdmissionReview is a facade for the admission review (to deal with the type-safety of different versions)

func AdmissionReviewFrom

func AdmissionReviewFrom(bytes []byte) (AdmissionReview, error)

AdmissionReviewFrom tries to unmarshal an admission review form the provided bytes and create a decorator for it

func V1

V1 creates an admission review for v1

func V1AdmissionReviewFromBytes added in v1.2.2

func V1AdmissionReviewFromBytes(bytes []byte) (AdmissionReview, error)

func V1Beta1

func V1Beta1(target *v1beta1.AdmissionReview) AdmissionReview

V1Beta1 creates an admission review for v1beta1

func V1beta1AdmissionReviewFromBytes added in v1.2.2

func V1beta1AdmissionReviewFromBytes(bytes []byte) (AdmissionReview, error)

type ResponseType

type ResponseType string
const (
	// AdmissionAllowed denotes an allowed admission
	AdmissionAllowed ResponseType = "allowed"
	// AdmissionDenied denotes a denied admission
	AdmissionDenied ResponseType = "denied"
	// AdmissionMutated denotes a mutated admission
	AdmissionMutated ResponseType = "mutated"
	// AdmissionError denotes an erroneous
	AdmissionError ResponseType = "error"
	// AdmissionClientError denotes an error in the request
	AdmissionClientError ResponseType = "client_error"
)

Jump to

Keyboard shortcuts

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