helper

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 13 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 checks the <lastOperation> and determines whether it is Create, Delete, Reconcile, Migrate or Restore operation

func ConditionsNeedUpdate

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

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

func DetermineLatestKubernetesPatchVersion

func DetermineLatestKubernetesPatchVersion(cloudProfile *gardencorev1alpha1.CloudProfile, currentVersion string) (bool, string, error)

DetermineLatestKubernetesPatchVersion finds the latest Kubernetes patch version in the <cloudProfile> compared to the given <currentVersion>. In case it does not find a newer patch version, it returns false. Otherwise, true and the found version will be returned.

func DetermineLatestMachineImageVersion

func DetermineLatestMachineImageVersion(image gardencorev1alpha1.MachineImage) (*semver.Version, gardencorev1alpha1.MachineImageVersion, error)

DetermineLatestMachineImageVersion determines the latest MachineImageVersion from a MachineImage

func DetermineMachineImageForName

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

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 DetermineNextKubernetesMinorVersion

func DetermineNextKubernetesMinorVersion(cloudProfile *gardencorev1alpha1.CloudProfile, currentVersion string) (bool, string, error)

DetermineNextKubernetesMinorVersion finds the next available Kubernetes minor version in the <cloudProfile> compared to the given <currentVersion>. In case it does not find a newer minor version, it returns false. Otherwise, true and the found version will be returned.

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 GetDefaultMachineImageFromCloudProfile

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

GetDefaultMachineImageFromCloudProfile gets the first MachineImage from the CloudProfile

func GetMachineImagesFor added in v0.33.0

func GetMachineImagesFor(shoot *gardencorev1alpha1.Shoot) []*gardencorev1alpha1.ShootMachineImage

GetMachineImagesFor returns a list of all machine images for a given shoot.

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 GetShootMachineImageFromLatestMachineImageVersion

func GetShootMachineImageFromLatestMachineImageVersion(image gardencorev1alpha1.MachineImage) (*semver.Version, gardencorev1alpha1.ShootMachineImage, error)

GetShootMachineImageFromLatestMachineImageVersion determines the latest version in a machine image and returns that as a ShootMachineImage

func HibernationIsEnabled

func HibernationIsEnabled(shoot *gardencorev1alpha1.Shoot) bool

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

func InitCondition

func InitCondition(conditionType gardencorev1alpha1.ConditionType) gardencorev1alpha1.Condition

InitCondition initializes a new Condition with an Unknown status.

func IsAPIServerExposureManaged added in v1.1.0

func IsAPIServerExposureManaged(obj metav1.Object) bool

IsAPIServerExposureManaged returns true, if the Object is managed by Gardener for API server exposure. This indicates to extensions that they should not mutate the object. Gardener marks the kube-apiserver Service and Deployment as managed by it when it uses SNI to expose them.

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 KubernetesVersionExistsInCloudProfile

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

KubernetesVersionExistsInCloudProfile checks if the given Kubernetes version exists in the CloudProfile

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 SetMachineImageVersionsToMachineImage

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

SetMachineImageVersionsToMachineImage sets imageVersions to the matching imageName in the machineImages.

func ShootIgnoresAlerts

func ShootIgnoresAlerts(shoot *gardencorev1alpha1.Shoot) bool

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

func ShootMachineImageVersionExists

