common

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: 5 Imported by: 1

Documentation

Overview

Package common contains a bunch of helper functions, interfaces and methods for the ctrdac application.

Index

Constants

This section is empty.

Variables

View Source
var (
	// RequestContext is the key in the context that exposes the original http.Request
	RequestContext = &ContextKey{Name: "req"}
)

Functions

func ContextDialer

func ContextDialer(u Upstream) func(ctx context.Context, addr string) (net.Conn, error)

ContextDialer returns a dialer suitable to use for http.DialTLS

func TLSContextDialer

func TLSContextDialer(u Upstream) func(ctx context.Context, netw, addr string, cfg *tls.Config) (net.Conn, error)

TLSContextDialer returns a dialer suitable to use for http.DialTLSContext

func TLSDialer

func TLSDialer(u Upstream) func(netw, addr string, cfg *tls.Config) (net.Conn, error)

TLSDialer returns a dialer suitable to use for http.DialTLS

Types

type ContextKey

type ContextKey struct {
	Name string
}

ContextKey is the root type of info we attach to the context

type Listener

type Listener interface {
	// GetListener returns the low level golang net.Listener for this path listener.
	GetListener() net.Listener

	// ConfigureHooks configured a http.Server so that information about the peers
	// is populated into the context.
	ConfigureHooks(server *http.Server) error

	// PopulateUserInfo sets the listener specific attributes on AuthzRequest, e.g.
	// the client certificates in the case of mTLS or the remote uid in the case of UDS
	PopulateUserInfo(ctx context.Context, ar *k8sac.AdmissionRequest) error
}

Listener is the common interface of the mTLS and the UDS listeners.

type ProxyServer

type ProxyServer interface {
	PopulateUserInfo(ctx context.Context, authzReq *k8sac.AdmissionRequest) error
	GetConfig() ProxyServerConfig
}

ProxyServer is an interface to the ctrdac proxy server; it is passed across the subpackages that need to interact with/fetch info from the proxy server.

type ProxyServerConfig

type ProxyServerConfig struct {
	ProxyListenerSocket      string
	ProxyListenerParams      string
	UpstreamContainerdSocket string
	DockerSocket             string
	ValidatingWebhooks       []string
	MutatingWebhooks         []string
	NoK8sConversion          bool
}

ProxyServerConfig holds the supported configuration options of the ctrdac proxy server

type RequestWrapper

type RequestWrapper struct {
	Request *http.Request
}

RequestWrapper is a wrapper struct that exposes the underlying http.Request in gRPC context

type Upstream

type Upstream interface {
	Dial() (net.Conn, error)
}

Upstream is an interface for ctrdac to access the containerd listener. Currently only UDS is implemented.

Jump to

Keyboard shortcuts

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