webhook

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// InitContainers - inject one or more initContainers into the pod spec.
	InitContainers []corev1.Container

	// Containers - inject one or more containers into the pod spec.
	Containers []corev1.Container

	// ExistingContainerConfig - configuration for injecting into the pre-existing containers.
	ExistingContainerConfig
}

Config is the struct used to parse injection config items for Simple Sidecar. The InitContainers, Containers, Volumes, and EnvVars fields are arrays of Kubernetes objects that will be added to the pod spec.

type ExistingContainerConfig

type ExistingContainerConfig struct {
	// Volumes - inject one or more volumes into pre-existing pod specs.
	Volumes []corev1.Volume

	// EnvVars - inject one or more environment variables into pre-existing pod specs.
	EnvVars []corev1.EnvVar

	// VolumeMounts - inject one or more volume mounts into pre-existing pod specs.
	// BEFORE sidecar injection.
	VolumeMounts []corev1.VolumeMount
}

ExistingContainerConfig provides configuration for injecting into the pre-existing containers. This is useful for utilizing the functionality of injected containers

type MultiConfig

type MultiConfig map[string]Config

MultiConfig is a map of Config objects. This allows for multiple named configurations to be loaded from a single configuration file. The name of the configuration is the key, it is used to determine which configuration to use when injecting sidecars.

func LoadConfig

func LoadConfig(configFile string) (cfg MultiConfig, err error)

LoadConfig loads the configuration from the specified file and returns a MultiConfig object.

type WebhookServer

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

WebhookServer contains the configuration for the webhook server. It's used as a receiver for various methods such as Start and Stop.

func NewWebhookServer

func NewWebhookServer(cfg *WebhookServerConfig) *WebhookServer

NewWebhookServer creates a new WebhookServer object with the specified configuration.

func (*WebhookServer) Serve

func (whs *WebhookServer) Serve(w http.ResponseWriter, r *http.Request)

Serve method for webhook server

func (*WebhookServer) Start

func (whs *WebhookServer) Start() error

Start method for webhook server. It blocks until the server is stopped.

func (*WebhookServer) Stop

func (whs *WebhookServer) Stop()

Stop method for webhook server. It stops the server gracefully.

type WebhookServerConfig

type WebhookServerConfig struct {
	Port           int
	CertPEM        string
	KeyPEM         string
	SidecarConfigs MultiConfig
	InfoLogger     *log.Logger
	ErrorLogger    *log.Logger
	WarnLogger     *log.Logger
}

WebhookServerConfig is the configuration for the webhook server. It contains the port to listen on, the path to the certificate and key files, the MultiConfig object containing the sidecar configurations, and the loggers for info, warning, and error messages.

Jump to

Keyboard shortcuts

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