install

package
v0.0.0-...-0e4f5d7 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const JavaOptsEnvVarName = "JAVA_APP_OPTS"
View Source
const ServingCertSecretNameAlpha = "service.alpha.openshift.io/serving-cert-secret-name"
View Source
const ServingCertSecretNameBeta = "service.beta.openshift.io/serving-cert-secret-name"

Variables

This section is empty.

Functions

func AddOwnerReference

func AddOwnerReference(owner v1.Object, object v1.Object, scheme *runtime.Scheme) error

Ensure that an owner is set

func AppendEnvVarValue

func AppendEnvVarValue(container *corev1.Container, name string, value string)

Append a string to the value of an env-var. If the env-var doesn't exist, it will be created with the provided value. A whitespace is added between the existing value and the new value.

func ApplyAnnotation

func ApplyAnnotation(meta *v1.ObjectMeta, key string, value string)

func ApplyConfigMapHash

func ApplyConfigMapHash(c client.Client, pod *corev1.PodTemplateSpec, annotationName string, namespace string, configMapName string, keys ...string) error

Get the hash of the content of a config map, and apply this to the pod so that a change in the content of the config map will trigger a re-rollout.

func ApplyConfigMapVolume

func ApplyConfigMapVolume(pod *corev1.PodSpec, name string, configMapName string)

func ApplyConfigMapVolumeItems

func ApplyConfigMapVolumeItems(pod *corev1.PodSpec, name string, configMapName string, items []corev1.KeyToPath)

func ApplyContainerImage

func ApplyContainerImage(container *corev1.Container, imageName string, override *v1beta1.ImageOverride) error

func ApplyContainerWithError

func ApplyContainerWithError(containers []corev1.Container, name string, mutator func(*corev1.Container) error) ([]corev1.Container, error)

func ApplyCustomLabel

func ApplyCustomLabel(meta *v1.ObjectMeta, key string, value string)

Apply a custom label

func ApplyDefaultLabels

func ApplyDefaultLabels(meta *v1.ObjectMeta, component string, name string)

Apply standard set of labels

func ApplyDeploymentContainerWithError

func ApplyDeploymentContainerWithError(deployment *appsv1.Deployment, name string, mutator func(*corev1.Container) error) error

func ApplyDeploymentDefaults

func ApplyDeploymentDefaults(deployment *appsv1.Deployment, component string, name string)

Apply some default deployment values

func ApplyEmptyDirVolume

func ApplyEmptyDirVolume(pod *corev1.PodSpec, name string)

func ApplyEnv

func ApplyEnv(container *corev1.Container, name string, mutator func(envvar *corev1.EnvVar))

func ApplyEnvConfigMap

func ApplyEnvConfigMap(container *corev1.Container, name string, configMapKey string, configMapName string, optional *bool)

func ApplyEnvOptionalSecret

func ApplyEnvOptionalSecret(container *corev1.Container, name string, secretKey string, secretName string, optional *bool)

func ApplyEnvSecret

func ApplyEnvSecret(container *corev1.Container, name string, secretKey string, secretName string)

func ApplyEnvSimple

func ApplyEnvSimple(container *corev1.Container, name string, value string)

func ApplyEnvWithError

func ApplyEnvWithError(container *corev1.Container, name string, mutator func(envvar *corev1.EnvVar) error) error

func ApplyHttpProbe

func ApplyHttpProbe(probe *corev1.Probe, initialDelaySeconds int32, path string, port uint16) *corev1.Probe

Apply a simple HTTP probe

func ApplyInitContainerWithError

func ApplyInitContainerWithError(deployment *appsv1.Deployment, name string, mutator func(*corev1.Container) error) error

func ApplyJobContainerWithError

func ApplyJobContainerWithError(job *batchv1.Job, name string, mutator func(*corev1.Container) error) error

func ApplyMetricsServiceDefaults

func ApplyMetricsServiceDefaults(service *corev1.Service, component string, name string)

func ApplyNodeAffinity

func ApplyNodeAffinity(template *corev1.PodTemplateSpec, matchKey string)

func ApplyOpenShiftServingCertAnnotation

func ApplyOpenShiftServingCertAnnotation(annotations map[string]string, certName string, isOpenShift func() bool, isOpenShift4 func() bool)

func ApplyOrRemoveEnvSimple

func ApplyOrRemoveEnvSimple(container *corev1.Container, name string, value string)

func ApplyPersistentVolume

func ApplyPersistentVolume(pod *corev1.PodSpec, name string, claimName string)

func ApplySecretHash

func ApplySecretHash(c client.Client, pod *corev1.PodTemplateSpec, annotationName string, namespace string, secretName string, keys ...string) error

Get the hash of the content of a secret, and apply this to the pod so that a change in the content of the secret will trigger a re-rollout.

func ApplySecretVolume

func ApplySecretVolume(pod *corev1.PodSpec, name string, secretName string)

func ApplyServiceDefaults

func ApplyServiceDefaults(service *corev1.Service, component string, name string)

Apply some default service values

func ApplyStatefulSetContainerWithError

func ApplyStatefulSetContainerWithError(statefulSet *appsv1.StatefulSet, name string, mutator func(*corev1.Container) error) error

func ApplyStatefulSetDefaults

func ApplyStatefulSetDefaults(statefulset *appsv1.StatefulSet, component string, name string)

Apply some default deployment values

func ApplyTlsSecret

func ApplyTlsSecret(secret *corev1.Secret, key []byte, certificate []byte)

