helper

package
v0.121.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const Base32EncodeStdLowerCase = "abcdefghijklmnopqrstuvwxyz234567"
View Source
const ExecutionPrefix = "Exec."

ExecutionPrefix is the prefix combined with execution name is used as label value. Do not change length.

View Source
const InstallationPrefix = "Inst."

InstallationPrefix is the prefix combined with installation name is used as label value. Do not change length.

View Source
const NonContextifiedPrefix = "#"
View Source
const SourceDelimiter = "/"

Variables

This section is empty.

Functions

func CreateOrUpdateConditions

func CreateOrUpdateConditions(conditions []v1alpha1.Condition, condType v1alpha1.ConditionType, status v1alpha1.ConditionStatus, reason, message string, codes ...v1alpha1.ErrorCode) []v1alpha1.Condition

CreateOrUpdateConditions creates or updates a condition in a condition list.

func CreateOrUpdateVersionedObjectReferences

func CreateOrUpdateVersionedObjectReferences(refs []v1alpha1.VersionedObjectReference, ref v1alpha1.ObjectReference, gen int64) []v1alpha1.VersionedObjectReference

CreateOrUpdateVersionedObjectReferences creates or updates a element in versioned objectReference slice.

func DataObjectSourceFromExecution

func DataObjectSourceFromExecution(src *lsv1alpha1.Execution) string

DataObjectSourceFromExecution returns the data object source for a Execution.

func DataObjectSourceFromInstallation

func DataObjectSourceFromInstallation(src *lsv1alpha1.Installation) string

DataObjectSourceFromInstallation returns the data object source for a Installation.

func DataObjectSourceFromInstallationName

func DataObjectSourceFromInstallationName(name string) string

DataObjectSourceFromInstallationName returns the data object source for an Installation name.

func DataObjectSourceFromObject

func DataObjectSourceFromObject(src runtime.Object) (string, error)

DataObjectSourceFromObject returns the data object source for a runtime object.

func DeleteCacheHelmChartsAnnotation added in v0.104.0

func DeleteCacheHelmChartsAnnotation(obj *metav1.ObjectMeta)

func GenerateDataObjectName

func GenerateDataObjectName(context string, name string) string

GenerateDataObjectName generates the unique name for a data object exported or imported by a installation. It returns a non contextified data name if the name starts with a "#".

func GenerateDataObjectNameWithIndex

func GenerateDataObjectNameWithIndex(context string, name string, index int) string

GenerateDataObjectNameWithIndex generates a unique name for a data object which is part of a list and therefore has no own name but is identified by a combination of name and index. It builds a fake name by combining name and index and then calls GenerateDataObjectName.

func GetCondition

func GetCondition(conditions []v1alpha1.Condition, conditionType v1alpha1.ConditionType) *v1alpha1.Condition

GetCondition returns the condition with the given <conditionType> out of the list of <conditions>. In case the required type could not be found, it returns nil.

func GetNamedObjectReference

func GetNamedObjectReference(objects []v1alpha1.NamedObjectReference, name string) (v1alpha1.NamedObjectReference, bool)

GetNamedObjectReference returns the object reference with the given name.

func GetOperation

func GetOperation(obj metav1.ObjectMeta) string

func GetOrInitCondition

func GetOrInitCondition(conditions []v1alpha1.Condition, conditionType v1alpha1.ConditionType) v1alpha1.Condition

GetOrInitCondition tries to retrieve the condition with the given condition type from the given conditions. If the condition could not be found, it returns an initialized condition of the given type.

func GetTimestampAnnotation

func GetTimestampAnnotation(obj metav1.ObjectMeta, ta TimestampAnnotation) (time.Time, error)

func HasCacheHelmChartsAnnotation added in v0.104.0

func HasCacheHelmChartsAnnotation(obj *metav1.ObjectMeta) bool

func HasDeleteWithoutUninstallAnnotation

func HasDeleteWithoutUninstallAnnotation(obj metav1.ObjectMeta) bool

