shoot

package
v1.7.1-0...-23dd39d Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const FinalizerName = "gardener.cloud/reference-protection"

FinalizerName is the name of the finalizer used for the reference protection.

Variables

View Source
var (
	// NewCronWithLocation creates a new cron with the given location. Exposed for testing.
	NewCronWithLocation = newCronWithLocation

	// TimeNow returns the current time. Exposed for testing.
	TimeNow = time.Now
)
View Source
var (

	// UserManagedSelector is a selector for objects which are managed by users and not created by Gardener.
	UserManagedSelector = client.MatchingLabelsSelector{Selector: labels.NewSelector().Add(noGardenRole)}
)

Functions

func ExpirationDateExpired

func ExpirationDateExpired(timestamp *metav1.Time) bool

ExpirationDateExpired returns if now is equal or after the given expirationDate

func ForceMachineImageUpdateRequired

func ForceMachineImageUpdateRequired(shootCurrentImage *gardencorev1beta1.ShootMachineImage, imageCloudProvider gardencorev1beta1.MachineImage) bool

ForceMachineImageUpdateRequired checks if the shoots current machine image has to be forcefully updated

func GroupHibernationSchedulesByLocation

func GroupHibernationSchedulesByLocation(schedules []gardencorev1beta1.HibernationSchedule) map[string][]gardencorev1beta1.HibernationSchedule

GroupHibernationSchedulesByLocation groups the given HibernationSchedules by their Location. If the Location of a HibernationSchedule is `nil`, it is defaulted to UTC.

func LocationLogger

func LocationLogger(logger logrus.FieldLogger, location *time.Location) logrus.FieldLogger

LocationLogger returns a logger for the given location.

func MaintainKubernetesVersion

func MaintainKubernetesVersion(shoot *gardencorev1beta1.Shoot, profile *gardencorev1beta1.CloudProfile, logger *logrus.Entry) (updatedKubernetesVersion *string, messageKubernetesUpdate *string, error error)

MaintainKubernetesVersion determines if a shoots kubernetes version has to be maintained and in case returns the target version

func MaintainMachineImages

func MaintainMachineImages(logger *logrus.Entry, shoot *gardencorev1beta1.Shoot, cloudProfile *gardencorev1beta1.CloudProfile) (updatedMachineImages []*gardencorev1beta1.ShootMachineImage, reasons []string, error error)

MaintainMachineImages determines if a shoots machine images have to be maintained and in case returns the target images

func NewConfigMapReconciler

func NewConfigMapReconciler(l logrus.FieldLogger, gardenClient client.Client) reconcile.Reconciler

NewConfigMapReconciler creates a new instance of a reconciler which reconciles ConfigMaps.

func NewHibernationJob

func NewHibernationJob(ctx context.Context, gardenClient kubernetes.Interface, logger logrus.FieldLogger, recorder record.EventRecorder, target *gardencorev1beta1.Shoot, enabled bool) cron.Job

NewHibernationJob creates a new cron.Job that sets the hibernation of the given shoot to enabled when it triggers.

func NewShootHibernationReconciler

func NewShootHibernationReconciler(
	l logrus.FieldLogger,
	gardenClient kubernetes.Interface,
	hibernationScheduleRegistry HibernationScheduleRegistry,
	recorder record.EventRecorder,
) reconcile.Reconciler

NewShootHibernationReconciler creates a new instance of a reconciler which hibernates shoots or wakes them up.

func NewShootMaintenanceReconciler

func NewShootMaintenanceReconciler(l logrus.FieldLogger, gardenClient kubernetes.Interface, config config.ShootMaintenanceControllerConfiguration, cloudProfileLister gardencorelisters.CloudProfileLister, recorder record.EventRecorder) reconcile.Reconciler

NewShootMaintenanceReconciler creates a new instance of a reconciler which maintains Shoots.

func NewShootQuotaReconciler

func NewShootQuotaReconciler(l logrus.FieldLogger, gardenClient client.Client, cfg config.ShootQuotaControllerConfiguration, k8sGardenCoreInformers gardencoreinformers.Interface) reconcile.Reconciler

NewShootQuotaReconciler creates a new instance of a reconciler which checks handles Shoots using SecretBindings that references Quotas.

func NewShootReferenceReconciler

func NewShootReferenceReconciler(l logrus.FieldLogger, clientMap clientmap.ClientMap, userSecretLister SecretLister, configMapLister ConfigMapLister, config *config.ShootReferenceControllerConfiguration) reconcile.Reconciler

NewShootReferenceReconciler creates a new instance of a reconciler which checks object references from shoot objects. A special `userSecretLister` serves as an option to retrieve secret objects which are not gardener managed.

Types

type ConfigMapLister

type ConfigMapLister func(ctx context.Context, configMapList *corev1.ConfigMapList, options ...client.ListOption) error

ConfigMapLister fetches configmap objects with the given options.

type Controller

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

Controller controls Shoots.

func NewShootController

func NewShootController(
	ctx context.Context,
	clientMap clientmap.ClientMap,
	k8sGardenCoreInformers gardencoreinformers.SharedInformerFactory,
	kubeInformerFactory kubeinformers.SharedInformerFactory,
	config *config.ControllerManagerConfiguration,
	recorder record.EventRecorder,
) (
	*Controller,
	error,
)

NewShootController takes a ClientMap, a GardenerInformerFactory, a KubernetesInformerFactory, a ControllerManagerConfig struct and an EventRecorder to create a new Shoot controller.

func (*Controller) CollectMetrics

func (c *Controller) CollectMetrics(ch chan<- prometheus.Metric)

CollectMetrics implements gardenmetrics.ControllerMetricsCollector interface

func (*Controller) Run

func (c *Controller) Run(ctx context.Context, shootMaintenanceWorkers, shootQuotaWorkers, shootHibernationWorkers, shootReferenceWorkers int)

Run runs the Controller until the given stop channel can be read from.

func (*Controller) RunningWorkers

func (c *Controller) RunningWorkers() int

RunningWorkers returns the number of running workers.

type Cron

type Cron interface {
	Schedule(schedule cron.Schedule, job cron.Job)
	Start()
	Stop()
}

Cron is an interface that allows mocking cron.Cron.

type HibernationSchedule

type HibernationSchedule map[string]Cron

HibernationSchedule is a mapping from location to a Cron. It controls the hibernation process of a certain shoot.

func ComputeHibernationSchedule

func ComputeHibernationSchedule(ctx context.Context, gardenClient kubernetes.Interface, logger logrus.FieldLogger, recorder record.EventRecorder, shoot *gardencorev1beta1.Shoot) (HibernationSchedule, error)

ComputeHibernationSchedule computes the HibernationSchedule for the given Shoot.

func (*HibernationSchedule) Start

func (h *HibernationSchedule) Start()

Start implements Cron.

func (*HibernationSchedule) Stop

func (h *HibernationSchedule) Stop()

Stop implements Cron.

type HibernationScheduleRegistry

type HibernationScheduleRegistry interface {
	Load(key string) (schedule HibernationSchedule, ok bool)
	Store(key string, schedule HibernationSchedule)
	Delete(key string)
}

HibernationScheduleRegistry is a goroutine-safe mapping of Shoot key to HibernationSchedule.

func NewHibernationScheduleRegistry

func NewHibernationScheduleRegistry() HibernationScheduleRegistry

NewHibernationScheduleRegistry instantiates a new HibernationScheduleRegistry.

type SecretLister

type SecretLister func(ctx context.Context, secretList *corev1.SecretList, options ...client.ListOption) error

SecretLister fetches secret objects with the given options.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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