Documentation ¶
Index ¶
- Constants
- func Add(mgr manager.Manager, namespace string) error
- func SetupWithManager(mgr ctrl.Manager, r reconcile.Reconciler, namespace string) error
- type DashboardPipeline
- type DashboardPipelineImpl
- type GrafanaClient
- type GrafanaClientImpl
- func (r *GrafanaClientImpl) CreateOrUpdateDashboard(dashboard []byte, folderID int64, folderName string) (GrafanaResponse, error)
- func (r *GrafanaClientImpl) CreateOrUpdateFolder(folderInputName string) (GrafanaFolderResponse, error)
- func (r *GrafanaClientImpl) DeleteDashboardByUID(UID string) (GrafanaResponse, error)
- func (r *GrafanaClientImpl) DeleteFolder(deleteID *int64) error
- func (r *GrafanaClientImpl) GetDashboard(UID string) (GrafanaDashboardResponse, error)
- func (r *GrafanaClientImpl) SafeToDelete(dashlist []*v1alpha1.GrafanaDashboardRef, id *int64) bool
- type GrafanaDashboard
- type GrafanaDashboardMeta
- type GrafanaDashboardReconciler
- type GrafanaDashboardResponse
- type GrafanaFolderRequest
- type GrafanaFolderResponse
- type GrafanaRequest
- type GrafanaResponse
- type SourceType
Constants ¶
const ( DeleteDashboardByUIDUrl = "%v/api/dashboards/uid/%v" CreateOrUpdateDashboardUrl = "%v/api/dashboards/db" CreateOrUpdateFolderUrl = "%v/api/folders" DeleteFolderByUIDUrl = "%v/api/folders/%v" GetFolderByIDUrl = "%v/api/folders/id/%v" )
const (
ControllerName = "controller_grafanadashboard"
)
const (
NonNamespacedFolderName = "Non-Namespaced"
)
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add creates a new GrafanaDashboard Controller and adds it to the Manager. The Manager will set fields on the Controller and Start it when the Manager is Started.
func SetupWithManager ¶
SetupWithManager sets up the controller with the Manager.
Types ¶
type DashboardPipeline ¶
type DashboardPipeline interface { ProcessDashboard(knownHash string, folderId *int64, folderName string, forceRecreate bool) ([]byte, error) NewHash() string }
func NewDashboardPipeline ¶
func NewDashboardPipeline(client client.Client, dashboard *v1alpha1.GrafanaDashboard, ctx context.Context) DashboardPipeline
type DashboardPipelineImpl ¶
type DashboardPipelineImpl struct { Client client.Client Dashboard *v1alpha1.GrafanaDashboard JSON string Board map[string]interface{} Logger logr.Logger Hash string Context context.Context }
func (*DashboardPipelineImpl) NewHash ¶
func (r *DashboardPipelineImpl) NewHash() string
func (*DashboardPipelineImpl) ProcessDashboard ¶
type GrafanaClient ¶
type GrafanaClient interface { CreateOrUpdateDashboard(dashboard []byte, folderId int64, folderName string) (GrafanaResponse, error) DeleteDashboardByUID(UID string) (GrafanaResponse, error) CreateOrUpdateFolder(folderName string) (GrafanaFolderResponse, error) DeleteFolder(folderID *int64) error SafeToDelete(dashboards []*v1alpha1.GrafanaDashboardRef, folderID *int64) bool GetDashboard(UID string) (GrafanaDashboardResponse, error) }
func NewGrafanaClient ¶
type GrafanaClientImpl ¶
type GrafanaClientImpl struct {
// contains filtered or unexported fields
}
func (*GrafanaClientImpl) CreateOrUpdateDashboard ¶
func (r *GrafanaClientImpl) CreateOrUpdateDashboard(dashboard []byte, folderID int64, folderName string) (GrafanaResponse, error)
Submit dashboard json to grafana
func (*GrafanaClientImpl) CreateOrUpdateFolder ¶
func (r *GrafanaClientImpl) CreateOrUpdateFolder(folderInputName string) (GrafanaFolderResponse, error)
func (*GrafanaClientImpl) DeleteDashboardByUID ¶
func (r *GrafanaClientImpl) DeleteDashboardByUID(UID string) (GrafanaResponse, error)
Delete a dashboard given by a UID
func (*GrafanaClientImpl) DeleteFolder ¶
func (r *GrafanaClientImpl) DeleteFolder(deleteID *int64) error
func (*GrafanaClientImpl) GetDashboard ¶
func (r *GrafanaClientImpl) GetDashboard(UID string) (GrafanaDashboardResponse, error)
func (*GrafanaClientImpl) SafeToDelete ¶
func (r *GrafanaClientImpl) SafeToDelete(dashlist []*v1alpha1.GrafanaDashboardRef, id *int64) bool
type GrafanaDashboard ¶
type GrafanaDashboardMeta ¶
type GrafanaDashboardReconciler ¶
type GrafanaDashboardReconciler struct { Client client.Client Scheme *runtime.Scheme Log logr.Logger // contains filtered or unexported fields }
GrafanaDashboardReconciler reconciles a GrafanaDashboard object
func (*GrafanaDashboardReconciler) Reconcile ¶
func (r *GrafanaDashboardReconciler) Reconcile(ctx context.Context, request 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 GrafanaDashboard 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.7.0/pkg/reconcile
func (*GrafanaDashboardReconciler) SetupWithManager ¶
func (r *GrafanaDashboardReconciler) SetupWithManager(mgr manager.Manager) error
type GrafanaDashboardResponse ¶
type GrafanaDashboardResponse struct { Meta *GrafanaDashboardMeta `json:"meta,omitempty"` Dashboard *GrafanaDashboard `json:"dashboard,omitempty"` }
type GrafanaFolderRequest ¶
type GrafanaFolderRequest struct {
Title string `json:"title"`
}
type GrafanaFolderResponse ¶
type GrafanaRequest ¶
type GrafanaRequest struct { Dashboard json.RawMessage `json:"dashboard"` FolderId int64 `json:"folderId"` FolderName string `json:"folderName"` Overwrite bool `json:"overwrite"` }
type GrafanaResponse ¶
type GrafanaResponse struct { ID *uint `json:"id"` OrgID *uint `json:"orgId"` Message *string `json:"message"` Slug *string `json:"slug"` Version *int `json:"version"` Status *string `json:"resp"` UID *string `json:"uid"` URL *string `json:"url"` FolderId *int64 `json:"folderId"` FolderName string `json:"folderName"` }
type SourceType ¶
type SourceType int
const ( SourceTypeJson SourceType = 1 SourceTypeJsonnet SourceType = 2 SourceTypeUnknown SourceType = 3 )