HasDeleteWithoutUninstallAnnotation returns true only if the given object has the 'landscaper.gardener.cloud/delete-without-uninstall' annotation and its value is 'true'.

func HasIgnoreAnnotation

func HasIgnoreAnnotation(obj metav1.ObjectMeta) bool

HasIgnoreAnnotation returns true only if the given object has the 'landscaper.gardener.cloud/ignore' annotation and its value is 'true'.

func HasOperation

func HasOperation(obj metav1.ObjectMeta, op v1alpha1.Operation) bool

HasOperation checks if the obj has the given operation annotation

func HasReconcileIfChangedAnnotation

func HasReconcileIfChangedAnnotation(obj metav1.ObjectMeta) bool

func InitCondition

func InitCondition(conditionType v1alpha1.ConditionType) v1alpha1.Condition

InitCondition initializes a new Condition with an Unknown status.

func IsConditionStatus

func IsConditionStatus(conditions []v1alpha1.Condition, status v1alpha1.ConditionStatus) bool

IsConditionStatus returns if all condition states of all conditions are true.

func MergeConditions

func MergeConditions(oldConditions []v1alpha1.Condition, newConditions ...v1alpha1.Condition) []v1alpha1.Condition

MergeConditions merges the given <oldConditions> with the <newConditions>. Existing conditions are superseded by the <newConditions> (depending on the condition type).

func NewInstallationReferenceState

func NewInstallationReferenceState(name string, inst *landscaperv1alpha1.Installation) landscaperv1alpha1.NamedObjectReference

NewInstallationReferenceState creates a new installation reference state from a given installation

func ObjectFromDataObjectSource

func ObjectFromDataObjectSource(src string) (string, lsv1alpha1.ObjectReference, error)

ObjectFromDataObjectSource parses the source's kind, namespace and name from a src string.

func ObjectReferenceFromObject

func ObjectReferenceFromObject(obj metav1.Object) v1alpha1.ObjectReference

ObjectReferenceFromObject creates a object reference from a k8s object

func ReferenceIsObject

func ReferenceIsObject(ref v1alpha1.ObjectReference, obj metav1.Object) bool

ReferenceIsObject checks if the reference describes the given object.

func RemoveVersionedNamedObjectReference

func RemoveVersionedNamedObjectReference(objects []v1alpha1.VersionedNamedObjectReference, name string) []v1alpha1.VersionedNamedObjectReference

RemoveVersionedNamedObjectReference removes the first versioned object reference with the given name.

func SetCacheHelmChartsAnnotation added in v0.104.0

func SetCacheHelmChartsAnnotation(obj *metav1.ObjectMeta)

func SetDeployItemToFailed

func SetDeployItemToFailed(di *v1alpha1.DeployItem) v1alpha1.DeployItemPhase

SetDeployItemToFailed sets status.phase of the DeployItem to a failure phase If the DeployItem has a DeletionTimestamp, 'DeleteFailed' is used, otherwise it will be set to 'Failed'. Afterwards, the set phase is returned. Will do nothing and return an empty string if given a nil pointer.

func SetOperation

func SetOperation(obj *metav1.ObjectMeta, op v1alpha1.Operation)

SetOperation sets the given operation annotation on aa object.

func SetTimestampAnnotationNow

func SetTimestampAnnotationNow(obj *metav1.ObjectMeta, ta TimestampAnnotation)

SetTimestampAnnotationNow sets the timeout annotation with the current timestamp.

func SetVersionedNamedObjectReference

SetVersionedNamedObjectReference sets the versioned object reference with the given name.

func Touch

func Touch(obj *metav1.ObjectMeta)

func UpdatedCondition

func UpdatedCondition(condition v1alpha1.Condition, status v1alpha1.ConditionStatus, reason, message string, codes ...v1alpha1.ErrorCode) v1alpha1.Condition

UpdatedCondition updates the properties of one specific condition.

Types

type TimestampAnnotation

type TimestampAnnotation string

Jump to

Keyboard shortcuts

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