webhook

package
v1.21.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VaultEnvVolumeName = "vault-env"
)

Variables

This section is empty.

Functions

func ErrorLoggerMutator

func ErrorLoggerMutator(mutator mutating.MutatorFunc, logger log.Logger) mutating.MutatorFunc

func IsAllowedToCache

func IsAllowedToCache(container *corev1.Container) bool

IsAllowedToCache checks that information about Docker image can be cached base on image name and container PullPolicy

func NewWhLogger added in v1.21.0

func NewWhLogger(l *slog.Logger) log.Logger

NewWhLogger returns a new log.Logger for a slog implementation.

func SetConfigDefaults

func SetConfigDefaults()

Types

type ImageRegistry

type ImageRegistry interface {
	GetImageConfig(
		ctx context.Context,
		clientset kubernetes.Interface,
		namespace string,
		isDisabled bool,
		container *corev1.Container,
		podSpec *corev1.PodSpec) (*v1.Config, error)
}

ImageRegistry is a docker registry

func NewRegistry

func NewRegistry() ImageRegistry

NewRegistry creates and initializes registry

type MutatingWebhook

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

func NewMutatingWebhook

func NewMutatingWebhook(logger *slog.Logger, k8sClient kubernetes.Interface) (*MutatingWebhook, error)

func (*MutatingWebhook) MutateConfigMap

func (mw *MutatingWebhook) MutateConfigMap(configMap *corev1.ConfigMap, vaultConfig VaultConfig) error

func (*MutatingWebhook) MutateObject

func (mw *MutatingWebhook) MutateObject(object *unstructured.Unstructured, vaultConfig VaultConfig) error

func (*MutatingWebhook) MutatePod

func (mw *MutatingWebhook) MutatePod(ctx context.Context, pod *corev1.Pod, vaultConfig VaultConfig, dryRun bool) error

func (*MutatingWebhook) MutateSecret

func (mw *MutatingWebhook) MutateSecret(secret *corev1.Secret, vaultConfig VaultConfig) error

func (*MutatingWebhook) ServeMetrics

func (mw *MutatingWebhook) ServeMetrics(addr string, handler http.Handler)

func (*MutatingWebhook) VaultSecretsMutator

func (mw *MutatingWebhook) VaultSecretsMutator(ctx context.Context, ar *model.AdmissionReview, obj metav1.Object) (*mutating.MutatorResult, error)

type Registry

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

Registry impl

func (*Registry) GetImageConfig

func (r *Registry) GetImageConfig(
	ctx context.Context,
	client kubernetes.Interface,
	namespace string,
	isDisabled bool,
	container *corev1.Container,
	podSpec *corev1.PodSpec) (*v1.Config, error)

GetImageConfig returns entrypoint and command of container

type VaultConfig

type VaultConfig struct {
	Addr                          string
	AuthMethod                    string
	Role                          string
	Path                          string
	SkipVerify                    bool
	TLSSecret                     string
	ClientTimeout                 time.Duration
	UseAgent                      bool
	VaultEnvDaemon                bool
	VaultEnvDelay                 time.Duration
	TransitKeyID                  string
	TransitPath                   string
	TransitBatchSize              int
	CtConfigMap                   string
	CtImage                       string
	CtInjectInInitcontainers      bool
	CtOnce                        bool
	CtImagePullPolicy             corev1.PullPolicy
	CtShareProcess                bool
	CtShareProcessDefault         string
	CtCPU                         resource.Quantity
	CtMemory                      resource.Quantity
	PspAllowPrivilegeEscalation   bool
	RunAsNonRoot                  bool
	RunAsUser                     int64
	RunAsGroup                    int64
	ReadOnlyRootFilesystem        bool
	RegistrySkipVerify            bool
	IgnoreMissingSecrets          string
	VaultEnvPassThrough           string
	ConfigfilePath                string
	EnableJSONLog                 string
	LogLevel                      string
	AgentConfigMap                string
	AgentOnce                     bool
	AgentShareProcess             bool
	AgentShareProcessDefault      string
	AgentCPULimit                 resource.Quantity
	AgentMemoryLimit              resource.Quantity
	AgentCPURequest               resource.Quantity
	AgentMemoryRequest            resource.Quantity
	AgentImage                    string
	AgentImagePullPolicy          corev1.PullPolicy
	AgentEnvVariables             string
	ServiceAccountTokenVolumeName string
	EnvImage                      string
	EnvImagePullPolicy            corev1.PullPolicy
	EnvLogServer                  string
	Skip                          bool
	VaultEnvFromPath              string
	TokenAuthMount                string
	EnvCPURequest                 resource.Quantity
	EnvMemoryRequest              resource.Quantity
	EnvCPULimit                   resource.Quantity
	EnvMemoryLimit                resource.Quantity
	VaultNamespace                string
	VaultServiceAccount           string
	ObjectNamespace               string
	MutateProbes                  bool
	Token                         string
}

VaultConfig represents vault options

Jump to

Keyboard shortcuts

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