Documentation ¶
Index ¶
- Constants
- Variables
- func GroupHibernationSchedulesByLocation(schedules []gardenv1beta1.HibernationSchedule) map[string][]gardenv1beta1.HibernationSchedule
- func LocationLogger(logger logrus.FieldLogger, location *time.Location) logrus.FieldLogger
- func NewHibernationJob(client garden.Interface, logger logrus.FieldLogger, ...) cron.Job
- func StatusLabelTransform(status Status) func(*gardenv1beta1.Shoot) (*gardenv1beta1.Shoot, error)
- type CareControlInterface
- type ControlInterface
- type Controller
- type ControllerInstallationControlInterface
- type Cron
- type HibernationSchedule
- type HibernationScheduleRegistry
- type MaintenanceControlInterface
- type QuotaControlInterface
- type Status
Constants ¶
const ( // BestGuessMaintenanceMinutes is the average duration of a maintenance operation. It is subtracted from the end // of a maintenance time window to use a best-effort kind of finishing the operation before the end. // Generally, we can't make sure that the maintenance operation is done by the end of the time window anyway (considering large // clusters with hundreds of nodes, a rolling update will take several hours). BestGuessMaintenanceMinutes = 15 )
Variables ¶
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 )
Functions ¶
func GroupHibernationSchedulesByLocation ¶
func GroupHibernationSchedulesByLocation(schedules []gardenv1beta1.HibernationSchedule) map[string][]gardenv1beta1.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 NewHibernationJob ¶
func NewHibernationJob(client garden.Interface, logger logrus.FieldLogger, target *gardenv1beta1.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 StatusLabelTransform ¶
func StatusLabelTransform(status Status) func(*gardenv1beta1.Shoot) (*gardenv1beta1.Shoot, error)
StatusLabelTransform transforms the shoot labels depending on the given Status.
Types ¶
type CareControlInterface ¶
type CareControlInterface interface {
Care(shoot *gardenv1beta1.Shoot, key string) error
}
CareControlInterface implements the control logic for caring for Shoots. It is implemented as an interface to allow for extensions that provide different semantics. Currently, there is only one implementation.
func NewDefaultCareControl ¶
func NewDefaultCareControl(k8sGardenClient kubernetes.Interface, k8sGardenInformers gardeninformers.Interface, secrets map[string]*corev1.Secret, imageVector imagevector.ImageVector, identity *gardenv1beta1.Gardener, config *config.ControllerManagerConfiguration) CareControlInterface
NewDefaultCareControl returns a new instance of the default implementation CareControlInterface that implements the documented semantics for caring for Shoots. updater is the UpdaterInterface used to update the status of Shoots. You should use an instance returned from NewDefaultCareControl() for any scenario other than testing.
type ControlInterface ¶
type ControlInterface interface { // ReconcileShoot implements the control logic for Shoot creation, update, and deletion. // If an implementation returns a non-nil error, the invocation will be retried using a rate-limited strategy. // Implementors should sink any errors that they do not wish to trigger a retry, and they may feel free to // exit exceptionally at any point provided they wish the update to be re-run at a later point in time. // The bool return value determines whether the Shoot should be automatically requeued for reconciliation. ReconcileShoot(shoot *gardenv1beta1.Shoot, key string, o *operation.Operation) (bool, error) }
ControlInterface implements the control logic for updating Shoots. It is implemented as an interface to allow for extensions that provide different semantics. Currently, there is only one implementation.
func NewDefaultControl ¶
func NewDefaultControl(k8sGardenClient kubernetes.Interface, k8sGardenInformers gardeninformers.Interface, secrets map[string]*corev1.Secret, imageVector imagevector.ImageVector, identity *gardenv1beta1.Gardener, config *config.ControllerManagerConfiguration, gardenerNamespace string, recorder record.EventRecorder) ControlInterface
NewDefaultControl returns a new instance of the default implementation ControlInterface that implements the documented semantics for Shoots. updater is the UpdaterInterface used to update the status of Shoots. You should use an instance returned from NewDefaultControl() for any scenario other than testing.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller controls Shoots.
func NewShootController ¶
func NewShootController(k8sGardenClient kubernetes.Interface, k8sGardenInformers gardeninformers.SharedInformerFactory, k8sGardenCoreInformers gardencoreinformers.SharedInformerFactory, kubeInformerFactory kubeinformers.SharedInformerFactory, config *config.ControllerManagerConfiguration, identity *gardenv1beta1.Gardener, gardenNamespace string, secrets map[string]*corev1.Secret, imageVector imagevector.ImageVector, recorder record.EventRecorder) *Controller
NewShootController takes a Kubernetes client for the Garden clusters <k8sGardenClient>, a struct holding information about the acting Gardener, a <shootInformer>, and a <recorder> for event recording. It creates a new Gardener 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, shootWorkers, shootCareWorkers, shootMaintenanceWorkers, shootQuotaWorkers, shootHibernationWorkers 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 ControllerInstallationControlInterface ¶
type ControllerInstallationControlInterface interface {
Reconcile(controllerInstallationObj *corev1alpha1.ControllerInstallation) ([]*gardenv1beta1.Shoot, error)
}
ControllerInstallationControlInterface implements the control logic for requeuing Shoots after extensions have been updated. It is implemented as an interface to allow for extensions that provide different semantics. Currently, there is only one implementation.
func NewDefaultControllerInstallationControl ¶
func NewDefaultControllerInstallationControl(k8sGardenClient kubernetes.Interface, k8sGardenInformers gardeninformers.Interface, k8sGardenCoreInformers gardencoreinformers.Interface, recorder record.EventRecorder) ControllerInstallationControlInterface
NewDefaultControllerInstallationControl returns a new instance of the default implementation ControllerInstallationControlInterface that implements the documented semantics for maintaining Shoots. updater is the UpdaterInterface used to update the spec of Shoots. You should use an instance returned from NewDefaultControllerInstallationControl() for any scenario other than testing.
type HibernationSchedule ¶
HibernationSchedule is a mapping from location to a Cron. It controls the hibernation process of a certain shoot.
func ComputeHibernationSchedule ¶
func ComputeHibernationSchedule(client garden.Interface, logger logrus.FieldLogger, shoot *gardenv1beta1.Shoot) (HibernationSchedule, error)
ComputeHibernationSchedule computes the HibernationSchedule for the given Shoot.
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 MaintenanceControlInterface ¶
type MaintenanceControlInterface interface {
Maintain(shoot *gardenv1beta1.Shoot, key string) error
}
MaintenanceControlInterface implements the control logic for maintaining Shoots. It is implemented as an interface to allow for extensions that provide different semantics. Currently, there is only one implementation.
func NewDefaultMaintenanceControl ¶
func NewDefaultMaintenanceControl(k8sGardenClient kubernetes.Interface, k8sGardenInformers gardeninformers.Interface, secrets map[string]*corev1.Secret, imageVector imagevector.ImageVector, identity *gardenv1beta1.Gardener, recorder record.EventRecorder) MaintenanceControlInterface
NewDefaultMaintenanceControl returns a new instance of the default implementation MaintenanceControlInterface that implements the documented semantics for maintaining Shoots. updater is the UpdaterInterface used to update the spec of Shoots. You should use an instance returned from NewDefaultMaintenanceControl() for any scenario other than testing.
type QuotaControlInterface ¶
type QuotaControlInterface interface {
CheckQuota(shoot *gardenv1beta1.Shoot, key string) error
}
QuotaControlInterface implements the control logic for quota management of Shoots. It is implemented as an interface to allow for extensions that provide different semantics. Currently, there is only one implementation.
func NewDefaultQuotaControl ¶
func NewDefaultQuotaControl(k8sGardenClient kubernetes.Interface, k8sGardenInformers gardeninformers.Interface) QuotaControlInterface
NewDefaultQuotaControl returns a new instance of the default implementation of QuotaControlInterface which implements the semantics for controlling the quota handling of Shoot resources.
type Status ¶
type Status string
Status is the status of a shoot used in the common.ShootStatus label.
const ( // StatusHealthy indicates that a shoot is considered healthy. StatusHealthy Status = "healthy" // StatusProgressing indicates that a shoot was once healthy, currently experienced an issue // but is still within a predefined grace period. StatusProgressing Status = "progressing" // StatusUnhealthy indicates that a shoot is considered unhealthy. StatusUnhealthy Status = "unhealthy" )
func BoolToStatus ¶
BoolToStatus converts the given boolean to a Status. For true values, it returns StatusHealthy. Otherwise, it returns StatusUnhealthy.
func ComputeConditionStatus ¶
func ComputeConditionStatus(conditions ...gardencorev1alpha1.Condition) Status
ComputeConditionStatus computes a shoot Label Status from the given Conditions. By default, the Status is StatusHealthy. The condition status is converted to a Status by using ConditionStatusToStatus. Always the worst status of the combined states wins.
func ComputeStatus ¶
func ComputeStatus(lastOperation *gardencorev1alpha1.LastOperation, lastError *gardencorev1alpha1.LastError, conditions ...gardencorev1alpha1.Condition) Status
ComputeStatus computes the label Status of a shoot depending on the given lastOperation, lastError and conditions.
func ConditionStatusToStatus ¶
func ConditionStatusToStatus(status gardencorev1alpha1.ConditionStatus) Status
ConditionStatusToStatus converts the given ConditionStatus to a shoot label Status.