webhook

package
v0.0.0-...-72a785e Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VaultAgentConfigPrefix represents a prefix for the config map
	VaultAgentConfigPrefix = "vault-agent-config"
)

Variables

This section is empty.

Functions

func CreatePatch

func CreatePatch(pod *corev1.Pod, sidecarInject *SidecarInject, annotations map[string]string) ([]byte, error)

CreatePatch to inject the change

func FindTokenVolumeName

func FindTokenVolumeName(volumes []corev1.Volume) string

FindTokenVolumeName retrieves the Secret -token types volume

func FindVolumeMount

func FindVolumeMount(volumes []corev1.VolumeMount, name string) corev1.VolumeMount

FindVolumeMount returns the volume mount entry

func GetAnnotationValue

func GetAnnotationValue(pod corev1.Pod, name *registeredAnnotation, defaultValue string) string

GetAnnotationValue returns the vaule of annotation from a Pod

func GetDeploymentName

func GetDeploymentName(name string) (string, error)

GetDeploymentName return the name of a Deployment

func Load

func Load(file string, c interface{})

Load a yaml file

func Pod

func Pod(raw []byte, pod *corev1.Pod) error

Pod unmarshalls byte to corev1.Pod

func PotentialNamespace

func PotentialNamespace(req *v1.AdmissionRequest, pod *corev1.Pod) string

PotentialNamespace deal with potential namespace name

func PotentialPodName

func PotentialPodName(metadata *metav1.ObjectMeta) string

PotentialPodName deal with potential empty fields, e.g., when the pod is created by a deployment

func ToAdmissionResponseError

func ToAdmissionResponseError(err error) *v1.AdmissionResponse

ToAdmissionResponseError creates a not allowed AdmissionResponse

Types

type SidecarConfig

type SidecarConfig struct {
	Template           string `json:"template"`
	VaultAgentConfig   string `json:"agent.config"`
	VaultAgentTemplate string `json:"template.ctmpl"`
}

SidecarConfig defines the sidecar ConfigMap configuration

type SidecarData

type SidecarData struct {
	Name          string
	Container     corev1.Container
	TokenVolume   string
	VaultSecret   string
	VaultFileName string
	VaultRole     string
	VaultInit     bool
}

SidecarData defines data to be injected in the template

type SidecarInject

type SidecarInject struct {
	InitContainers []corev1.Container   `yaml:"initContainers"`
	Containers     []corev1.Container   `yaml:"containers"`
	Volumes        []corev1.Volume      `yaml:"volumes"`
	VolumeMount    []corev1.VolumeMount `yaml:"volumeMounts"`
}

SidecarInject defines the content to be injected

type WebHook

type WebHook struct {
	SidecarConfig *SidecarConfig
	VaultConfig   *SidecarInject
}

WebHook defines the webhook configuration

func (*WebHook) Mutate

func (wk *WebHook) Mutate(context *gin.Context)

Mutate AdmissionReview Request

Jump to

Keyboard shortcuts

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