Documentation ¶
Index ¶
- Constants
- Variables
- func Add(mgr manager.Manager) error
- type GrafanaParamaeters
- type PluginsHelperImpl
- func (h *PluginsHelperImpl) AppendMessage(message string, dashboard *integreatly.GrafanaDashboard)
- func (h *PluginsHelperImpl) BuildEnv(cr *integreatly.Grafana) string
- func (h *PluginsHelperImpl) CanUpdatePlugins() bool
- func (h *PluginsHelperImpl) FilterPlugins(cr *integreatly.Grafana, requested integreatly.PluginList) (integreatly.PluginList, bool)
- func (h *PluginsHelperImpl) PickLatestVersions(requested integreatly.PluginList) (integreatly.PluginList, error)
- func (h *PluginsHelperImpl) PluginExists(plugin integreatly.GrafanaPlugin) bool
- type ReconcileGrafana
- func (r *ReconcileGrafana) CreateConfigFiles(cr *i8ly.Grafana) (reconcile.Result, error)
- func (r *ReconcileGrafana) CreateDeployment(cr *i8ly.Grafana, resourceName string) error
- func (r *ReconcileGrafana) CreateResource(cr *i8ly.Grafana, resourceName string) error
- func (r *ReconcileGrafana) CreateServiceAccount(cr *i8ly.Grafana, resourceName string) error
- func (r *ReconcileGrafana) DeployResource(cr *i8ly.Grafana, resource runtime.Object, resourceName string) error
- func (r *ReconcileGrafana) InstallGrafana(cr *i8ly.Grafana) (reconcile.Result, error)
- func (r *ReconcileGrafana) Reconcile(request reconcile.Request) (reconcile.Result, error)
- func (r *ReconcileGrafana) ReconcileDashboardPlugins(cr *i8ly.Grafana) (reconcile.Result, error)
- func (r *ReconcileGrafana) ReconcilePlugins(cr *i8ly.Grafana, plugins []i8ly.GrafanaPlugin) error
- func (r *ReconcileGrafana) UpdateDashboardMessages(plugins i8ly.PluginList) error
- func (r *ReconcileGrafana) UpdatePhase(cr *i8ly.Grafana, phase int) (reconcile.Result, error)
- type ResourceHelper
- type TemplateHelper
- type UnstructuredResourceMap
Constants ¶
const ( PhaseConfigFiles int = iota PhaseInstallGrafana PhaseDone PhasePlugins )
const (
DefaultLogLevel = "info"
)
const OpenShiftOAuthRedirect = "serviceaccounts.openshift.io/oauth-redirectreference.primary"
const ReconcilePauseSeconds = 5
Variables ¶
var MockCR = v1alpha1.Grafana{ ObjectMeta: v1.ObjectMeta{ Name: "test", Namespace: "dummy", }, Spec: v1alpha1.GrafanaSpec{ Containers: []v12.Container{}, }, }
var MockDashboard = v1alpha1.GrafanaDashboard{ Status: v1alpha1.GrafanaDashboardStatus{ Messages: []v1alpha1.GrafanaDashboardStatusMessage{}, }, }
var MockGrafana = v1alpha1.Grafana{ Status: v1alpha1.GrafanaStatus{ Phase: 0, InstalledPlugins: v1alpha1.PluginList{}, }, }
var MockPluginList = v1alpha1.PluginList{Mockplugina100, Mockplugina101, Mockpluginb100}
var Mockplugina100 = v1alpha1.GrafanaPlugin{
Name: "a",
Version: "1.0.0",
}
var Mockplugina101 = v1alpha1.GrafanaPlugin{
Name: "a",
Version: "1.0.1",
}
var Mockplugina102 = v1alpha1.GrafanaPlugin{
Name: "a",
Version: "1.0.2",
}
var Mockpluginb100 = v1alpha1.GrafanaPlugin{
Name: "b",
Version: "1.0.0",
}
var Mockpluginc100 = v1alpha1.GrafanaPlugin{
Name: "c",
Version: "1.0.0",
}
Functions ¶
Types ¶
type GrafanaParamaeters ¶
type GrafanaParamaeters struct { GrafanaImage string GrafanaVersion string Namespace string GrafanaConfigMapName string GrafanaProvidersConfigMapName string GrafanaDatasourcesConfigMapName string GrafanaDashboardsConfigMapName string GrafanaServiceAccountName string GrafanaDeploymentName string LogLevel string GrafanaRouteName string GrafanaServiceName string PluginsInitContainerImage string PluginsInitContainerTag string GrafanaIngressName string Hostname string AdminUser string AdminPassword string BasicAuth bool DisableLoginForm bool DisableSignoutMenu bool Anonymous bool }
type PluginsHelperImpl ¶
func (*PluginsHelperImpl) AppendMessage ¶
func (h *PluginsHelperImpl) AppendMessage(message string, dashboard *integreatly.GrafanaDashboard)
Append a status message to the origin dashboard of a plugin
func (*PluginsHelperImpl) BuildEnv ¶
func (h *PluginsHelperImpl) BuildEnv(cr *integreatly.Grafana) string
Turns an array of plugins into a string representation of the form `<name>:<version>,...` that is used as the value for the GRAFANA_PLUGINS environment variable
func (*PluginsHelperImpl) CanUpdatePlugins ¶
func (h *PluginsHelperImpl) CanUpdatePlugins() bool
func (*PluginsHelperImpl) FilterPlugins ¶
func (h *PluginsHelperImpl) FilterPlugins(cr *integreatly.Grafana, requested integreatly.PluginList) (integreatly.PluginList, bool)
Creates the list of plugins that can be added or updated Does not directly deal with removing plugins: if a plugin is not in the list and the env var is updated, it will automatically be removed
func (*PluginsHelperImpl) PickLatestVersions ¶
func (h *PluginsHelperImpl) PickLatestVersions(requested integreatly.PluginList) (integreatly.PluginList, error)
Append a status message to the origin dashboard of a plugin
func (*PluginsHelperImpl) PluginExists ¶
func (h *PluginsHelperImpl) PluginExists(plugin integreatly.GrafanaPlugin) bool
Query the Grafana plugin database for the given plugin and version A 200 OK response indicates that the plugin exists and can be downloaded
type ReconcileGrafana ¶
type ReconcileGrafana struct {
// contains filtered or unexported fields
}
ReconcileGrafana reconciles a Grafana object
func (*ReconcileGrafana) CreateConfigFiles ¶
func (*ReconcileGrafana) CreateDeployment ¶
func (r *ReconcileGrafana) CreateDeployment(cr *i8ly.Grafana, resourceName string) error
Creates the deployment from the template and injects any specified extra containers before submitting it
func (*ReconcileGrafana) CreateResource ¶
func (r *ReconcileGrafana) CreateResource(cr *i8ly.Grafana, resourceName string) error
Creates a generic kubernetes resource from a template
func (*ReconcileGrafana) CreateServiceAccount ¶
func (r *ReconcileGrafana) CreateServiceAccount(cr *i8ly.Grafana, resourceName string) error
func (*ReconcileGrafana) DeployResource ¶
func (r *ReconcileGrafana) DeployResource(cr *i8ly.Grafana, resource runtime.Object, resourceName string) error
Deploys a resource given by a runtime object
func (*ReconcileGrafana) InstallGrafana ¶
func (*ReconcileGrafana) Reconcile ¶
Reconcile reads that state of the cluster for a Grafana object and makes changes based on the state read and what is in the Grafana.Spec
func (*ReconcileGrafana) ReconcileDashboardPlugins ¶
func (*ReconcileGrafana) ReconcilePlugins ¶
func (r *ReconcileGrafana) ReconcilePlugins(cr *i8ly.Grafana, plugins []i8ly.GrafanaPlugin) error
func (*ReconcileGrafana) UpdateDashboardMessages ¶
func (r *ReconcileGrafana) UpdateDashboardMessages(plugins i8ly.PluginList) error
func (*ReconcileGrafana) UpdatePhase ¶
type ResourceHelper ¶
type ResourceHelper struct {
// contains filtered or unexported fields
}
Helps with creating kubernetes resources from yaml templates
type TemplateHelper ¶
type TemplateHelper struct { Parameters GrafanaParamaeters TemplatePath string }
type UnstructuredResourceMap ¶
type UnstructuredResourceMap struct {
Values map[string]interface{}
}
An abstraction type that allows easier access to the contents of an unstructured resource