Documentation
¶
Overview ¶
Package controllers implements Kubernetes controllers for Grafana Operator.
Index ¶
- Constants
- Variables
- func GetScopedMatchingInstances(ctx context.Context, k8sClient client.Client, cr v1beta1.CommonResource) ([]v1beta1.Grafana, error)
- func ReconcilePlugins(ctx context.Context, k8sClient client.Client, scheme *runtime.Scheme, ...) error
- func UpdateStatus(ctx context.Context, cl client.Client, cr statusResource)
- type GrafanaAlertRuleGroupReconciler
- type GrafanaCommonReconciler
- type GrafanaContactPointReconciler
- type GrafanaDashboardReconciler
- func (r *GrafanaDashboardReconciler) DeleteFolderIfEmpty(client *genapi.GrafanaHTTPAPI, folderUID string) (http.Response, error)
- func (r *GrafanaDashboardReconciler) Exists(client *genapi.GrafanaHTTPAPI, uid string, title string, folderUID string) (string, error)
- func (r *GrafanaDashboardReconciler) GetFolderUID(client *genapi.GrafanaHTTPAPI, title string) (bool, string, error)
- func (r *GrafanaDashboardReconciler) GetOrCreateFolder(client *genapi.GrafanaHTTPAPI, cr *v1beta1.GrafanaDashboard) (string, error)
- func (r *GrafanaDashboardReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *GrafanaDashboardReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error
- func (r *GrafanaDashboardReconciler) UpdateHomeDashboard(ctx context.Context, grafana v1beta1.Grafana, uid string, ...) error
- type GrafanaDatasourceReconciler
- func (r *GrafanaDatasourceReconciler) Exists(client *genapi.GrafanaHTTPAPI, uid, name string) (bool, string, error)
- func (r *GrafanaDatasourceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *GrafanaDatasourceReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error
- type GrafanaFolderReconciler
- func (r *GrafanaFolderReconciler) Exists(client *genapi.GrafanaHTTPAPI, cr *grafanav1beta1.GrafanaFolder) (bool, string, string, error)
- func (r *GrafanaFolderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *GrafanaFolderReconciler) SetupWithManager(mgr ctrl.Manager) error
- type GrafanaLibraryPanelReconciler
- type GrafanaMuteTimingReconciler
- type GrafanaNotificationPolicyReconciler
- type GrafanaNotificationTemplateReconciler
- type GrafanaReconciler
- type GrafanaServiceAccountReconciler
Constants ¶
const (
RequeueDelay = 10 * time.Second
)
Variables ¶
var ( ErrNoMatchingInstances = fmt.Errorf("no matching instances") ErrFetchingFolder = "fetching folder to resolve uid: %w" )
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
Types ¶
type GrafanaAlertRuleGroupReconciler ¶ added in v5.7.0
GrafanaAlertRuleGroupReconciler reconciles a GrafanaAlertRuleGroup object
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 GrafanaContactPointReconciler ¶ added in v5.9.0
GrafanaContactPointReconciler reconciles a GrafanaContactPoint object
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 ¶
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 (r *GrafanaDashboardReconciler) GetOrCreateFolder(client *genapi.GrafanaHTTPAPI, cr *v1beta1.GrafanaDashboard) (string, error)
func (*GrafanaDashboardReconciler) SetupWithManager ¶
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 ¶
GrafanaDatasourceReconciler reconciles a GrafanaDatasource object
func (*GrafanaDatasourceReconciler) Exists ¶
func (r *GrafanaDatasourceReconciler) Exists(client *genapi.GrafanaHTTPAPI, uid, name string) (bool, string, error)
func (*GrafanaDatasourceReconciler) SetupWithManager ¶
SetupWithManager sets up the controller with the Manager.
type GrafanaFolderReconciler ¶
GrafanaFolderReconciler reconciles a GrafanaFolder object
func (*GrafanaFolderReconciler) Exists ¶
func (r *GrafanaFolderReconciler) Exists(client *genapi.GrafanaHTTPAPI, cr *grafanav1beta1.GrafanaFolder) (bool, string, string, error)
Check if the folder exists. Matches UID first and fall back to title. Title matching only works for non-nested folders
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
GrafanaLibraryPanelReconciler reconciles a GrafanaLibraryPanel object
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
GrafanaMuteTimingReconciler reconciles a GrafanaMuteTiming object
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) 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
GrafanaNotificationTemplateReconciler reconciles a GrafanaNotificationTemplate object
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) SetupWithManager ¶
SetupWithManager sets up the controller with the Manager.
type GrafanaServiceAccountReconciler ¶ added in v5.20.0
GrafanaServiceAccountReconciler reconciles a GrafanaServiceAccount object.
func (*GrafanaServiceAccountReconciler) Reconcile ¶ added in v5.20.0
func (r *GrafanaServiceAccountReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
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.
Source Files
¶
- alertrulegroup_controller.go
- contactpoint_controller.go
- controller_shared.go
- dashboard_controller.go
- datasource_controller.go
- folder_controller.go
- grafana_controller.go
- librarypanel_controller.go
- mutetiming_controller.go
- notificationpolicy_controller.go
- notificationtemplate_controller.go
- serviceaccount_controller.go