Documentation ¶
Index ¶
- Constants
- func AppendUniqueUnit(units *[]extensionsv1alpha1.Unit, unit extensionsv1alpha1.Unit)
- func ContainerWithName(containers []corev1.Container, name string) *corev1.Container
- func DeserializeCommandLine(s string) []string
- func EnsureAnnotationOrLabel(annotationOrLabelMap map[string]string, key, value string) map[string]string
- func EnsureContainerWithName(items []corev1.Container, item corev1.Container) []corev1.Container
- func EnsureEnvVarWithName(items []corev1.EnvVar, item corev1.EnvVar) []corev1.EnvVar
- func EnsureFileWithPath(items []extensionsv1alpha1.File, item extensionsv1alpha1.File) []extensionsv1alpha1.File
- func EnsureNoContainerWithName(items []corev1.Container, name string) []corev1.Container
- func EnsureNoEnvVarWithName(items []corev1.EnvVar, name string) []corev1.EnvVar
- func EnsureNoPVCWithName(items []corev1.PersistentVolumeClaim, name string) []corev1.PersistentVolumeClaim
- func EnsureNoStringWithPrefix(items []string, prefix string) []string
- func EnsureNoStringWithPrefixContains(items []string, prefix, value, sep string) []string
- func EnsureNoVolumeMountWithName(items []corev1.VolumeMount, name string) []corev1.VolumeMount
- func EnsureNoVolumeWithName(items []corev1.Volume, name string) []corev1.Volume
- func EnsurePVCWithName(items []corev1.PersistentVolumeClaim, item corev1.PersistentVolumeClaim) []corev1.PersistentVolumeClaim
- func EnsureStringWithPrefix(items []string, prefix, value string) []string
- func EnsureStringWithPrefixContains(items []string, prefix, value, sep string) []string
- func EnsureUnitOption(items []*unit.UnitOption, item *unit.UnitOption) []*unit.UnitOption
- func EnsureVolumeMountWithName(items []corev1.VolumeMount, item corev1.VolumeMount) []corev1.VolumeMount
- func EnsureVolumeWithName(items []corev1.Volume, item corev1.Volume) []corev1.Volume
- func FileWithPath(files []extensionsv1alpha1.File, path string) *extensionsv1alpha1.File
- func GenerateCertificates(ctx context.Context, mgr manager.Manager, ...) ([]byte, error)
- func LogMutation(logger logr.Logger, kind, namespace, name string)
- func NewHandlerWithShootClient(mgr manager.Manager, types []runtime.Object, mutator MutatorWithShootClient, ...) (*handlerShootClient, error)
- func PVCWithName(pvcs []corev1.PersistentVolumeClaim, name string) *corev1.PersistentVolumeClaim
- func RegisterWebhooks(ctx context.Context, mgr manager.Manager, namespace, providerName string, ...) (webhooksToRegisterSeed []admissionregistrationv1beta1.MutatingWebhook, ...)
- func SerializeCommandLine(command []string, n int, sep string) string
- func StringIndex(items []string, value string) int
- func StringWithPrefixIndex(items []string, prefix string) int
- func UnitOptionWithSectionAndName(opts []*unit.UnitOption, section, name string) *unit.UnitOption
- func UnitWithName(units []extensionsv1alpha1.Unit, name string) *extensionsv1alpha1.Unit
- type Args
- type HandlerBuilder
- func (b *HandlerBuilder) Build() (admission.Handler, error)
- func (b *HandlerBuilder) WithMutator(mutator Mutator, types ...runtime.Object) *HandlerBuilder
- func (b *HandlerBuilder) WithPredicates(predicates ...predicate.Predicate) *HandlerBuilder
- func (b *HandlerBuilder) WithValidator(validator Validator, types ...runtime.Object) *HandlerBuilder
- type MutateFunc
- type Mutator
- type MutatorWithShootClient
- type Validator
- type Webhook
Constants ¶
const ( // ModeService is a constant for the webhook mode indicating that the controller is running inside of the Kubernetes cluster it // is serving. ModeService = "service" // ModeURL is a constant for the webhook mode indicating that the controller is running outside of the Kubernetes cluster it // is serving. If this is set then a URL is required for configuration. ModeURL = "url" // ModeURLWithServiceName is a constant for the webhook mode indicating that the controller is running outside of the Kubernetes cluster it // is serving but in the same cluster like the kube-apiserver. If this is set then a URL is required for configuration. ModeURLWithServiceName = "url-service" )
const ( // TargetSeed defines that the webhook is to be installed in the seed. TargetSeed = "seed" // TargetShoot defines that the webhook is to be installed in the shoot. TargetShoot = "shoot" // ValidatorName is a common name for a validation webhook. ValidatorName = "validator" // ValidatorPath is a common path for a validation webhook. ValidatorPath = "/webhooks/validate" )
Variables ¶
This section is empty.
Functions ¶
func AppendUniqueUnit ¶
func AppendUniqueUnit(units *[]extensionsv1alpha1.Unit, unit extensionsv1alpha1.Unit)
AppendUniqueUnit appens a unit only if it does not exist.
func ContainerWithName ¶
ContainerWithName returns the container with the given name if it exists in the given slice, nil otherwise.
func DeserializeCommandLine ¶
DeserializeCommandLine de-serializes the given string to a slice of command line elements by splitting it on white space and the "\" character.
func EnsureAnnotationOrLabel ¶
func EnsureAnnotationOrLabel(annotationOrLabelMap map[string]string, key, value string) map[string]string
EnsureAnnotationOrLabel ensures the given key/value exists in the annotationOrLabelMap map.
func EnsureContainerWithName ¶
EnsureContainerWithName ensures that a Container with a name equal to the name of the given Container exists in the given slice and is equal to the given Container.
func EnsureEnvVarWithName ¶
EnsureEnvVarWithName ensures that a EnvVar with a name equal to the name of the given EnvVar exists in the given slice and is equal to the given EnvVar.
func EnsureFileWithPath ¶
func EnsureFileWithPath(items []extensionsv1alpha1.File, item extensionsv1alpha1.File) []extensionsv1alpha1.File
EnsureFileWithPath ensures that a file with a path equal to the path of the given file exists in the given slice and is equal to the given file.
func EnsureNoContainerWithName ¶
EnsureNoContainerWithName ensures that a Container with the given name does not exist in the given slice.
func EnsureNoEnvVarWithName ¶
EnsureNoEnvVarWithName ensures that a EnvVar with the given name does not exist in the given slice.
func EnsureNoPVCWithName ¶
func EnsureNoPVCWithName(items []corev1.PersistentVolumeClaim, name string) []corev1.PersistentVolumeClaim
EnsureNoPVCWithName ensures that a PVC with the given name does not exist in the given slice.
func EnsureNoStringWithPrefix ¶
EnsureNoStringWithPrefix ensures that a string having the given prefix does not exist in the given slice.
func EnsureNoStringWithPrefixContains ¶
EnsureNoStringWithPrefixContains ensures that either a string having the given prefix does not exist in the given slice, or it doesn't contain the given value in a list separated by sep.
func EnsureNoVolumeMountWithName ¶
func EnsureNoVolumeMountWithName(items []corev1.VolumeMount, name string) []corev1.VolumeMount
EnsureNoVolumeMountWithName ensures that a VolumeMount with the given name does not exist in the given slice.
func EnsureNoVolumeWithName ¶
EnsureNoVolumeWithName ensures that a Volume with the given name does not exist in the given slice.
func EnsurePVCWithName ¶
func EnsurePVCWithName(items []corev1.PersistentVolumeClaim, item corev1.PersistentVolumeClaim) []corev1.PersistentVolumeClaim
EnsurePVCWithName ensures that a PVC with a name equal to the name of the given PVC exists in the given slice and is equal to the given PVC.
func EnsureStringWithPrefix ¶
EnsureStringWithPrefix ensures that a string having the given prefix exists in the given slice with a value equal to prefix + value.
func EnsureStringWithPrefixContains ¶
EnsureStringWithPrefixContains ensures that a string having the given prefix exists in the given slice and contains the given value in a list separated by sep.
func EnsureUnitOption ¶
func EnsureUnitOption(items []*unit.UnitOption, item *unit.UnitOption) []*unit.UnitOption
EnsureUnitOption ensures the given unit option exist in the given slice.
func EnsureVolumeMountWithName ¶
func EnsureVolumeMountWithName(items []corev1.VolumeMount, item corev1.VolumeMount) []corev1.VolumeMount
EnsureVolumeMountWithName ensures that a VolumeMount with a name equal to the name of the given VolumeMount exists in the given slice and is equal to the given VolumeMount.
func EnsureVolumeWithName ¶
EnsureVolumeWithName ensures that a Volume with a name equal to the name of the given Volume exists in the given slice and is equal to the given Volume.
func FileWithPath ¶
func FileWithPath(files []extensionsv1alpha1.File, path string) *extensionsv1alpha1.File
FileWithPath returns the file with the given path if it exists in the given slice, nil otherwise.
func GenerateCertificates ¶
func GenerateCertificates(ctx context.Context, mgr manager.Manager, certDir, namespace, name, mode, url string) ([]byte, error)
GenerateCertificates generates the certificates that are required for a webhook. It returns the ca bundle, and it stores the server certificate and key locally on the file system.
func LogMutation ¶
LogMutation provides a log message.
func NewHandlerWithShootClient ¶
func NewHandlerWithShootClient(mgr manager.Manager, types []runtime.Object, mutator MutatorWithShootClient, logger logr.Logger) (*handlerShootClient, error)
NewHandlerWithShootClient creates a new handler for the given types, using the given mutator, and logger.
func PVCWithName ¶
func PVCWithName(pvcs []corev1.PersistentVolumeClaim, name string) *corev1.PersistentVolumeClaim
PVCWithName returns the PersistentVolumeClaim with the given name if it exists in the given slice, nil otherwise.
func RegisterWebhooks ¶
func RegisterWebhooks(ctx context.Context, mgr manager.Manager, namespace, providerName string, servicePort int, mode, url string, caBundle []byte, webhooks []*Webhook) (webhooksToRegisterSeed []admissionregistrationv1beta1.MutatingWebhook, webhooksToRegisterShoot []admissionregistrationv1beta1.MutatingWebhook, err error)
RegisterWebhooks registers the given webhooks in the Kubernetes cluster targeted by the provided manager.
func SerializeCommandLine ¶
SerializeCommandLine serializes the given command line elements slice to a string by joining the first n+1 elements with a space " ", and all subsequent elements with the given separator.
func StringIndex ¶
StringIndex returns the index of the first occurrence of the given string in the given slice, or -1 if not found.
func StringWithPrefixIndex ¶
StringWithPrefixIndex returns the index of the first occurrence of a string having the given prefix in the given slice, or -1 if not found.
func UnitOptionWithSectionAndName ¶
func UnitOptionWithSectionAndName(opts []*unit.UnitOption, section, name string) *unit.UnitOption
UnitOptionWithSectionAndName returns the unit option with the given section and name if it exists in the given slice, nil otherwise.
func UnitWithName ¶
func UnitWithName(units []extensionsv1alpha1.Unit, name string) *extensionsv1alpha1.Unit
UnitWithName returns the unit with the given name if it exists in the given slice, nil otherwise.
Types ¶
type HandlerBuilder ¶ added in v1.4.0
type HandlerBuilder struct {
// contains filtered or unexported fields
}
HandlerBuilder contains information which are required to create an admission handler.
func NewBuilder ¶ added in v1.4.0
func NewBuilder(mgr manager.Manager, logger logr.Logger) *HandlerBuilder
NewBuilder creates a new HandlerBuilder.
func (*HandlerBuilder) Build ¶ added in v1.4.0
func (b *HandlerBuilder) Build() (admission.Handler, error)
Build creates a new admission.Handler with the settings previously specified with the HandlerBuilder's functions.
func (*HandlerBuilder) WithMutator ¶ added in v1.4.0
func (b *HandlerBuilder) WithMutator(mutator Mutator, types ...runtime.Object) *HandlerBuilder
WithMutator adds the given mutator for the given types to the HandlerBuilder.
func (*HandlerBuilder) WithPredicates ¶ added in v1.4.0
func (b *HandlerBuilder) WithPredicates(predicates ...predicate.Predicate) *HandlerBuilder
WithPredicates adds the given predicates to the HandlerBuilder.
func (*HandlerBuilder) WithValidator ¶ added in v1.4.0
func (b *HandlerBuilder) WithValidator(validator Validator, types ...runtime.Object) *HandlerBuilder
WithValidator adds the given validator for the given types to the HandlerBuilder.
type MutateFunc ¶ added in v1.4.0
MutateFunc is a func to be used directly as an implementation for Mutator
type Mutator ¶
type Mutator interface { // Mutate validates and if needed mutates the given object. // "old" is optional and it must always be checked for nil. Mutate(ctx context.Context, new, old runtime.Object) error }
Mutator validates and if needed mutates objects.
type MutatorWithShootClient ¶
type MutatorWithShootClient interface { // Mutate validates and if needed mutates the given object. // "old" is optional and it must always be checked for nil. Mutate(ctx context.Context, new, old runtime.Object, shootClient client.Client) error }
MutatorWithShootClient validates and if needed mutates objects. It needs the shoot client.