controllers

package
v5.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: Apache-2.0 Imports: 56 Imported by: 1

Documentation

Overview

Package controllers implements Kubernetes controllers for Grafana Operator.

Index

Constants

View Source
const (
	RequeueDelay = 10 * time.Second
)

Variables

View Source
var (
	ErrNoMatchingInstances = fmt.Errorf("no matching instances")
	ErrFetchingFolder      = "fetching folder to resolve uid: %w"
)
View Source
var ErrLoopDetected = errors.New("loop detected")

Functions

func GetScopedMatchingInstances added in v5.16.0

func GetScopedMatchingInstances(ctx context.Context, k8sClient client.Client, cr v1beta1.CommonResource) ([]v1beta1.Grafana, error)

Only matching instances in the scope of the resource are returned Resources with allowCrossNamespaceImport expands the scope to the entire cluster Intended to be used in reconciler functions

func ReconcilePlugins

func ReconcilePlugins(ctx context.Context, k8sClient client.Client, scheme *runtime.Scheme, grafana *v1beta1.Grafana, plugins v1beta1.PluginList, cmKey string, cmDeprecatedKey string) error

TODO Refactor to use scheme from k8sClient.Scheme() as it's the same anyways

func UpdateStatus added in v5.18.0

func UpdateStatus(ctx context.Context, cl client.Client, cr statusResource)

Types

type GrafanaAlertRuleGroupReconciler added in v5.7.0

type GrafanaAlertRuleGroupReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaAlertRuleGroupReconciler reconciles a GrafanaAlertRuleGroup object

func (*GrafanaAlertRuleGroupReconciler) Reconcile added in v5.7.0

func (*GrafanaAlertRuleGroupReconciler) SetupWithManager added in v5.7.0

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

SetupWithManager sets up the controller with the Manager.

type GrafanaCommonReconciler added in v5.20.0

type GrafanaCommonReconciler interface {
	Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
	Reconcile(ctx context.Context, req controllerruntime.Request) (controllerruntime.Result, error)
}

type GrafanaContactPointReconciler added in v5.9.0

type GrafanaContactPointReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaContactPointReconciler reconciles a GrafanaContactPoint object

func (*GrafanaContactPointReconciler) Reconcile added in v5.9.0

func (*GrafanaContactPointReconciler) SetupWithManager added in v5.9.0

