helper

package
v1.86.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 21 Imported by: 57

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTypeToSecretBinding added in v1.38.0

func AddTypeToSecretBinding(secretBinding *gardencorev1beta1.SecretBinding, providerType string)

AddTypeToSecretBinding adds the given provider type to the SecretBinding.

func AnonymousAuthenticationEnabled added in v1.68.0

func AnonymousAuthenticationEnabled(kubeAPIServerConfig *gardencorev1beta1.KubeAPIServerConfig) bool

AnonymousAuthenticationEnabled returns true if anonymous authentication is set explicitly to 'true' and false otherwise.

func BackupBucketIsErroneous added in v1.18.0

func BackupBucketIsErroneous(bb *gardencorev1beta1.BackupBucket) (bool, string)

BackupBucketIsErroneous returns `true` if the given BackupBucket has a last error. It also returns the error description if available.

func BuildConditions added in v1.76.0

func BuildConditions(baseConditions, newConditions []gardencorev1beta1.Condition, removeConditionTypes []gardencorev1beta1.ConditionType) []gardencorev1beta1.Condition

BuildConditions builds and returns the conditions using the given conditions as a base, by first removing all conditions with the given types and then merging the given new conditions (which must be of the same types).

func CalculateEffectiveKubernetesVersion added in v1.37.0

func CalculateEffectiveKubernetesVersion(controlPlaneVersion *semver.Version, workerKubernetes *gardencorev1beta1.WorkerKubernetes) (*semver.Version, error)

CalculateEffectiveKubernetesVersion if a shoot has kubernetes version specified by worker group, return this, otherwise the shoot kubernetes version

func CalculateSeedUsage added in v1.32.0

func CalculateSeedUsage(shootList []gardencorev1beta1.Shoot) map[string]int

CalculateSeedUsage returns a map representing the number of shoots per seed from the given list of shoots. It takes both spec.seedName and status.seedName into account.

func ComputeOperationType

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

ComputeOperationType checks the <lastOperation> and determines whether it is Create, Delete, Reconcile, Migrate or Restore operation

func ConditionsNeedUpdate

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

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

func DeleteLastErrorByTaskID added in v1.5.1

func DeleteLastErrorByTaskID(lastErrors []gardencorev1beta1.LastError, taskID string) []gardencorev1beta1.LastError

DeleteLastErrorByTaskID removes the 'last error' with the given task ID from the given 'last error' list.

func DetermineMachineImageForName

func DetermineMachineImageForName(cloudProfile *gardencorev1beta1.CloudProfile, name string) (bool, gardencorev1beta1.MachineImage)

DetermineMachineImageForName finds the cloud specific machine images in the <cloudProfile> for the given <name> and region. In case it does not find the machine image with the <name>, it returns false. Otherwise, true and the cloud-specific machine image will be returned.

func ExtractErrorCodes

func ExtractErrorCodes(err error) []gardencorev1beta1.ErrorCode

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

func FailedCondition added in v1.79.0

func FailedCondition(
	clock clock.Clock,
	lastOperation *gardencorev1beta1.LastOperation,
	conditionThresholds map[gardencorev1beta1.ConditionType]time.Duration,
	condition gardencorev1beta1.Condition,
	reason string,
	message string,
	codes ...gardencorev1beta1.ErrorCode,
) gardencorev1beta1.Condition

FailedCondition returns a progressing or false condition depending on the progressing threshold.

func FilterDeprecatedVersion added in v1.24.3

func FilterDeprecatedVersion() func(expirableVersion gardencorev1beta1.ExpirableVersion, version *semver.Version) (bool, error)

FilterDeprecatedVersion returns a closure that evaluates whether a given expirable version is deprecated returns true if it is deprecated

func FilterExpiredVersion added in v1.4.0

func FilterExpiredVersion() func(expirableVersion gardencorev1beta1.ExpirableVersion, version *semver.Version) (bool, error)

FilterExpiredVersion returns a closure that evaluates whether a given expirable version is expired returns true if it is expired

func FindMachineImageVersion added in v1.56.0

func FindMachineImageVersion(machineImages []gardencorev1beta1.MachineImage, name, version string) (gardencorev1beta1.MachineImageVersion, bool)

FindMachineImageVersion finds the machine image version in the <cloudProfile> for the given <name> and <version>. In case no machine image version can be found with the given <name> or <version>, false is being returned.

func FindMachineTypeByName added in v1.38.0

func FindMachineTypeByName(machines []gardencorev1beta1.MachineType, name string) *gardencorev1beta1.MachineType

FindMachineTypeByName tries to find the machine type details with the given name. If it cannot be found it returns nil.

func FindPrimaryDNSProvider added in v1.1.0

func FindPrimaryDNSProvider(providers []gardencorev1beta1.DNSProvider) *gardencorev1beta1.DNSProvider

FindPrimaryDNSProvider finds the primary provider among the given `providers`. It returns the first provider if multiple candidates are found.

func FormatLastErrDescription

func FormatLastErrDescription(err error) string

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

func GetCondition

func GetCondition(conditions []gardencorev1beta1.Condition, conditionType gardencorev1beta1.ConditionType) *gardencorev1beta1.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 GetDefaultMachineImageFromCloudProfile

