admission

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACPHandler

type ACPHandler struct {
	// contains filtered or unexported fields
}

ACPHandler is an HTTP handler that can be used as a Kubernetes Mutating Admission Controller.

func NewACPHandler

func NewACPHandler(backend Backend) *ACPHandler

NewACPHandler returns a new Handler.

func (ACPHandler) ServeHTTP

func (h ACPHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler.

type Backend

type Backend interface {
	CreateACP(ctx context.Context, policy *hubv1alpha1.AccessControlPolicy) (*acp.ACP, error)
	UpdateACP(ctx context.Context, oldVersion string, policy *hubv1alpha1.AccessControlPolicy) (*acp.ACP, error)
	DeleteACP(ctx context.Context, oldVersion, name string) error
}

Backend manages ACPs.

type EventHandler

type EventHandler struct {
	// contains filtered or unexported fields
}

EventHandler watches ACP resources and calls its set Updatable when they are modified.

func NewEventHandler

func NewEventHandler(listener Updatable) *EventHandler

NewEventHandler returns a new event handler meant to listen for ACP changes. It calls the given Updatable when an ACP is modified.

func (*EventHandler) OnAdd

func (w *EventHandler) OnAdd(obj interface{})

OnAdd implements Kubernetes cache.ResourceEventHandler so it can be used as an informer event handler.

func (*EventHandler) OnDelete

func (w *EventHandler) OnDelete(obj interface{})

OnDelete implements Kubernetes cache.ResourceEventHandler so it can be used as an informer event handler.

func (*EventHandler) OnUpdate

func (w *EventHandler) OnUpdate(oldObj, newObj interface{})

OnUpdate implements Kubernetes cache.ResourceEventHandler so it can be used as an informer event handler.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is an HTTP handler that can be used as a Kubernetes Mutating Admission Controller.

func NewHandler

func NewHandler(reviewers []Reviewer, defaultReviewer Reviewer) *Handler

NewHandler returns a new Handler that reviews incoming requests using the given reviewers.

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler.

type IngressUpdater

type IngressUpdater struct {
	// contains filtered or unexported fields
}

IngressUpdater handles ingress updates when ACP configurations are modified.

func NewIngressUpdater

func NewIngressUpdater(informer informers.SharedInformerFactory, clientSet clientset.Interface, kubeVersion string) *IngressUpdater

NewIngressUpdater return a new IngressUpdater.

func (*IngressUpdater) Run

func (u *IngressUpdater) Run(ctx context.Context)

Run runs the IngressUpdater control loop, updating ingress resources when needed.

func (*IngressUpdater) Update

func (u *IngressUpdater) Update(polName string)

Update notifies the IngressUpdater control loop that it should update ingresses referencing the given ACP if they had a header-related configuration change.

type Reviewer

type Reviewer interface {
	CanReview(ar admv1.AdmissionReview) (bool, error)
	Review(ctx context.Context, ar admv1.AdmissionReview) (map[string]interface{}, error)
}

Reviewer allows to review an admission review request.

type Updatable

type Updatable interface {
	Update(polName string)
}

Updatable represents a object that is updatable.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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