webhook

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

func InitializeServiceAcctMonitor

func InitializeServiceAcctMonitor() error

InitializeServiceAcctMonitor with Kubernetes configuration

Types

type Mutator

type Mutator struct {
	SideCars                map[string]*SideCar
	ShawarmaImage           string
	ShawarmaServiceAcctName string
	ShawarmaSecretTokenName string
	ServiceAcctMonitors     *ServiceAcctMonitorSet
}

Mutator is the interface for mutating webhook

func (Mutator) Mutate

func (mutator Mutator) Mutate(req []byte) ([]byte, error)

Mutate function performs the actual mutation of pod spec

func (Mutator) Shutdown

func (mutator Mutator) Shutdown()

Shutdown the mutator

type ServiceAcctMonitor

type ServiceAcctMonitor struct {
	Namespace          string
	ServiceAccountName string
	SecretName         string
	// contains filtered or unexported fields
}

ServiceAcctMonitor observes a service account and keeps SecretName up to date

func NewServiceAcctMonitor

func NewServiceAcctMonitor(namespace string, serviceAccountName string) (*ServiceAcctMonitor, error)

NewServiceAcctMonitor Create a new service account monitor

func (*ServiceAcctMonitor) Start

func (monitor *ServiceAcctMonitor) Start() error

Start the service account monitor

func (*ServiceAcctMonitor) Stop

func (monitor *ServiceAcctMonitor) Stop()

Stop the monitor

func (*ServiceAcctMonitor) WaitForFirstUpdate

func (monitor *ServiceAcctMonitor) WaitForFirstUpdate(timeout time.Duration) bool

WaitForFirstUpdate returns true if the first update was received, false if timed out

type ServiceAcctMonitorSet

type ServiceAcctMonitorSet struct {
	Monitors []*ServiceAcctMonitor
	// contains filtered or unexported fields
}

ServiceAcctMonitorSet contains a set of ServiceAcctMonitor

func (*ServiceAcctMonitorSet) Get

func (set *ServiceAcctMonitorSet) Get(namespace string, serviceAccountName string, timeout time.Duration) (*ServiceAcctMonitor, error)

Get a service account monitor, or create if missing

func (*ServiceAcctMonitorSet) StopAll

func (set *ServiceAcctMonitorSet) StopAll()

StopAll service account monitors

type SideCar

type SideCar struct {
	Containers       []corev1.Container            `yaml:"containers"`
	Volumes          []corev1.Volume               `yaml:"volumes"`
	ImagePullSecrets []corev1.LocalObjectReference `yaml:"imagePullSecrets"`
}

SideCar is the template of the sidecar to be implemented

Jump to

Keyboard shortcuts

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