helper

package
v0.0.0-...-1764fb8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Now = metav1.Now

Now determines the current metav1.Time.

Functions

func ComputeOperationType

func ComputeOperationType(meta metav1.ObjectMeta, lastOperation *gardencorev1alpha1.LastOperation) gardencorev1alpha1.LastOperationType

ComputeOperationType checksthe <lastOperation> and determines whether is it is Create operation or reconcile operation

func ConditionsNeedUpdate

func ConditionsNeedUpdate(existingConditions, newConditions []gardencorev1alpha1.Condition) bool

ConditionsNeedUpdate returns true if the <existingConditions> must be updated based on <newConditions>.

func DetermineError

func DetermineError(message string) error

DetermineError determines the Garden error code for the given error message.

func ExtractErrorCodes

func ExtractErrorCodes(err error) []gardencorev1alpha1.ErrorCode

ExtractErrorCodes extracts all error codes from the given error by using utils.Errors

func FormatLastErrDescription

func FormatLastErrDescription(err error) string

FormatLastErrDescription formats the error message string for the last occurred error.

func GetCondition

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 GetOrInitCondition

func GetOrInitCondition(conditions []gardencorev1alpha1.Condition, conditionType gardencorev1alpha1.ConditionType) gardencorev1alpha1.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 InitCondition

func InitCondition(conditionType gardencorev1alpha1.ConditionType) gardencorev1alpha1.Condition

InitCondition initializes a new Condition with an Unknown status.

func IsControllerInstallationSuccessful

func IsControllerInstallationSuccessful(controllerInstallation gardencorev1alpha1.ControllerInstallation) bool

IsControllerInstallationSuccessful returns true if a ControllerInstallation has been marked as "successfully" installed.

func IsResourceSupported

func IsResourceSupported(resources []gardencorev1alpha1.ControllerResource, resourceKind, resourceType string) bool

IsResourceSupported returns true if a given combination of kind/type is part of a controller resources list.

func MergeConditions

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

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

func NewConditions

func NewConditions(conditions []gardencorev1alpha1.Condition, conditionTypes ...gardencorev1alpha1.ConditionType) []*gardencorev1alpha1.Condition

NewConditions initializes the provided conditions based on an existing list. If a condition type does not exist in the list yet, it will be set to default values.

func NewErrorWithCode

func NewErrorWithCode(code gardencorev1alpha1.ErrorCode, message string) error

NewErrorWithCode creates a new error that additionally exposes the given code via the Coder interface.

func UpdatedCondition

func UpdatedCondition(condition gardencorev1alpha1.Condition, status gardencorev1alpha1.ConditionStatus, reason, message string) gardencorev1alpha1.Condition

UpdatedCondition updates the properties of one specific condition.

func UpdatedConditionUnknownError

func UpdatedConditionUnknownError(condition gardencorev1alpha1.Condition, err error) gardencorev1alpha1.Condition

func UpdatedConditionUnknownErrorMessage

func UpdatedConditionUnknownErrorMessage(condition gardencorev1alpha1.Condition, message string) gardencorev1alpha1.Condition

Types

type Coder

type Coder interface {
	error
	Code() gardencorev1alpha1.ErrorCode
}

Coder is an error that may produce an ErrorCode visible to the outside.

Jump to

Keyboard shortcuts

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