Documentation ¶
Index ¶
Constants ¶
View Source
const ( DeploymentResourceApiVersion string = "apps/v1" DeploymentResourceKind string = "Deployment" )
View Source
const ( SavingsPolicyFinalizerName = "savingspolicy.sustainability.aeto.net/finalizer" AnnotationChangedGracePeriodSeconds int = 15 )
View Source
const ( AnnotationSuspendFor string = "sustainability.aeto.net/suspend-for" AnnotationSuspendUntil string = "sustainability.aeto.net/suspend-until" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeploymentReplicas ¶
func ConvertToDeploymentsInfo ¶
func ConvertToDeploymentsInfo(data []byte) ([]DeploymentReplicas, error)
type DeploymentResource ¶
type DeploymentResource struct {
// contains filtered or unexported fields
}
func NewDeploymentResource ¶
func NewDeploymentResource(c kubernetes.Client, rctx reconcile.Context, savingspolicy sustainabilityv1alpha1.SavingsPolicy, replicas []DeploymentReplicas) (DeploymentResource, error)
func (DeploymentResource) HasResource ¶
func (r DeploymentResource) HasResource() bool
func (DeploymentResource) Info ¶
func (r DeploymentResource) Info() ([]byte, error)
func (DeploymentResource) Sleep ¶
func (r DeploymentResource) Sleep(c kubernetes.Client, rctx reconcile.Context) error
func (DeploymentResource) WakeUp ¶
func (r DeploymentResource) WakeUp(c kubernetes.Client, rctx reconcile.Context) error
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
func NewResources ¶
func NewResources(c kubernetes.Client, rctx reconcile.Context, savingspolicy sustainabilityv1alpha1.SavingsPolicy, data SavingsPolicyData) (Resources, error)
func (Resources) HasResources ¶
type SavingsPolicyData ¶
type SavingsPolicyData struct { LastTransitionTime time.Time Suspended bool Reason string SuspendedDuration time.Duration DeploymentsInfo []DeploymentReplicas }
func NewSavingsPolicyData ¶
func NewSavingsPolicyData(secret *v1.Secret, savingsPolicy sustainabilityv1alpha1.SavingsPolicy, suspended bool, reason string) (SavingsPolicyData, error)
func (*SavingsPolicyData) LoadFromSecretData ¶
func (s *SavingsPolicyData) LoadFromSecretData(data map[string][]byte) error
func (*SavingsPolicyData) NewSecretData ¶
func (*SavingsPolicyData) TimeSinceLastTransition ¶
func (s *SavingsPolicyData) TimeSinceLastTransition() time.Duration
type SavingsPolicyReconciler ¶
type SavingsPolicyReconciler struct { kubernetes.Client Scheme *runtime.Scheme }
SavingsPolicyReconciler reconciles a SavingsPolicy object
func (*SavingsPolicyReconciler) Reconcile ¶
func (r *SavingsPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the SavingsPolicy object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.13.0/pkg/reconcile
func (*SavingsPolicyReconciler) SetupWithManager ¶
func (r *SavingsPolicyReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type WeekdayRange ¶
func NewWeekdayRange ¶
func NewWeekdayRange(from, to string) (*WeekdayRange, error)
func (*WeekdayRange) HasNext ¶
func (wr *WeekdayRange) HasNext() bool
func (*WeekdayRange) Next ¶
func (wr *WeekdayRange) Next() string
func (*WeekdayRange) Reset ¶
func (wr *WeekdayRange) Reset()
func (*WeekdayRange) String ¶
func (wr *WeekdayRange) String() string
type WeekdayTime ¶
type WeekdayTime struct {
// contains filtered or unexported fields
}
func NewWeekdayTimeLocal ¶
func NewWeekdayTimeLocal(weekday, hour, minute, tz string) (WeekdayTime, error)
func NewWeekdayTimeUTC ¶
func NewWeekdayTimeUTC(weekday, hour, minute string) WeekdayTime
func (WeekdayTime) InRange ¶
func (wt WeekdayTime) InRange(from, to WeekdayTime) bool
func (WeekdayTime) OnOrAfter ¶
func (wt WeekdayTime) OnOrAfter(val WeekdayTime) bool
func (WeekdayTime) OnOrBefore ¶
func (wt WeekdayTime) OnOrBefore(val WeekdayTime) bool
func (WeekdayTime) String ¶
func (wt WeekdayTime) String() string
Click to show internal directories.
Click to hide internal directories.