logic

package
v0.0.0-...-57c9ba2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package logic features the main business logic: it forwards a containerd request to a Kubernetes admission controller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvalLogic

type EvalLogic[IN, OUT any] struct {
	// Upstream should send the gRPC method to real upstream (containerd)
	Upstream func(ctx context.Context, in IN, opts ...grpc.CallOption) (OUT, error)
	// TransformInput should transform the incoming containerd gRPC request into what Kubernetes
	// expects.
	TransformInput func(s common.ProxyServer, in IN) (any, error)
	PatchInput     func(s common.ProxyServer, in IN, modifiedObjectBytes []byte) error
	ProxyServer    common.ProxyServer
}

EvalLogic is the type that encapsulates dependencies needed to delegate the authorization decision to k8s admission controllers

func (EvalLogic[IN, OUT]) CallAdmissionControllers

func (s EvalLogic[IN, OUT]) CallAdmissionControllers(ctx context.Context, in IN) (OUT, error)

CallAdmissionControllers is the main logic that takes a gRPC *Request message, repackages it into a K8s AdmissionReview request, forwards it to the configured validating/mutating webhooks. If the decision allows it, it is forwarded to the upstream containerd server and the *Response gRPC response is returned.

type Evaluator

type Evaluator[IN, OUT any] interface {
	CallAdmissionControllers(context.Context, IN) (OUT, error)
}

Evaluator is an interface to facilitate unit testing of gRPC services implemented in ctrdac

Jump to

Keyboard shortcuts

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