func GetDefaultMachineImageFromCloudProfile(profile gardencorev1beta1.CloudProfile) *gardencorev1beta1.MachineImage

GetDefaultMachineImageFromCloudProfile gets the first MachineImage from the CloudProfile

func GetFailureToleranceType added in v1.56.0

func GetFailureToleranceType(shoot *gardencorev1beta1.Shoot) *gardencorev1beta1.FailureToleranceType

GetFailureToleranceType determines the failure tolerance type of the given shoot.

func GetLatestQualifyingVersion added in v1.4.0

func GetLatestQualifyingVersion(versions []gardencorev1beta1.ExpirableVersion, predicate ...VersionPredicate) (qualifyingVersionFound bool, latest *gardencorev1beta1.ExpirableVersion, err error)

GetLatestQualifyingVersion returns the latest expirable version from a set of expirable versions. A version qualifies if its classification is not preview and the optional predicate does not filter out the version. If the predicate returns true, the version is not considered for the latest qualifying version.

func GetLatestVersionForMinorAutoUpdate added in v1.83.0

func GetLatestVersionForMinorAutoUpdate(versions []gardencorev1beta1.ExpirableVersion, currentVersion string) (bool, string, error)

GetLatestVersionForMinorAutoUpdate finds the latest minor with the latest patch version higher than a given <currentVersion> for the current major version from a given slice of versions. Returns the highest patch version for the current minor in case the current version is not the highest patch version yet. The current version, preview and expired versions do not qualify. In case no newer version is found, returns false and an empty string. Otherwise, returns true and the found version.

func GetLatestVersionForPatchAutoUpdate added in v1.83.0

func GetLatestVersionForPatchAutoUpdate(versions []gardencorev1beta1.ExpirableVersion, currentVersion string) (bool, string, error)

GetLatestVersionForPatchAutoUpdate finds the latest patch version for a given <currentVersion> for the current minor version from a given slice of versions. The current version, preview and expired versions do not qualify. In case no newer patch version is found, returns false and an empty string. Otherwise, returns true and the found version.

func GetNodeLocalDNS added in v1.60.0

func GetNodeLocalDNS(systemComponents *gardencorev1beta1.SystemComponents) *gardencorev1beta1.NodeLocalDNS

GetNodeLocalDNS returns a pointer to the NodeLocalDNS spec.

func GetOrInitConditionWithClock added in v1.58.0

func GetOrInitConditionWithClock(clock clock.Clock, conditions []gardencorev1beta1.Condition, conditionType gardencorev1beta1.ConditionType) gardencorev1beta1.Condition

GetOrInitConditionWithClock 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. It allows passing a custom clock for testing.

func GetOverallLatestVersionForAutoUpdate added in v1.83.0

func GetOverallLatestVersionForAutoUpdate(versions []gardencorev1beta1.ExpirableVersion, currentVersion string) (bool, string, error)

GetOverallLatestVersionForAutoUpdate finds the overall latest version higher than a given <currentVersion> for the current major version from a given slice of versions. Returns the highest patch version for the current minor in case the current version is not the highest patch version yet. The current, preview and expired versions do not qualify. In case no newer version is found, returns false and an empty string. Otherwise, returns true and the found version.

func GetPurpose added in v1.15.0

GetPurpose returns the purpose of the shoot or 'evaluation' if it's nil.

func GetQualifyingVersionForNextHigher added in v1.83.0

func GetQualifyingVersionForNextHigher(versions []gardencorev1beta1.ExpirableVersion, majorOrMinor GetMajorOrMinor, currentSemVerVersion *semver.Version, predicates ...VersionPredicate) (qualifyingVersionFound bool, qualifyingVersion *gardencorev1beta1.ExpirableVersion, nextMinorOrMajor int64, err error)

GetQualifyingVersionForNextHigher returns the latest expirable version for the next higher {minor/major} (not necessarily consecutive n+1) version from a set of expirable versions. A version qualifies if its classification is not preview and the optional predicate does not filter out the version. If the predicate returns true, the version is not considered for the latest qualifying version.

func GetResourceByName added in v1.5.0

GetResourceByName returns the NamedResourceReference with the given name in the given slice, or nil if not found.

func GetSecretBindingTypes added in v1.38.0

func GetSecretBindingTypes(secretBinding *gardencorev1beta1.SecretBinding) []string

GetSecretBindingTypes returns the SecretBinding provider types.

func GetShootAuditPolicyConfigMapName added in v1.37.7

func GetShootAuditPolicyConfigMapName(apiServerConfig *gardencorev1beta1.KubeAPIServerConfig) string

GetShootAuditPolicyConfigMapName returns the Shoot's ConfigMap reference name for the audit policy.

func GetShootAuditPolicyConfigMapRef added in v1.37.7

func GetShootAuditPolicyConfigMapRef(apiServerConfig *gardencorev1beta1.KubeAPIServerConfig) *corev1.ObjectReference

GetShootAuditPolicyConfigMapRef returns the Shoot's ConfigMap reference for the audit policy.

func GetShootCARotationPhase added in v1.42.0

GetShootCARotationPhase returns the specified shoot CA rotation phase or an empty string

func GetShootETCDEncryptionKeyRotationPhase added in v1.48.0

func GetShootETCDEncryptionKeyRotationPhase(credentials *gardencorev1beta1.ShootCredentials) gardencorev1beta1.CredentialsRotationPhase

