controller

package
v0.0.0-...-d1d7c23 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LabelGroupReconciler

type LabelGroupReconciler struct {
	client.Client
	Scheme                        *runtime.Scheme
	KeplerPrometheusUrl           string
	KeplerMetricName              string
	SusQLPrometheusDatabaseUrl    string
	SusQLPrometheusMetricsUrl     string
	SamplingRate                  time.Duration // Sampling rate for all LabelGroups
	CarbonMethod                  string
	CarbonIntensity               float64
	CarbonIntensityUrl            string
	CarbonIntensityTimeStamp      int64
	CarbonIntensityErrorTimeStamp int64
	CarbonLocation                string
	CarbonQueryRate               int64
	CarbonQueryFilter             string
	CarbonQueryConv2J             float64
	Logger                        logr.Logger
}

LabelGroupReconciler reconciles a LabelGroup object

func (*LabelGroupReconciler) GetMetricValuesForPodNames

func (r *LabelGroupReconciler) GetMetricValuesForPodNames(metricName string, podNames []string, namespaceName string) (map[string]float64, error)

func (*LabelGroupReconciler) GetMostRecentValue

func (r *LabelGroupReconciler) GetMostRecentValue(susqlPrometheusQuery string) (float64, error)

Functions to get data from the cluster

func (*LabelGroupReconciler) GetPodNamesMatchingLabels

func (r *LabelGroupReconciler) GetPodNamesMatchingLabels(ctx context.Context, labelGroup *susqlv1.LabelGroup) ([]string, []string, error)

Functions to get data from the cluster

func (*LabelGroupReconciler) InitializeMetricsExporter

func (r *LabelGroupReconciler) InitializeMetricsExporter()

func (*LabelGroupReconciler) Reconcile

func (r *LabelGroupReconciler) 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 LabelGroup 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.18.4/pkg/reconcile

func (*LabelGroupReconciler) SetAggregatedCarbonForLabels

func (r *LabelGroupReconciler) SetAggregatedCarbonForLabels(totalCarbon float64, prometheusLabels map[string]string) error

func (*LabelGroupReconciler) SetAggregatedEnergyForLabels

func (r *LabelGroupReconciler) SetAggregatedEnergyForLabels(totalEnergy float64, prometheusLabels map[string]string) error

func (*LabelGroupReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type SusqlMetrics

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

Jump to

Keyboard shortcuts

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