controllers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReconcilesTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "carbon_aware_keda_scaler_reconciles_total",
			Help: "Total number of reconciles",
		},
		[]string{"app"},
	)

	ReconcileErrorsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "carbon_aware_keda_scaler_reconcile_errors_total",
			Help: "Total number of reconcile errors",
		},
		[]string{"app"},
	)

	CarbonIntensityMetric = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "carbon_aware_keda_scaler_carbon_intensity",
			Help: "Carbon intensity",
		},
		[]string{"app"},
	)

	DefaultMaxReplicasMetric = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "carbon_aware_keda_scaler_default_max_replicas",
			Help: "Default max replicas",
		},
		[]string{"app"},
	)

	MaxReplicasMetric = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "carbon_aware_keda_scaler_max_replicas",
			Help: "Max replicas",
		},
		[]string{"app"},
	)

	EcoModeOffMetric = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "carbon_aware_keda_scaler_eco_mode_off",
			Help: "Eco mode off",
		},
		[]string{"app", "code"},
	)
)

Functions

This section is empty.

Types

type CarbonAwareKedaScalerReconciler

type CarbonAwareKedaScalerReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
	CarbonForecastFetcher
}

CarbonAwareKedaScalerReconciler reconciles a CarbonAwareKedaScaler object

func (*CarbonAwareKedaScalerReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.1/pkg/reconcile

func (*CarbonAwareKedaScalerReconciler) SetupWithManager

func (r *CarbonAwareKedaScalerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type CarbonForecast

type CarbonForecast struct {
	Location  string    `json:"location,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty"`
	Duration  int32     `json:"duration,omitempty"`
	Value     float64   `json:"value,omitempty"`
}

type CarbonForecastConfigMapFetcher

type CarbonForecastConfigMapFetcher struct {
	Client             client.Client
	ConfigMapName      string
	ConfigMapNamespace string
	ConfigMapKey       string
}

CarbonForecastConfigMapFetcher is an implementation of CarbonForecastFetcher that fetches the carbon forecast from a configmap

func (*CarbonForecastConfigMapFetcher) Fetch

type CarbonForecastFetcher

type CarbonForecastFetcher interface {
	Fetch(ctx context.Context) ([]CarbonForecast, error)
}

type CarbonForecastMockConfigMapFetcher

type CarbonForecastMockConfigMapFetcher struct {
	Client         client.Client
	CarbonForecast []CarbonForecast
}

CarbonForecastMockConfigMapFetcher is an implementation of CarbonForecastFetcher that creates and fetches a mock configmap

func (*CarbonForecastMockConfigMapFetcher) Fetch

type EcoModeStatus

type EcoModeStatus struct {
	IsDisabled    bool
	DisableReason string
	RequeueAfter  time.Duration
}

Jump to

Keyboard shortcuts

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