GetShootETCDEncryptionKeyRotationPhase returns the specified shoot ETCD encryption key rotation phase or an empty string.

func GetShootServiceAccountKeyRotationPhase added in v1.48.0

func GetShootServiceAccountKeyRotationPhase(credentials *gardencorev1beta1.ShootCredentials) gardencorev1beta1.CredentialsRotationPhase

GetShootServiceAccountKeyRotationPhase returns the specified shoot service account key rotation phase or an empty string.

func GetVersionForForcefulUpdateToConsecutiveMinor added in v1.83.0

func GetVersionForForcefulUpdateToConsecutiveMinor(versions []gardencorev1beta1.ExpirableVersion, currentVersion string) (bool, string, error)

GetVersionForForcefulUpdateToConsecutiveMinor finds a version from a slice of expirable versions that qualifies for a minor level update given a <currentVersion>. A qualifying version is a non-preview version having the minor version increased by exactly one version (required for Kubernetes version upgrades). In case the consecutive minor version has only expired versions, picks the latest expired version (will try another update during the next maintenance time). If a version can be found, returns true and the qualifying patch version of the next minor version. In case it does not find a version, it returns false and an empty string.

func GetVersionForForcefulUpdateToNextHigherMajor added in v1.83.0

func GetVersionForForcefulUpdateToNextHigherMajor(versions []gardencorev1beta1.ExpirableVersion, currentVersion string) (bool, string, error)

GetVersionForForcefulUpdateToNextHigherMajor finds a version from a slice of expirable versions that qualifies for a major level update given a <currentVersion>. A qualifying version is a non-preview version with the next (as defined in the CloudProfile for the image) higher major version. In case the next major version has only expired versions, picks the latest expired version (will try another update during the next maintenance time). If a version can be found, returns true and the qualifying version of the next major version. In case it does not find a version, it returns false and an empty string.

func GetVersionForForcefulUpdateToNextHigherMinor added in v1.83.0

func GetVersionForForcefulUpdateToNextHigherMinor(versions []gardencorev1beta1.ExpirableVersion, currentVersion string) (bool, string, error)

GetVersionForForcefulUpdateToNextHigherMinor finds a version from a slice of expirable versions that qualifies for a minor level update given a <currentVersion>. A qualifying version is the highest non-preview version with the next higher minor version from the given slice of versions. In case the consecutive minor version has only expired versions, picks the latest expired version (will try another update during the next maintenance time). If a version can be found, returns true and the qualifying version. In case it does not find a version, it returns false and an empty string.

func HasErrorCode added in v1.22.0

func HasErrorCode(lastErrors []gardencorev1beta1.LastError, code gardencorev1beta1.ErrorCode) bool

HasErrorCode checks whether at least one LastError from the given slice of LastErrors <lastErrors> contains the given ErrorCode <code>.

func HasNonRetryableErrorCode added in v1.5.0

func HasNonRetryableErrorCode(lastErrors ...gardencorev1beta1.LastError) bool

HasNonRetryableErrorCode returns true if at least one of given list of last errors has at least one error code that indicates that an automatic retry would not help fixing the problem.

func HasOperationAnnotation added in v1.31.0

func HasOperationAnnotation(annotations map[string]string) bool

HasOperationAnnotation returns true if the operation annotation is present and its value is "reconcile", "restore, or "migrate".

func HibernationIsEnabled

func HibernationIsEnabled(shoot *gardencorev1beta1.Shoot) bool

HibernationIsEnabled checks if the given shoot's desired state is hibernated.

func InitConditionWithClock added in v1.58.0

func InitConditionWithClock(clock clock.Clock, conditionType gardencorev1beta1.ConditionType) gardencorev1beta1.Condition

InitConditionWithClock initializes a new Condition with an Unknown status. It allows passing a custom clock for testing.

func IsControllerInstallationRequired added in v1.5.0

func IsControllerInstallationRequired(controllerInstallation gardencorev1beta1.ControllerInstallation) bool

IsControllerInstallationRequired returns true if a ControllerInstallation has been marked as "required".

func IsControllerInstallationSuccessful

func IsControllerInstallationSuccessful(controllerInstallation gardencorev1beta1.ControllerInstallation) bool

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

func IsCoreDNSAutoscalingModeUsed added in v1.41.0

func IsCoreDNSAutoscalingModeUsed(systemComponents *gardencorev1beta1.SystemComponents, autoscalingMode gardencorev1beta1.CoreDNSAutoscalingMode) bool

IsCoreDNSAutoscalingModeUsed indicates whether the specified autoscaling mode of CoreDNS is enabled or not.

func IsCoreDNSRewritingEnabled added in v1.55.0

func IsCoreDNSRewritingEnabled(featureGate bool, annotations map[string]string) bool

IsCoreDNSRewritingEnabled indicates whether automatic query rewriting in CoreDNS is enabled or not.

func IsFailureToleranceTypeNode added in v1.56.0

func IsFailureToleranceTypeNode(failureToleranceType *gardencorev1beta1.FailureToleranceType) bool

IsFailureToleranceTypeNode returns true if failureToleranceType is node else returns false.

func IsFailureToleranceTypeZone added in v1.56.0

func IsFailureToleranceTypeZone(failureToleranceType *gardencorev1beta1.FailureToleranceType) bool

