controlplane

package
v0.0.0-...-60d224e Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0, MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WebhookName is the webhook name.
	WebhookName = "controlplane"
	// ExposureWebhookName is the exposure webhook name.
	ExposureWebhookName = "controlplaneexposure"
	// BackupWebhookName is the backup webhook name.
	BackupWebhookName = "controlplanebackup"
)
View Source
const EtcdMainVolumeClaimTemplateName = "main-etcd"

EtcdMainVolumeClaimTemplateName is the name of the volume claim template in the etcd-main StatefulSet. It uses a different naming scheme because Gardener was using HDD-based volumes for etcd in the past and did migrate to fast SSD volumes recently. Due to the migration of the data of the old volume to the new one the PVC name is now different.

Variables

This section is empty.

Functions

func Add

func Add(mgr manager.Manager, args AddArgs) (webhook.Webhook, error)

Add creates a new controlplane webhook and adds it to the given Manager.

func ContainerWithName

func ContainerWithName(containers []corev1.Container, name string) *corev1.Container

ContainerWithName returns the container with the given name if it exists in the given slice, nil otherwise.

func DeserializeCommandLine

func DeserializeCommandLine(s string) []string

DeserializeCommandLine deserializes 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 EnsureConfigMapChecksumAnnotation

func EnsureConfigMapChecksumAnnotation(ctx context.Context, template *corev1.PodTemplateSpec, c client.Client, namespace, name string) error

EnsureConfigMapChecksumAnnotation ensures that the given pod template has an annotation containing the checksum of the configmap with the given name and namespace.

func EnsureContainerWithName

func EnsureContainerWithName(items []corev1.Container, item corev1.Container) []corev1.Container

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

func EnsureEnvVarWithName(items []corev1.EnvVar, item corev1.EnvVar) []corev1.EnvVar

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

func EnsureNoContainerWithName(items []corev1.Container, name string) []corev1.Container

EnsureNoContainerWithName ensures that a Container with the given name does not exist in the given slice.

func EnsureNoEnvVarWithName

func EnsureNoEnvVarWithName(items []corev1.EnvVar, name string) []corev1.EnvVar

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

func EnsureNoStringWithPrefix(items []string, prefix string) []string

EnsureNoStringWithPrefix ensures that a string having the given prefix does not exist in the given slice.

func EnsureNoStringWithPrefixContains

func EnsureNoStringWithPrefixContains(items []string, prefix, value, sep string) []string

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

func EnsureNoVolumeWithName(items []corev1.Volume, name string) []corev1.Volume

EnsureNoVolumeWithName ensures that a Volume with the given name does not exist in the given slice.

func EnsurePVCWithName

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 EnsureSecretChecksumAnnotation

func EnsureSecretChecksumAnnotation(ctx context.Context, template *corev1.PodTemplateSpec, c client.Client, namespace, name string) error

EnsureSecretChecksumAnnotation ensures that the given pod template has an annotation containing the checksum of the secret with the given name and namespace.

func EnsureStringWithPrefix

func EnsureStringWithPrefix(items []string, prefix, value string) []string

EnsureStringWithPrefix ensures that a string having the given prefix exists in the given slice with a value equal to prefix + value.

func EnsureStringWithPrefixContains

func EnsureStringWithPrefixContains(items []string, prefix, value, sep string) []string

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

func EnsureVolumeWithName(items []corev1.Volume, item corev1.Volume) []corev1.Volume

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 GetBackupRestoreContainer

func GetBackupRestoreContainer(
	name, volumeClaimTemplateName, schedule, provider, image string,
	args map[string]string,
	env []corev1.EnvVar,
	volumeMounts []corev1.VolumeMount,
) *corev1.Container

GetBackupRestoreContainer returns an etcd backup-restore container with the given name, schedule, provider, image, and additional provider-specific command line args and env variables.

func GetETCDVolumeClaimTemplate

