utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCloudProfileReference

func BuildCloudProfileReference(shoot *core.Shoot) *gardencorev1beta1.CloudProfileReference

BuildCloudProfileReference determines and returns the CloudProfile reference of the given shoot, depending on the availability of cloudProfileName and cloudProfile.

func GetCloudProfileSpec

func GetCloudProfileSpec(cloudProfileLister gardencorev1beta1listers.CloudProfileLister, namespacedCloudProfileLister gardencorev1beta1listers.NamespacedCloudProfileLister, shoot *core.Shoot) (*gardencorev1beta1.CloudProfileSpec, error)

GetCloudProfileSpec determines whether the given shoot references a CloudProfile or a NamespacedCloudProfile and returns the appropriate CloudProfileSpec.

func GetFilteredShootList

func GetFilteredShootList(shootLister gardencorev1beta1listers.ShootLister, predicateFn func(*gardencorev1beta1.Shoot) bool) ([]*gardencorev1beta1.Shoot, error)

GetFilteredShootList returns shoots returned by the shootLister filtered via the predicateFn.

func GetManagedSeed

func GetManagedSeed(ctx context.Context, seedManagementClient versioned.Interface, shootNamespace, shootName string) (*seedmanagementv1alpha1.ManagedSeed, error)

GetManagedSeed gets the ManagedSeed resource for the given shoot namespace and name, by searching for all ManagedSeeds in the shoot namespace that have spec.shoot.name set to the shoot name. If no such ManagedSeeds are found, nil is returned.

func IsSeedUsedByShoot

func IsSeedUsedByShoot(seedName string, shoots []*gardencorev1beta1.Shoot) bool

IsSeedUsedByShoot checks whether there is a shoot cluster referencing the provided seed name

func NewAttributesWithName

func NewAttributesWithName(a admission.Attributes, name string) admission.Attributes

NewAttributesWithName returns admission.Attributes with the given name and all other attributes kept same.

func ProjectForNamespaceFromLister

func ProjectForNamespaceFromLister(projectLister gardencorev1beta1listers.ProjectLister, namespaceName string) (*gardencorev1beta1.Project, error)

ProjectForNamespaceFromLister returns the Project responsible for a given <namespace>. It lists all Projects via the given lister, iterates over them and tries to identify the Project by looking for the namespace name in the project spec.

func SkipVerification

func SkipVerification(operation admission.Operation, metadata metav1.ObjectMeta) bool

SkipVerification is a common function to skip object verification during admission

func SyncCloudProfileFields

func SyncCloudProfileFields(oldShoot, newShoot *core.Shoot)

SyncCloudProfileFields handles the coexistence of a Shoot Spec's cloudProfileName and cloudProfile by making sure both fields are synced correctly and appropriate fallback cases are handled.

func ValidateCloudProfileChanges

func ValidateCloudProfileChanges(cloudProfileLister gardencorev1beta1listers.CloudProfileLister, namespacedCloudProfileLister gardencorev1beta1listers.NamespacedCloudProfileLister, newShoot, oldShoot *core.Shoot) error

ValidateCloudProfileChanges validates that the referenced CloudProfile only changes within the current profile hierarchy (i.e. between the parent CloudProfile and the descendant NamespacedCloudProfiles) and that upon changing the profile all current configurations still stay valid.

func ValidateZoneRemovalFromSeeds

func ValidateZoneRemovalFromSeeds(oldSeedSpec, newSeedSpec *core.SeedSpec, seedName string, shootLister gardencorev1beta1listers.ShootLister, kind string) error

ValidateZoneRemovalFromSeeds returns an error when zones are removed from the old seed while it is still in use by shoots.

Types

This section is empty.

Jump to

Keyboard shortcuts

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