IsFailureToleranceTypeZone returns true if failureToleranceType is zone else returns false.

func IsHAControlPlaneConfigured added in v1.56.0

func IsHAControlPlaneConfigured(shoot *gardencorev1beta1.Shoot) bool

IsHAControlPlaneConfigured returns true if HA configuration for the shoot control plane has been set.

func IsMultiZonalShootControlPlane added in v1.56.0

func IsMultiZonalShootControlPlane(shoot *gardencorev1beta1.Shoot) bool

IsMultiZonalShootControlPlane checks if the shoot should have a multi-zonal control plane.

func IsNodeLocalDNSEnabled added in v1.49.0

func IsNodeLocalDNSEnabled(systemComponents *gardencorev1beta1.SystemComponents) bool

IsNodeLocalDNSEnabled indicates whether the node local DNS cache is enabled or not.

func IsPSPDisabled added in v1.52.0

func IsPSPDisabled(shoot *gardencorev1beta1.Shoot) bool

IsPSPDisabled returns true if the PodSecurityPolicy plugin is explicitly disabled in the ShootSpec or the cluster version is >= 1.25.

func IsResourceSupported

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

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

func IsShootKubeconfigRotationInitiationTimeAfterLastCompletionTime added in v1.43.0

func IsShootKubeconfigRotationInitiationTimeAfterLastCompletionTime(credentials *gardencorev1beta1.ShootCredentials) bool

IsShootKubeconfigRotationInitiationTimeAfterLastCompletionTime returns true when the lastInitiationTime in the .status.credentials.rotation.kubeconfig field is newer than the lastCompletionTime. This is also true if the lastCompletionTime is unset.

func IsShootObservabilityRotationInitiationTimeAfterLastCompletionTime added in v1.47.0

func IsShootObservabilityRotationInitiationTimeAfterLastCompletionTime(credentials *gardencorev1beta1.ShootCredentials) bool

IsShootObservabilityRotationInitiationTimeAfterLastCompletionTime returns true when the lastInitiationTime in the .status.credentials.rotation.observability field is newer than the lastCompletionTime. This is also true if the lastCompletionTime is unset.

func IsShootSSHKeypairRotationInitiationTimeAfterLastCompletionTime added in v1.43.0

func IsShootSSHKeypairRotationInitiationTimeAfterLastCompletionTime(credentials *gardencorev1beta1.ShootCredentials) bool

IsShootSSHKeypairRotationInitiationTimeAfterLastCompletionTime returns true when the lastInitiationTime in the .status.credentials.rotation.sshKeypair field is newer than the lastCompletionTime. This is also true if the lastCompletionTime is unset.

func IsTopologyAwareRoutingForShootControlPlaneEnabled added in v1.66.0

func IsTopologyAwareRoutingForShootControlPlaneEnabled(seed *gardencorev1beta1.Seed, shoot *gardencorev1beta1.Shoot) bool

IsTopologyAwareRoutingForShootControlPlaneEnabled returns whether the topology aware routing is enabled for the given Shoot control plane. Topology-aware routing is enabled when the corresponding Seed setting is enabled and the Shoot has a multi-zonal control plane.

func IsWorkerless added in v1.70.0

func IsWorkerless(shoot *gardencorev1beta1.Shoot) bool

IsWorkerless checks if the shoot has zero workers.

func KubeProxyEnabled added in v1.41.0

func KubeProxyEnabled(config *gardencorev1beta1.KubeProxyConfig) bool

KubeProxyEnabled returns true if the kube-proxy is enabled in the Shoot manifest.

func KubernetesDashboardEnabled added in v1.15.0

func KubernetesDashboardEnabled(addons *gardencorev1beta1.Addons) bool

KubernetesDashboardEnabled returns true if the kubernetes-dashboard addon is enabled in the Shoot manifest.

func KubernetesVersionExistsInCloudProfile

func KubernetesVersionExistsInCloudProfile(cloudProfile *gardencorev1beta1.CloudProfile, currentVersion string) (bool, gardencorev1beta1.ExpirableVersion, error)

KubernetesVersionExistsInCloudProfile checks if the given Kubernetes version exists in the CloudProfile

func LastError

func LastError(description string, codes ...gardencorev1beta1.ErrorCode) *gardencorev1beta1.LastError

LastError creates a new LastError with the given description, optional codes and sets timestamp when the error is lastly observed.

func LastErrorWithTaskID

func LastErrorWithTaskID(description string, taskID string, codes ...gardencorev1beta1.ErrorCode) *gardencorev1beta1.LastError

LastErrorWithTaskID creates a new LastError with the given description, the ID of the task when the error occurred, optional codes and sets timestamp when the error is lastly observed.

func MergeConditions

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

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

func MutateObservabilityRotation added in v1.47.0

func MutateObservabilityRotation(shoot *gardencorev1beta1.Shoot, f func(*gardencorev1beta1.ObservabilityRotation))

MutateObservabilityRotation mutates the .status.credentials.rotation.observability field based on the provided mutation function. If the field is nil then it is initialized.

func MutateShootCARotation added in v1.43.0

func MutateShootCARotation(shoot *gardencorev1beta1.Shoot, f func(*gardencorev1beta1.CARotation))

