Skip to content

Commit

Permalink
PR #3 - Customize Grafana Plugin image
Browse files Browse the repository at this point in the history
  • Loading branch information
neoludo committed Jun 13, 2019
1 parent adf145f commit fd310e6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
var log = logf.Log.WithName("cmd")
var flagImage string
var flagImageTag string
var flagPluginsInitContainerImage string
var scanAll bool
var openshift bool

Expand All @@ -39,6 +40,7 @@ func init() {
flagset := flag.CommandLine
flagset.StringVar(&flagImage, "grafana-image", "", "Overrides the default Grafana image")
flagset.StringVar(&flagImageTag, "grafana-image-tag", "", "Overrides the default Grafana image tag")
flagset.StringVar(&flagPluginsInitContainerImage, "grafana-plugins-init-container-image", "", "Overrides the default Grafana Plugins Init Container image")
flagset.BoolVar(&scanAll, "scan-all", false, "Scans all namespaces for dashboards")
flagset.BoolVar(&openshift, "openshift", false, "Use Route instead of Ingress")
flagset.Parse(os.Args[1:])
Expand Down Expand Up @@ -89,6 +91,7 @@ func main() {
controllerConfig := common.GetControllerConfig()
controllerConfig.AddConfigItem(common.ConfigGrafanaImage, flagImage)
controllerConfig.AddConfigItem(common.ConfigGrafanaImageTag, flagImageTag)
controllerConfig.AddConfigItem(common.PluginsInitContainerImage, flagPluginsInitContainerImage)
controllerConfig.AddConfigItem(common.ConfigOperatorNamespace, namespace)
controllerConfig.AddConfigItem(common.ConfigDashboardLabelSelector, "")
controllerConfig.AddConfigItem(common.ConfigOpenshift, openshift)
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/common/controller_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
GrafanaRouteName = "grafana-route"
GrafanaIngressName = "grafana-ingress"
GrafanaServiceName = "grafana-service"
PluginsInitContainerImage = "quay.io/integreatly/grafana_plugins_init"
PluginsInitContainerImageTag = "0.0.2"
PluginsEnvVar = "GRAFANA_PLUGINS"
PluginsUrl = "https://grafana.com/api/plugins/%s/versions/%s"
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller/grafana/templateHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type GrafanaParamaeters struct {
LogLevel string
GrafanaRouteName string
GrafanaServiceName string
PluginsInitContainerImage string
PluginsInitContainerImageTag string
GrafanaIngressName string
Hostname string
Expand Down Expand Up @@ -91,6 +92,7 @@ func newTemplateHelper(cr *integreatly.Grafana) *TemplateHelper {
LogLevel: getLogLevel(cr.Spec.LogLevel),
GrafanaRouteName: common.GrafanaRouteName,
GrafanaServiceName: common.GrafanaServiceName,
PluginsInitContainerImage: common.PluginsInitContainerImage,
PluginsInitContainerImageTag: common.PluginsInitContainerImageTag,
GrafanaIngressName: common.GrafanaIngressName,
Hostname: cr.Spec.Hostname,
Expand Down
2 changes: 1 addition & 1 deletion templates/grafana-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
- env:
- name: GRAFANA_PLUGINS
value: ""
image: 'quay.io/integreatly/grafana_plugins_init:{{ .PluginsInitContainerImageTag }}'
image: '{{ .PluginsInitContainerImage }}:{{ .PluginsInitContainerImageTag }}'
imagePullPolicy: IfNotPresent
name: grafana-plugins-init
resources: {}
Expand Down

0 comments on commit fd310e6

Please sign in to comment.