sustainability

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

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

type DeploymentReplicas struct {
	Name     string `json:"name"`
	Replicas int32  `json:"replicas"`
}

func ConvertToDeploymentsInfo

func ConvertToDeploymentsInfo(data []byte) ([]DeploymentReplicas, error)

type DeploymentResource

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

func (DeploymentResource) HasResource

func (r DeploymentResource) HasResource() bool

func (DeploymentResource) Info

func (r DeploymentResource) Info() ([]byte, error)

func (DeploymentResource) Sleep

func (DeploymentResource) WakeUp

type Resource

type Resource interface {
	HasResource() bool
	Sleep(c kubernetes.Client, rctx reconcile.Context) error
	WakeUp(c kubernetes.Client, rctx reconcile.Context) error
	Info() ([]byte, error)
}

type Resources

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

func (Resources) HasResources

func (r Resources) HasResources() bool

func (Resources) Info

func (r Resources) Info() (map[string][]byte, error)

func (Resources) Sleep

func (r Resources) Sleep() error

func (Resources) WakeUp

func (r Resources) WakeUp() error

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 (s *SavingsPolicyData) NewSecretData(resources Resources) (stringData map[string]string, data map[string][]byte, err error)

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

type WeekdayRange struct {
	From string
	To   string
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

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