MutateShootCARotation mutates the .status.credentials.rotation.certificateAuthorities field based on the provided mutation function. If the field is nil then it is initialized.

func MutateShootETCDEncryptionKeyRotation added in v1.48.0

func MutateShootETCDEncryptionKeyRotation(shoot *gardencorev1beta1.Shoot, f func(*gardencorev1beta1.ETCDEncryptionKeyRotation))

MutateShootETCDEncryptionKeyRotation mutates the .status.credentials.rotation.etcdEncryptionKey field based on the provided mutation function. If the field is nil then it is initialized.

func MutateShootKubeconfigRotation added in v1.43.0

func MutateShootKubeconfigRotation(shoot *gardencorev1beta1.Shoot, f func(*gardencorev1beta1.ShootKubeconfigRotation))

MutateShootKubeconfigRotation mutates the .status.credentials.rotation.kubeconfig field based on the provided mutation function. If the field is nil then it is initialized.

func MutateShootSSHKeypairRotation added in v1.43.0

func MutateShootSSHKeypairRotation(shoot *gardencorev1beta1.Shoot, f func(*gardencorev1beta1.ShootSSHKeypairRotation))

MutateShootSSHKeypairRotation mutates the .status.credentials.rotation.sshKeypair field based on the provided mutation function. If the field is nil then it is initialized.

func MutateShootServiceAccountKeyRotation added in v1.48.0

func MutateShootServiceAccountKeyRotation(shoot *gardencorev1beta1.Shoot, f func(*gardencorev1beta1.ServiceAccountKeyRotation))

MutateShootServiceAccountKeyRotation mutates the .status.credentials.rotation.serviceAccountKey field based on the provided mutation function. If the field is nil then it is initialized.

func NewConditionOrError added in v1.79.0

func NewConditionOrError(clock clock.Clock, oldCondition gardencorev1beta1.Condition, newCondition *gardencorev1beta1.Condition, err error) gardencorev1beta1.Condition

NewConditionOrError returns the given new condition or returns an unknown error condition if an error occurred or `newCondition` is nil.

func NewErrorWithCodes added in v1.4.0

func NewErrorWithCodes(err error, codes ...gardencorev1beta1.ErrorCode) error

NewErrorWithCodes creates a new error that additionally exposes the given codes via the Coder interface.

func NginxIngressEnabled added in v1.15.0

func NginxIngressEnabled(addons *gardencorev1beta1.Addons) bool

NginxIngressEnabled returns true if the nginx-ingress addon is enabled in the Shoot manifest.

func RemoveConditions added in v1.37.0

func RemoveConditions(conditions []gardencorev1beta1.Condition, conditionTypes ...gardencorev1beta1.ConditionType) []gardencorev1beta1.Condition

RemoveConditions removes the conditions with the given types from the given conditions slice.

func RetainConditions added in v1.84.0

func RetainConditions(conditions []gardencorev1beta1.Condition, conditionTypes ...gardencorev1beta1.ConditionType) []gardencorev1beta1.Condition

RetainConditions retains all given conditionsTypes from the given conditions slice.

func SecretBindingHasType added in v1.38.0

func SecretBindingHasType(secretBinding *gardencorev1beta1.SecretBinding, providerType string) bool

SecretBindingHasType checks if the given SecretBinding has the given provider type.

func SeedBackupSecretRefEqual added in v1.19.0

func SeedBackupSecretRefEqual(oldBackup, newBackup *gardencorev1beta1.SeedBackup) bool

SeedBackupSecretRefEqual returns true when the secret reference of the backup configuration is the same.

func SeedSettingDependencyWatchdogProberEnabled added in v1.67.0

func SeedSettingDependencyWatchdogProberEnabled(settings *gardencorev1beta1.SeedSettings) bool

SeedSettingDependencyWatchdogProberEnabled returns true if the dependency-watchdog-prober is enabled.

func SeedSettingDependencyWatchdogWeederEnabled added in v1.67.0

func SeedSettingDependencyWatchdogWeederEnabled(settings *gardencorev1beta1.SeedSettings) bool

SeedSettingDependencyWatchdogWeederEnabled returns true if the dependency-watchdog-weeder is enabled.

func SeedSettingExcessCapacityReservationEnabled added in v1.79.0

func SeedSettingExcessCapacityReservationEnabled(settings *gardencorev1beta1.SeedSettings) bool

SeedSettingExcessCapacityReservationEnabled returns true if the 'excess capacity reservation' setting is enabled.

func SeedSettingTopologyAwareRoutingEnabled added in v1.66.0

func SeedSettingTopologyAwareRoutingEnabled(settings *gardencorev1beta1.SeedSettings) bool

SeedSettingTopologyAwareRoutingEnabled returns true if the topology-aware routing is enabled.

func SeedSettingVerticalPodAutoscalerEnabled added in v1.18.0

func SeedSettingVerticalPodAutoscalerEnabled(settings *gardencorev1beta1.SeedSettings) bool

SeedSettingVerticalPodAutoscalerEnabled returns true if the 'verticalPodAutoscaler' setting is enabled.

func SetMachineImageVersionsToMachineImage

func SetMachineImageVersionsToMachineImage(machineImages []gardencorev1beta1.MachineImage, imageName string, imageVersions []gardencorev1beta1.MachineImageVersion) ([]gardencorev1beta1.MachineImage, error)