func ApplyVolume

func ApplyVolume(pod *corev1.PodSpec, name string, mutator func(*corev1.Volume))

func ApplyVolumeMount

func ApplyVolumeMount(container *corev1.Container, name string, mutator func(mount *corev1.VolumeMount))

func ApplyVolumeMountSimple

func ApplyVolumeMountSimple(container *corev1.Container, name string, path string, readOnly bool)

func ApplyVolumeMountWithError

func ApplyVolumeMountWithError(container *corev1.Container, name string, mutator func(mount *corev1.VolumeMount) error) error

func ApplyVolumeWithError

func ApplyVolumeWithError(pod *corev1.PodSpec, name string, mutator func(*corev1.Volume) error) error

func BulkProcess

func BulkProcess(ctx context.Context, client client.Client, list runtime.Object, opts client.ListOptions, evaluator BulkItemEvaluator) (int, error)

Bulk delete The "obj" provided must by a Kubernetes List type, having an "Items" field

func BulkRemoveOwner

func BulkRemoveOwner(ctx context.Context, c client.Client, owner runtime.Object, controller bool, list runtime.Object, opts client.ListOptions) (int, error)

Process an object type, and remove the owner, from the owner list. If this was the last owner. Delete the object. The "obj" provided must by a Kubernetes List type, having an "Items" field It returns the number of entries found which did contain the owner of the provided object.

func ComputeConfigMapHash

func ComputeConfigMapHash(cm corev1.ConfigMap) (hash string, err error)

func CreateDefaultAnnotations

func CreateDefaultAnnotations(annotations map[string]string) map[string]string

func CreateDefaultLabels

func CreateDefaultLabels(labels map[string]string, component string, name string) map[string]string

func DeleteIgnoreNotFound

func DeleteIgnoreNotFound(ctx context.Context, client client.Client, obj runtime.Object, opts ...client.DeleteOption) error

Delete object, ignore if it is already gone or the kind is unknown.

func DeleteItemOperation

func DeleteItemOperation(ctx context.Context, client client.Client, obj interface{}) error

func DeleteOtherContainers

func DeleteOtherContainers(containers []corev1.Container, prefix string, expectedNames []string) []corev1.Container

Delete all containers which are not expected

func DropContainer

func DropContainer(deployment *appsv1.Deployment, name string)

func DropVolume

func DropVolume(pod *corev1.PodSpec, name string)

func DropVolumeMount

func DropVolumeMount(container *corev1.Container, name string)

func FromConfigMap

func FromConfigMap(configMapName string, configMapKey string) *corev1.EnvVarSource

func FromField

func FromField(fieldPath string) *corev1.EnvVarSource

func FromFieldNamespace

func FromFieldNamespace() *corev1.EnvVarSource

func FromOptionalConfigMap

func FromOptionalConfigMap(configMapName string, configMapKey string, optional *bool) *corev1.EnvVarSource

func FromOptionalSecret

func FromOptionalSecret(secretName string, secretKey string, optional *bool) *corev1.EnvVarSource

func FromSecret

func FromSecret(secretName string, secretKey string) *corev1.EnvVarSource

func IsDeleted

func IsDeleted(obj interface{}) (bool, error)

Test if an object is being deleted

func IsOwnedBy

func IsOwnedBy(owner runtime.Object, obj interface{}, controller bool) (bool, error)

func LabelSelectorFromMap

func LabelSelectorFromMap(l map[string]string) (labels.Selector, error)

func OverrideProbe

func OverrideProbe(override *corev1.Probe, target *corev1.Probe)

func OverrideSecurityContextFsGroup

func OverrideSecurityContextFsGroup(componentName string, securityContext *corev1.PodSecurityContext, target *appsv1.Deployment)

func RemoveEnv

func RemoveEnv(container *corev1.Container, name string)

func SetContainerImage

func SetContainerImage(container *corev1.Container, imageName string, overrides v1beta1.ImageOverridesProvider) error

func UpdateItemOperation

func UpdateItemOperation(ctx context.Context, client client.Client, obj interface{}) error

Types

type BulkItemEvaluator

type BulkItemEvaluator func(interface{}) (BulkItemOperation, error)

type BulkItemOperation

type BulkItemOperation func(context.Context, client.Client, interface{}) error

type DeletePredicate

type DeletePredicate func(interface{}) bool

type OwnerResult

type OwnerResult int
const (
	NotFound OwnerResult = iota
	Found
	FoundAndEmpty
)

func DeleteIfOwnedBy

func DeleteIfOwnedBy(ctx context.Context, c client.Client, objectKey client.ObjectKey, obj runtime.Object, owner runtime.Object, controller bool) (OwnerResult, error)

Delete an object, if it is owned by the owner. Otherwise leave it alone. If the object doesn't exists, this will be reported as an error which can be checked by IsNotFound(err)

func ProcessOwnedBy

func ProcessOwnedBy(obj v1.Object, owner runtime.Object, controller bool, remove bool) (OwnerResult, error)

Function to check if an object is owned by another object

func ProcessOwnedByObject

func ProcessOwnedByObject(owner runtime.Object, obj interface{}, controller bool, remove bool) (OwnerResult, error)

same as, ProcessOwnedBy, but handles interfaces (structured and unstructured)

func RemoveAsOwner

func RemoveAsOwner(owner runtime.Object, object interface{}, controller bool) (OwnerResult, error)

Jump to

Keyboard shortcuts

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