Documentation
¶
Index ¶
- Variables
- func NewImageSwapper(registryClient registry.Client, ...) kwhmutating.Mutator
- func NewImageSwapperWebhook(registryClient registry.Client, ...) (webhook.Webhook, error)
- func NewImageSwapperWebhookWithOpts(registryClient registry.Client, opts ...Option) (webhook.Webhook, error)
- func NewImageSwapperWithOpts(registryClient registry.Client, opts ...Option) kwhmutating.Mutator
- type FilterContext
- type ImageCopier
- type ImageSwapper
- type Option
- func Copier(pool *pond.WorkerPool) Option
- func Filters(filters []config.JMESPathFilter) Option
- func ImageCopyDeadline(deadline time.Duration) Option
- func ImageCopyPolicy(policy types.ImageCopyPolicy) Option
- func ImagePullSecretsProvider(provider secrets.ImagePullSecretsProvider) Option
- func ImageSwapPolicy(policy types.ImageSwapPolicy) Option
- type Task
Constants ¶
This section is empty.
Variables ¶
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 NewImageSwapperWithOpts ¶
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 ¶
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 ¶
func (p *ImageSwapper) Mutate(ctx context.Context, ar *kwhmodel.AdmissionReview, obj metav1.Object) (*kwhmutating.MutatorResult, error)
Mutate replaces the image ref. Satisfies mutating.Mutator interface.
type Option ¶
type Option func(*ImageSwapper)
Option represents an option that can be passed when instantiating the image swapper to customize it
func Filters ¶
func Filters(filters []config.JMESPathFilter) Option
Filters allows to pass JMESPathFilter to select the images to be swapped
func ImageCopyDeadline ¶
ImageCopyDeadline allows to pass the ImageCopyPolicy option
func ImageCopyPolicy ¶
func ImageCopyPolicy(policy types.ImageCopyPolicy) Option
ImageCopyPolicy allows to pass the ImageCopyPolicy option
func ImagePullSecretsProvider ¶
func ImagePullSecretsProvider(provider secrets.ImagePullSecretsProvider) Option
ImagePullSecretsProvider allows to pass a provider reading out Kubernetes secrets
func ImageSwapPolicy ¶
func ImageSwapPolicy(policy types.ImageSwapPolicy) Option
ImageSwapPolicy allows to pass the ImageSwapPolicy option