SetMachineImageVersionsToMachineImage sets imageVersions to the matching imageName in the machineImages.

func ShootConfinesSpecUpdateRollout added in v1.62.0

func ShootConfinesSpecUpdateRollout(maintenance *gardencorev1beta1.Maintenance) bool

ShootConfinesSpecUpdateRollout returns a bool.

func ShootDNSProviderSecretNamesEqual added in v1.19.0

func ShootDNSProviderSecretNamesEqual(oldDNS, newDNS *gardencorev1beta1.DNS) bool

ShootDNSProviderSecretNamesEqual returns true when all the secretNames in the `.spec.dns.providers[]` list are the same.

func ShootEnablesSSHAccess added in v1.63.0

func ShootEnablesSSHAccess(shoot *gardencorev1beta1.Shoot) bool

ShootEnablesSSHAccess returns true if ssh access to worker nodes should be allowed for the given shoot.

func ShootHasOperationType added in v1.74.0

func ShootHasOperationType(lastOperation *gardencorev1beta1.LastOperation, lastOperationType gardencorev1beta1.LastOperationType) bool

ShootHasOperationType returns true when the 'type' in the last operation matches the provided type.

func ShootIgnoresAlerts

func ShootIgnoresAlerts(shoot *gardencorev1beta1.Shoot) bool

ShootIgnoresAlerts checks if the alerts for the annotated shoot cluster should be ignored.

func ShootMachineImageVersionExists

func ShootMachineImageVersionExists(constraint gardencorev1beta1.MachineImage, image gardencorev1beta1.ShootMachineImage) (bool, int)

ShootMachineImageVersionExists checks if the shoot machine image (name, version) exists in the machine image constraint and returns true if yes and the index in the versions slice

func ShootNeedsForceDeletion added in v1.81.0

func ShootNeedsForceDeletion(shoot *gardencorev1beta1.Shoot) bool

ShootNeedsForceDeletion determines whether a Shoot should be force deleted or not.

func ShootResourceReferencesEqual added in v1.72.0

func ShootResourceReferencesEqual(oldResources, newResources []gardencorev1beta1.NamedResourceReference) bool

ShootResourceReferencesEqual returns true when at least one of the Secret/ConfigMap resource references inside a Shoot has been changed.

func ShootSchedulingProfile added in v1.51.0

func ShootSchedulingProfile(shoot *gardencorev1beta1.Shoot) *gardencorev1beta1.SchedulingProfile

ShootSchedulingProfile returns the scheduling profile of the given Shoot.

func ShootUsesUnmanagedDNS added in v0.34.0

func ShootUsesUnmanagedDNS(shoot *gardencorev1beta1.Shoot) bool

ShootUsesUnmanagedDNS returns true if the shoot's DNS section is marked as 'unmanaged'.

func ShootWantsAlertManager added in v1.15.0

func ShootWantsAlertManager(shoot *gardencorev1beta1.Shoot) bool

ShootWantsAlertManager checks if the given shoot specification requires an alert manager.

func ShootWantsClusterAutoscaler

func ShootWantsClusterAutoscaler(shoot *gardencorev1beta1.Shoot) (bool, error)

ShootWantsClusterAutoscaler checks if the given Shoot needs a cluster autoscaler. This is determined by checking whether one of the Shoot workers has a different Maximum than Minimum.

func ShootWantsVerticalPodAutoscaler added in v1.7.0

func ShootWantsVerticalPodAutoscaler(shoot *gardencorev1beta1.Shoot) bool

ShootWantsVerticalPodAutoscaler checks if the given Shoot needs a VPA.

func SystemComponentsAllowed added in v1.7.0

func SystemComponentsAllowed(worker *gardencorev1beta1.Worker) bool

SystemComponentsAllowed checks if the given worker allows system components to be scheduled onto it

func TaintsAreTolerated added in v1.6.0

func TaintsAreTolerated(taints []gardencorev1beta1.SeedTaint, tolerations []gardencorev1beta1.Toleration) bool

TaintsAreTolerated returns true when all the given taints are tolerated by the given tolerations.

func TaintsHave

func TaintsHave(taints []gardencorev1beta1.SeedTaint, key string) bool

TaintsHave returns true if the given key is part of the taints list.

func ToExpirableVersions added in v1.83.0

ToExpirableVersions returns the expirable versions from the given machine image versions.

func UpdatedConditionUnknownErrorMessageWithClock added in v1.58.0

func UpdatedConditionUnknownErrorMessageWithClock(clock clock.Clock, condition gardencorev1beta1.Condition, message string, codes ...gardencorev1beta1.ErrorCode) gardencorev1beta1.Condition

UpdatedConditionUnknownErrorMessageWithClock updates the condition with 'Unknown' status and the given message. It allows passing a custom clock for testing.

func UpdatedConditionUnknownErrorWithClock added in v1.58.0

func UpdatedConditionUnknownErrorWithClock(clock clock.Clock, condition gardencorev1beta1.Condition, err error, codes ...gardencorev1beta1.ErrorCode) gardencorev1beta1.Condition

UpdatedConditionUnknownErrorWithClock updates the condition to 'Unknown' status and the message of the given error. It allows passing a custom clock for testing.

func UpdatedConditionWithClock added in v1.58.0

