mutate

package
v0.0.0-...-b8f6642 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewK8SClient

func NewK8SClient() (kubernetes.Interface, error)

Types

type ASMConfig

type ASMConfig struct {
	ImageName     string
	MountPath     string
	BinPath       string
	BinaryName    string
	Debug         bool
	SkipCertCheck bool
	Log           *log.Logger
}

type Mutator

type Mutator struct {
	K8sClient kubernetes.Interface
	Namespace string
	Registry  registry.ImageRegistry
}

func CreateClient

func CreateClient(k8sClient kubernetes.Interface, fs afero.Fs) (*Mutator, error)

func (*Mutator) ConfigMapHasSecret

func (mw *Mutator) ConfigMapHasSecret(cmName string, ns string, optional *bool) (hasSecret bool, err error)

func (*Mutator) ContainerHasSecrets

func (m *Mutator) ContainerHasSecrets(container *corev1.Container, ns string) (hasSecrets bool, err error)

func (*Mutator) CreateInitContainer

func (m *Mutator) CreateInitContainer(config ASMConfig) []corev1.Container

CreateInitContainer injects an initContainer that copies the asm-env binary to a shared mounted volume

func (*Mutator) CreateVolume

func (m *Mutator) CreateVolume(config ASMConfig) []corev1.Volume

CreateVolume creates the shared volume that receives asm-env binary

func (*Mutator) EnvFromHasSecret

func (m *Mutator) EnvFromHasSecret(envFrom *[]corev1.EnvFromSource, ns string) (hasSecrets bool, err error)

func (*Mutator) ExtractArgsFromImageConfig

func (m *Mutator) ExtractArgsFromImageConfig(ctx context.Context, container *corev1.Container, podSpec *corev1.PodSpec, ns string) (args []string, err error)

func (*Mutator) MutateContainers

func (m *Mutator) MutateContainers(ctx context.Context, containers []corev1.Container, pod *corev1.Pod, config ASMConfig) (out []corev1.Container, shouldMutate bool, err error)

func (*Mutator) MutatePod

func (m *Mutator) MutatePod(ctx context.Context, pod *corev1.Pod, config ASMConfig) (res *kwhmutating.MutatorResult, err error)

MutatePod loops over every initContainer and container to mutate them if necessary

func (*Mutator) MutateSingleContainer

func (m *Mutator) MutateSingleContainer(ctx context.Context, container *corev1.Container, podSpec *corev1.PodSpec, config ASMConfig, ns string) (new *corev1.Container, err error)

func (*Mutator) ParseConfig

func (m *Mutator) ParseConfig(obj metav1.Object) ASMConfig

func (*Mutator) SecretRefHasSecret

func (mw *Mutator) SecretRefHasSecret(secretName string, ns string, optional *bool) (hasSecret bool, err error)

func (*Mutator) SecretsMutator

SecretsMutator receives the object to mutate and calls the right function according to its type

func (*Mutator) SourceHasSecret

func (m *Mutator) SourceHasSecret(env *corev1.EnvVar, ns string) (hasSecret bool, err error)

Jump to

Keyboard shortcuts

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