controller

package
v0.0.0-...-2433258 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CarbonIntensityMetric = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "carbon_aware_karmada_operator_cluster_carbon_intensity",
			Help: "Cluster carbon intensity",
		},
		[]string{"cluster", "location", "active"},
	)

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

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

Functions

This section is empty.

Types

type CarbonAwareKarmadaPolicyReconciler

type CarbonAwareKarmadaPolicyReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
	CarbonIntensityFetcher
}

CarbonAwareKarmadaPolicyReconciler reconciles a CarbonAwareKarmadaPolicy object

func (*CarbonAwareKarmadaPolicyReconciler) 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.4/pkg/reconcile

func (*CarbonAwareKarmadaPolicyReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type CarbonIntensity

type CarbonIntensity struct {
	IsValid   bool
	Location  string
	Units     string
	ValidFrom time.Time
	ValidTo   time.Time
	Value     float64
}

type CarbonIntensityFetcher

type CarbonIntensityFetcher interface {
	Fetch(ctx context.Context, clusterName, location string) (ClusterCarbonIntensity, error)
	Provider() string
}

type ClusterCarbonIntensity

type ClusterCarbonIntensity struct {
	CarbonIntensity CarbonIntensity
	ClusterName     string
}

type GridIntensityFetcher

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

func NewGridIntensityFetcher

func NewGridIntensityFetcher(providerName string) (*GridIntensityFetcher, error)

func (*GridIntensityFetcher) Fetch

func (g *GridIntensityFetcher) Fetch(ctx context.Context, clusterName, location string) (ClusterCarbonIntensity, error)

func (*GridIntensityFetcher) Provider

func (g *GridIntensityFetcher) Provider() string

Jump to

Keyboard shortcuts

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