func UpdatedConditionWithClock(clock clock.Clock, condition gardencorev1beta1.Condition, status gardencorev1beta1.ConditionStatus, reason, message string, codes ...gardencorev1beta1.ErrorCode) gardencorev1beta1.Condition

UpdatedConditionWithClock updates the properties of one specific condition. It allows passing a custom clock for testing.

func UpsertLastError added in v1.5.1

func UpsertLastError(lastErrors []gardencorev1beta1.LastError, lastError gardencorev1beta1.LastError) []gardencorev1beta1.LastError

UpsertLastError adds a 'last error' to the given list of existing 'last errors' if it does not exist yet. Otherwise, it updates it.

func WrapWithLastError added in v0.34.0

func WrapWithLastError(err error, lastError *gardencorev1beta1.LastError) error

WrapWithLastError is wrapper function for gardencorev1beta1.LastError

Types

type Coder

type Coder interface {
	error
	Codes() []gardencorev1beta1.ErrorCode
}

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

type ConditionBuilder added in v0.34.0

type ConditionBuilder interface {
	WithOldCondition(old gardencorev1beta1.Condition) ConditionBuilder
	WithStatus(status gardencorev1beta1.ConditionStatus) ConditionBuilder
	WithReason(reason string) ConditionBuilder
	WithMessage(message string) ConditionBuilder
	WithCodes(codes ...gardencorev1beta1.ErrorCode) ConditionBuilder
	WithClock(clock clock.Clock) ConditionBuilder
	Build() (new gardencorev1beta1.Condition, updated bool)
}

ConditionBuilder build a Condition.

func NewConditionBuilder added in v0.34.0

func NewConditionBuilder(conditionType gardencorev1beta1.ConditionType) (ConditionBuilder, error)

NewConditionBuilder returns a ConditionBuilder for a specific condition.

type ErrorWithCodes added in v1.5.1

type ErrorWithCodes struct {
	// contains filtered or unexported fields
}

ErrorWithCodes contains the error and Gardener error codes.

func (*ErrorWithCodes) Codes added in v1.5.1

Codes returns all error codes.

func (*ErrorWithCodes) Error added in v1.5.1

func (e *ErrorWithCodes) Error() string

Error returns the error message.

func (*ErrorWithCodes) Retriable added in v1.25.0

func (e *ErrorWithCodes) Retriable()

Retriable marks ErrorWithCodes as retriable.

func (*ErrorWithCodes) Unwrap added in v1.47.0

func (e *ErrorWithCodes) Unwrap() error

Unwrap rettieves the error from ErrorWithCodes.

type ExtensionResourceStateList added in v1.65.0

type ExtensionResourceStateList []gardencorev1beta1.ExtensionResourceState

ExtensionResourceStateList is a list of ExtensionResourceStates

func (*ExtensionResourceStateList) Delete added in v1.65.0

func (e *ExtensionResourceStateList) Delete(kind string, name, purpose *string)

Delete removes an ExtensionResourceState from the list by kind, name and purpose

func (*ExtensionResourceStateList) Get added in v1.65.0

Get retrieves an ExtensionResourceState for given kind, name and purpose from a list of ExtensionResourceStates If no ExtensionResourceStates can be found, nil is returned.

func (*ExtensionResourceStateList) Upsert added in v1.65.0

func (e *ExtensionResourceStateList) Upsert(extensionResourceState *gardencorev1beta1.ExtensionResourceState)

Upsert either inserts or updates an already existing ExtensionResourceState with kind, name and purpose in the list

type GardenerResourceDataList added in v1.65.0

type GardenerResourceDataList []gardencorev1beta1.GardenerResourceData

GardenerResourceDataList is a list of GardenerResourceData

func (GardenerResourceDataList) DeepCopy added in v1.65.0

DeepCopy makes a deep copy of a GardenerResourceDataList

func (*GardenerResourceDataList) Delete added in v1.65.0

func (g *GardenerResourceDataList) Delete(name string)

Delete deletes an item from the list

func (*GardenerResourceDataList) Get added in v1.65.0

Get returns the item from the list

func (*GardenerResourceDataList) Select added in v1.65.0

Select uses the provided label selector to find data entries with matching labels.

func (*GardenerResourceDataList) Upsert added in v1.65.0

Upsert inserts a new element or updates an existing one

type GetMajorOrMinor added in v1.83.0

type GetMajorOrMinor func(v semver.Version) int64

GetMajorOrMinor returns either the major or the minor version from a semVer version.

type ManagedSeedAPIServer added in v1.52.0

type ManagedSeedAPIServer struct {
	Replicas   *int32
	Autoscaler *ManagedSeedAPIServerAutoscaler
}

ManagedSeedAPIServer contains the configuration of a ManagedSeed API server.

func ReadManagedSeedAPIServer added in v1.18.0

func ReadManagedSeedAPIServer(shoot *gardencorev1beta1.Shoot) (*ManagedSeedAPIServer, error)

ReadManagedSeedAPIServer reads the managed seed API server settings from the corresponding annotation.

type ManagedSeedAPIServerAutoscaler added in v1.52.0

type ManagedSeedAPIServerAutoscaler struct {
	MinReplicas *int32
	MaxReplicas int32
}

ManagedSeedAPIServerAutoscaler contains the configuration of a ManagedSeed API server autoscaler.