func ShootMachineImageVersionExists(constraint gardencorev1alpha1.MachineImage, image gardencorev1alpha1.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 ShootUsesUnmanagedDNS added in v0.33.0

func ShootUsesUnmanagedDNS(shoot *gardencorev1alpha1.Shoot) bool

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

func ShootWantsBasicAuthentication

func ShootWantsBasicAuthentication(shoot *gardencorev1alpha1.Shoot) bool

ShootWantsBasicAuthentication returns true if basic authentication is not configured or if it is set explicitly to 'true'.

func ShootWantsClusterAutoscaler

func ShootWantsClusterAutoscaler(shoot *gardencorev1alpha1.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 SystemComponentsAllowed added in v1.7.0

func SystemComponentsAllowed(worker *gardencorev1alpha1.Worker) bool

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

func TaintsHave

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

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

func UpdateMachineImages

func UpdateMachineImages(workers []gardencorev1alpha1.Worker, machineImages []*gardencorev1alpha1.ShootMachineImage)

UpdateMachineImages updates the machine images in place.

func UpdatedCondition

UpdatedCondition updates the properties of one specific condition.

func UpdatedConditionUnknownError

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

UpdatedConditionUnknownError updates the condition to 'Unknown' status and the message of the given error.

func UpdatedConditionUnknownErrorMessage

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

UpdatedConditionUnknownErrorMessage updates the condition with 'Unknown' status and the given message.

func WrapWithLastError added in v0.34.0

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

WrapWithLastError is wrapper function for gardencorev1alpha1.LastError

Types

type ConditionBuilder added in v0.34.0

type ConditionBuilder interface {
	WithOldCondition(old gardencorev1alpha1.Condition) ConditionBuilder
	WithStatus(status gardencorev1alpha1.ConditionStatus) ConditionBuilder
	WithReason(reason string) ConditionBuilder
	WithMessage(message string) ConditionBuilder
	WithCodes(codes ...gardencorev1alpha1.ErrorCode) ConditionBuilder
	WithNowFunc(now func() metav1.Time) ConditionBuilder
	Build() (new gardencorev1alpha1.Condition, updated bool)
}

ConditionBuilder build a Condition.

func NewConditionBuilder added in v0.34.0

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

NewConditionBuilder returns a ConditionBuilder for a specific condition.

type ExtensionResourceStateList added in v1.2.0

type ExtensionResourceStateList []gardencorev1alpha1.ExtensionResourceState

ExtensionResourceStateList is a list of ExtensionResourceStates

func (*ExtensionResourceStateList) Delete added in v1.2.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.2.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.2.0

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

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

type GardenerResourceDataList added in v1.4.0

type GardenerResourceDataList []gardencorev1alpha1.GardenerResourceData

GardenerResourceDataList is a list of GardenerResourceData

func (GardenerResourceDataList) DeepCopy added in v1.11.4

DeepCopy makes a deep copy of a GardenerResourceDataList

func (*GardenerResourceDataList) Delete added in v1.4.0

func (g *GardenerResourceDataList) Delete(name string)

Delete deletes an item from the list

func (*GardenerResourceDataList) Get added in v1.4.0

Get returns the item from the list

func (*GardenerResourceDataList) Upsert added in v1.4.0

Upsert inserts a new element or updates an existing one

type ResourceDataList added in v1.5.0

type ResourceDataList []gardencorev1alpha1.ResourceData

ResourceDataList is a list of ResourceData

func (*ResourceDataList) Delete added in v1.5.0

Delete deletes an item from the list

func (*ResourceDataList) Get added in v1.5.0

Get returns the item from the list

func (*ResourceDataList) Upsert added in v1.5.0

Upsert inserts a new element or updates an existing one

type ShootedSeed

type ShootedSeed struct {
	DisableDNS                     *bool
	DisableCapacityReservation     *bool
	Protected                      *bool
	Visible                        *bool
	MinimumVolumeSize              *string
	APIServer                      *ShootedSeedAPIServer
	BlockCIDRs                     []string
	ShootDefaults                  *gardencorev1alpha1.ShootNetworks
	Backup                         *gardencorev1alpha1.SeedBackup
	NoGardenlet                    bool
	UseServiceAccountBootstrapping bool
	WithSecretRef                  bool
}

ShootedSeed contains the configuration of a shooted seed.

func ReadShootedSeed

func ReadShootedSeed(shoot *gardencorev1alpha1.Shoot) (*ShootedSeed, error)

ReadShootedSeed determines whether the Shoot has been marked to be registered automatically as a Seed cluster.

type ShootedSeedAPIServer

type ShootedSeedAPIServer struct {
	Replicas   *int32
	Autoscaler *ShootedSeedAPIServerAutoscaler
}

ShootedSeedAPIServer contains the configuration of a shooted seed API server.

type ShootedSeedAPIServerAutoscaler

type ShootedSeedAPIServerAutoscaler struct {
	MinReplicas *int32
	MaxReplicas int32
}

ShootedSeedAPIServerAutoscaler contains the configuration of a shooted seed API server autoscaler.

Jump to

Keyboard shortcuts

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