func (r *GrafanaContactPointReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type GrafanaDashboardReconciler

type GrafanaDashboardReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaDashboardReconciler reconciles a GrafanaDashboard object

func (*GrafanaDashboardReconciler) DeleteFolderIfEmpty

func (r *GrafanaDashboardReconciler) DeleteFolderIfEmpty(client *genapi.GrafanaHTTPAPI, folderUID string) (http.Response, error)

func (*GrafanaDashboardReconciler) Exists

func (r *GrafanaDashboardReconciler) Exists(client *genapi.GrafanaHTTPAPI, uid string, title string, folderUID string) (string, error)

func (*GrafanaDashboardReconciler) GetFolderUID added in v5.8.0

func (r *GrafanaDashboardReconciler) GetFolderUID(
	client *genapi.GrafanaHTTPAPI,
	title string,
) (bool, string, error)

func (*GrafanaDashboardReconciler) GetOrCreateFolder

func (*GrafanaDashboardReconciler) Reconcile

func (*GrafanaDashboardReconciler) SetupWithManager

func (r *GrafanaDashboardReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*GrafanaDashboardReconciler) UpdateHomeDashboard

func (r *GrafanaDashboardReconciler) UpdateHomeDashboard(ctx context.Context, grafana v1beta1.Grafana, uid string, dashboard *v1beta1.GrafanaDashboard) error

type GrafanaDatasourceReconciler

type GrafanaDatasourceReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaDatasourceReconciler reconciles a GrafanaDatasource object

func (*GrafanaDatasourceReconciler) Exists

func (r *GrafanaDatasourceReconciler) Exists(client *genapi.GrafanaHTTPAPI, uid, name string) (bool, string, error)

func (*GrafanaDatasourceReconciler) Reconcile

func (*GrafanaDatasourceReconciler) SetupWithManager

func (r *GrafanaDatasourceReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type GrafanaFolderReconciler

type GrafanaFolderReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaFolderReconciler reconciles a GrafanaFolder object

func (*GrafanaFolderReconciler) Exists

Check if the folder exists. Matches UID first and fall back to title. Title matching only works for non-nested folders

func (*GrafanaFolderReconciler) Reconcile

func (r *GrafanaFolderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*GrafanaFolderReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type GrafanaLibraryPanelReconciler added in v5.17.0

type GrafanaLibraryPanelReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaLibraryPanelReconciler reconciles a GrafanaLibraryPanel object

func (*GrafanaLibraryPanelReconciler) Reconcile added in v5.17.0

func (*GrafanaLibraryPanelReconciler) SetupWithManager added in v5.17.0

func (r *GrafanaLibraryPanelReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type GrafanaMuteTimingReconciler added in v5.17.0

type GrafanaMuteTimingReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaMuteTimingReconciler reconciles a GrafanaMuteTiming object

func (*GrafanaMuteTimingReconciler) Reconcile added in v5.17.0

func (*GrafanaMuteTimingReconciler) SetupWithManager added in v5.17.0

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

SetupWithManager sets up the controller with the Manager.

type GrafanaNotificationPolicyReconciler added in v5.12.0

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

GrafanaNotificationPolicyReconciler reconciles a GrafanaNotificationPolicy object

func (*GrafanaNotificationPolicyReconciler) Reconcile added in v5.12.0

func (*GrafanaNotificationPolicyReconciler) SetupWithManager added in v5.12.0

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

SetupWithManager sets up the controller with the Manager.

type GrafanaNotificationTemplateReconciler added in v5.16.0

type GrafanaNotificationTemplateReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaNotificationTemplateReconciler reconciles a GrafanaNotificationTemplate object

func (*GrafanaNotificationTemplateReconciler) Reconcile added in v5.16.0

func (*GrafanaNotificationTemplateReconciler) SetupWithManager added in v5.16.0

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

SetupWithManager sets up the controller with the Manager.

type GrafanaReconciler

type GrafanaReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	IsOpenShift   bool
	ClusterDomain string
}

GrafanaReconciler reconciles a Grafana object

func (*GrafanaReconciler) Reconcile

func (r *GrafanaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*GrafanaReconciler) SetupWithManager

func (r *GrafanaReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type GrafanaServiceAccountReconciler added in v5.20.0

type GrafanaServiceAccountReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

GrafanaServiceAccountReconciler reconciles a GrafanaServiceAccount object.

func (*GrafanaServiceAccountReconciler) Reconcile added in v5.20.0

Reconcile synchronizes the actual state (Grafana service accounts and Kubernetes secrets) with the desired state defined in the GrafanaServiceAccount CR spec, taking into account Kubernetes' eventual consistency model.

The reconciliation process: 1. Fetches the GrafanaServiceAccount resource from Kubernetes 2. Handles resource deletion (removes service account from Grafana and cleans up secrets) 3. Sets up status update handling (deferred) 4. Establishes connection to the target Grafana instance 5. For active resources - reconciles the actual state with the desired state (creates, updates, removes as needed) 6. Updates the resource status with current state and conditions 7. Schedules periodic reconciliation based on ResyncPeriod

func (*GrafanaServiceAccountReconciler) SetupWithManager added in v5.20.0

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

SetupWithManager sets up the controller with the Manager.

Directories

Path Synopsis
Package autodetect is for auto-detecting traits from the environment (platform, APIs, ...).
Package autodetect is for auto-detecting traits from the environment (platform, APIs, ...).

Jump to

Keyboard shortcuts

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