type MultiErrorWithCodes added in v1.38.0

type MultiErrorWithCodes struct {
	// contains filtered or unexported fields
}

MultiErrorWithCodes is a struct that contains multiple errors and ErrorCodes.

func NewMultiErrorWithCodes added in v1.38.0

func NewMultiErrorWithCodes(errorFormat func(errs []error) string) *MultiErrorWithCodes

NewMultiErrorWithCodes returns a new instance of `MultiErrorWithCodes`.

func (*MultiErrorWithCodes) Append added in v1.38.0

func (m *MultiErrorWithCodes) Append(err error)

Append appends the given error to the `MultiErrorWithCodes`.

func (*MultiErrorWithCodes) Codes added in v1.38.0

Codes returns all underlying `gardencorev1beta1.ErrorCode` codes.

func (*MultiErrorWithCodes) Error added in v1.38.0

func (m *MultiErrorWithCodes) Error() string

Error implements the error interface.

func (*MultiErrorWithCodes) ErrorOrNil added in v1.38.0

func (m *MultiErrorWithCodes) ErrorOrNil() error

ErrorOrNil returns nil if no underlying errors are given.

type ResourceDataList added in v1.65.0

type ResourceDataList []gardencorev1beta1.ResourceData

ResourceDataList is a list of ResourceData

func (*ResourceDataList) Delete added in v1.65.0

Delete deletes an item from the list

func (*ResourceDataList) Get added in v1.65.0

Get returns the item from the list

func (*ResourceDataList) Upsert added in v1.65.0

Upsert inserts a new element or updates an existing one

type ShootItems added in v1.7.0

type ShootItems gardencorev1beta1.ShootList

ShootItems provides helper functions with ShootLists

func (*ShootItems) Union added in v1.7.0

func (s *ShootItems) Union(shootItems *ShootItems) []gardencorev1beta1.Shoot

Union returns a set of Shoots that presents either in s or shootList

type VersionPredicate added in v1.4.0

type VersionPredicate func(expirableVersion gardencorev1beta1.ExpirableVersion, version *semver.Version) (bool, error)

VersionPredicate is a function that evaluates a condition on the given versions.

func FilterDifferentMajorMinorVersionAndLowerPatchVersionsOfSameMinor added in v1.83.0

func FilterDifferentMajorMinorVersionAndLowerPatchVersionsOfSameMinor(currentSemVerVersion semver.Version) VersionPredicate

FilterDifferentMajorMinorVersionAndLowerPatchVersionsOfSameMinor returns a VersionPredicate(closure) that returns true if a given version v

  • has a different major.minor version compared to the currentSemVerVersion
  • has a lower patch version (acts as >= relational operator)

Uses the tilde range operator.

func FilterDifferentMajorVersion added in v1.83.0

func FilterDifferentMajorVersion(currentSemVerVersion semver.Version) VersionPredicate

FilterDifferentMajorVersion returns a VersionPredicate(closure) that evaluates whether a given version v has the same major version compared to the currentSemVerVersion. Returns true if v does not have the same major version.

func FilterEqualAndSmallerMajorVersion added in v1.83.0

func FilterEqualAndSmallerMajorVersion(currentSemVerVersion semver.Version) VersionPredicate

FilterEqualAndSmallerMajorVersion returns a VersionPredicate(closure) that evaluates whether a given version v has a smaller major version compared to the currentSemVerVersion. Returns true if v has a smaller or equal major version.

func FilterEqualAndSmallerMinorVersion added in v1.83.0

func FilterEqualAndSmallerMinorVersion(currentSemVerVersion semver.Version) VersionPredicate

FilterEqualAndSmallerMinorVersion returns a VersionPredicate(closure) that evaluates whether a given version v has a smaller or equal minor version compared to the currentSemVerVersion. Returns true if v has a smaller or equal minor version.

func FilterLowerVersion added in v1.4.0

func FilterLowerVersion(currentSemVerVersion semver.Version) VersionPredicate

FilterLowerVersion returns a VersionPredicate(closure) that evaluates whether a given version v is lower than the currentSemVerVersion returns true if it is lower

func FilterNonConsecutiveMinorVersion added in v1.4.0

func FilterNonConsecutiveMinorVersion(currentSemVerVersion semver.Version) VersionPredicate

FilterNonConsecutiveMinorVersion returns a VersionPredicate(closure) that evaluates whether a given version v has a consecutive minor version compared to the currentSemVerVersion

  • implicitly, therefore also versions cannot be smaller than the current version

returns true if v does not have a consecutive minor version.

func FilterSameVersion added in v1.4.0

func FilterSameVersion(currentSemVerVersion semver.Version) VersionPredicate

FilterSameVersion returns a VersionPredicate(closure) that evaluates whether a given version v is equal to the currentSemVerVersion. returns true if it is equal.

type WrappedLastErrors

type WrappedLastErrors struct {
	Description string
	LastErrors  []gardencorev1beta1.LastError
}

WrappedLastErrors is a structure which contains the general description of the lastErrors which occurred and an array of all lastErrors

func NewWrappedLastErrors

func NewWrappedLastErrors(description string, err error) *WrappedLastErrors

NewWrappedLastErrors returns a list of last errors.

Jump to

Keyboard shortcuts

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