webhook

package
v1.5.13 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrImageAlreadyPresent = errors.New("image already present in target registry")

Functions

func NewImageSwapper

func NewImageSwapper(registryClient registry.Client, imagePullSecretProvider secrets.ImagePullSecretsProvider, filters []config.JMESPathFilter, imageSwapPolicy types.ImageSwapPolicy, imageCopyPolicy types.ImageCopyPolicy, imageCopyDeadline time.Duration) kwhmutating.Mutator

NewImageSwapper returns a new ImageSwapper initialized.

func NewImageSwapperWebhook

func NewImageSwapperWebhook(registryClient registry.Client, imagePullSecretProvider secrets.ImagePullSecretsProvider, filters []config.JMESPathFilter, imageSwapPolicy types.ImageSwapPolicy, imageCopyPolicy types.ImageCopyPolicy, imageCopyDeadline time.Duration) (webhook.Webhook, error)

func NewImageSwapperWebhookWithOpts added in v1.1.0

func NewImageSwapperWebhookWithOpts(registryClient registry.Client, opts ...Option) (webhook.Webhook, error)

func NewImageSwapperWithOpts added in v1.1.0

func NewImageSwapperWithOpts(registryClient registry.Client, opts ...Option) kwhmutating.Mutator

NewImageSwapperWithOpts returns a configured ImageSwapper instance

Types

type FilterContext

type FilterContext struct {
	// Obj contains the object submitted to the webhook (currently only pods)
	Obj metav1.Object `json:"obj,omitempty"`

	// Container contains the currently processed container
	Container corev1.Container `json:"container,omitempty"`
}

FilterContext is being used by JMESPath to search and match

func NewFilterContext

func NewFilterContext(request kwhmodel.AdmissionReview, obj metav1.Object, container corev1.Container) FilterContext

type ImageCopier added in v1.4.1

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

struct representing a job of copying an image with its subcontext

type ImageSwapper

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

ImageSwapper is a mutator that will download images and change the image name.

func (*ImageSwapper) Mutate

Mutate replaces the image ref. Satisfies mutating.Mutator interface.

type Option added in v1.1.0

type Option func(*ImageSwapper)

Option represents an option that can be passed when instantiating the image swapper to customize it

func Copier added in v1.1.0

func Copier(pool *pond.WorkerPool) Option

Copier allows to pass the copier option

func Filters added in v1.1.0

func Filters(filters []config.JMESPathFilter) Option

Filters allows to pass JMESPathFilter to select the images to be swapped

func ImageCopyDeadline added in v1.4.1

func ImageCopyDeadline(deadline time.Duration) Option

ImageCopyDeadline allows to pass the ImageCopyPolicy option

func ImageCopyPolicy added in v1.1.0

func ImageCopyPolicy(policy types.ImageCopyPolicy) Option

ImageCopyPolicy allows to pass the ImageCopyPolicy option

func ImagePullSecretsProvider added in v1.1.0

func ImagePullSecretsProvider(provider secrets.ImagePullSecretsProvider) Option

ImagePullSecretsProvider allows to pass a provider reading out Kubernetes secrets

func ImageSwapPolicy added in v1.1.0

func ImageSwapPolicy(policy types.ImageSwapPolicy) Option

ImageSwapPolicy allows to pass the ImageSwapPolicy option

type Task added in v1.4.1

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

Jump to

Keyboard shortcuts

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