func GetETCDVolumeClaimTemplate(name string, storageClassName *string, storageCapacity *resource.Quantity) *corev1.PersistentVolumeClaim

func GetLoadBalancerIngress

func GetLoadBalancerIngress(ctx context.Context, client client.Client, namespace, name string) (string, error)

GetLoadBalancerIngress takes a context, a client, a namespace and a service name. It queries for a load balancer's technical name (ip address or hostname). It returns the value of the technical name whereby it always prefers the IP address (if given) over the hostname. It also returns the list of all load balancer ingresses. TODO This function is copy / pasted from Gardener, remove it once dependency to Gardener is updated

func PVCWithName

PVCWithName returns the PersistentVolumeClaim with the given name if it exists in the given slice, nil otherwise.

func SerializeCommandLine

func SerializeCommandLine(command []string, n int, sep string) string

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

func StringIndex(items []string, value string) int

StringIndex returns the index of the first occurrence of the given string in the given slice, or -1 if not found.

func StringWithPrefixIndex

func StringWithPrefixIndex(items []string, prefix string) int

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 AddArgs

type AddArgs struct {
	// Kind is the kind of this webhook
	Kind extensionswebhook.Kind
	// Provider is the provider of this webhook.
	Provider string
	// Types is a list of resource types.
	Types []runtime.Object
	// Mutator is a mutator to be used by the admission handler.
	Mutator Mutator
}

AddArgs are arguments for adding a controlplane webhook to a manager.

type FileContentInlineCodec

type FileContentInlineCodec interface {
	// Encode encodes the given byte slice into a *extensionsv1alpha1.FileContentInline.
	Encode([]byte, string) (*extensionsv1alpha1.FileContentInline, error)
	// Decode decodes a byte slice from the given *extensionsv1alpha1.FileContentInline.
	Decode(*extensionsv1alpha1.FileContentInline) ([]byte, error)
}

FileContentInlineCodec contains methods for encoding and decoding byte slices to and from *extensionsv1alpha1.FileContentInline.

func NewFileContentInlineCodec

func NewFileContentInlineCodec() FileContentInlineCodec

NewFileContentInlineCodec creates an returns a new FileContentInlineCodec.

type KubeletConfigCodec

type KubeletConfigCodec interface {
	// Encode encodes the given *kubeletconfigv1beta1.KubeletConfiguration into a *extensionsv1alpha1.FileContentInline.
	Encode(*kubeletconfigv1beta1.KubeletConfiguration, string) (*extensionsv1alpha1.FileContentInline, error)
	// Decode decodes a *kubeletconfigv1beta1.KubeletConfiguration from the given *extensionsv1alpha1.FileContentInline.
	Decode(*extensionsv1alpha1.FileContentInline) (*kubeletconfigv1beta1.KubeletConfiguration, error)
}

KubeletConfigCodec contains methods for encoding and decoding *kubeletconfigv1beta1.KubeletConfiguration objects to and from *extensionsv1alpha1.FileContentInline.

func NewKubeletConfigCodec

func NewKubeletConfigCodec(fciCodec FileContentInlineCodec) KubeletConfigCodec

NewKubeletConfigCodec creates an returns a new KubeletConfigCodec.

type Mutator

type Mutator interface {
	// Mutate validates and if needed mutates the given object.
	Mutate(ctx context.Context, obj runtime.Object) error
}

Mutator validates and if needed mutates objects.

type UnitSerializer

type UnitSerializer interface {
	// Serialize serializes the given slice of systemd unit options to a string.
	Serialize([]*unit.UnitOption) (string, error)
	// Deserialize deserializes a slice of systemd unit options from the given string.
	Deserialize(string) ([]*unit.UnitOption, error)
}

UnitSerializer contains methods for serializing and deserializing a slice of systemd unit options to and from a string.

func NewUnitSerializer

func NewUnitSerializer() UnitSerializer

NewUnitSerializer creates and returns a new UnitSerializer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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