Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Prometheus Operator: Allow user to expose grafana
Browse files Browse the repository at this point in the history
This commit adds a new variable `grafana_ingress_host` where user can
provide the Ingress Host URL to expose Grafana on.

Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
  • Loading branch information
surajssd committed May 21, 2020
1 parent 50122a6 commit 8f36081
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/components/prometheus-operator/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ type CoreDNS struct {
}

type component struct {
GrafanaAdminPassword string `hcl:"grafana_admin_password,attr"`
Namespace string `hcl:"namespace,optional"`
EtcdEndpoints []string `hcl:"etcd_endpoints,optional"`
GrafanaAdminPassword string `hcl:"grafana_admin_password,attr"`
GrafanaIngressHost string `hcl:"grafana_ingress_host,optional"`

Namespace string `hcl:"namespace,optional"`
EtcdEndpoints []string `hcl:"etcd_endpoints,optional"`

PrometheusOperatorNodeSelector map[string]string `hcl:"prometheus_operator_node_selector,optional"`

Expand Down
17 changes: 17 additions & 0 deletions pkg/components/prometheus-operator/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ alertmanager:
resources:
requests:
storage: "{{.AlertManagerStorageSize}}"
grafana:
adminPassword: {{.GrafanaAdminPassword}}
testFramework:
Expand All @@ -55,6 +57,21 @@ grafana:
searchNamespace: ALL
rbac:
pspUseAppArmor: false
ingress:
enabled: {{printf "%t" (ne .GrafanaIngressHost "")}}
annotations:
kubernetes.io/ingress.class: contour
kubernetes.io/tls-acme: "true"
cert-manager.io/cluster-issuer: "letsencrypt-production"
hosts:
- {{ .GrafanaIngressHost }}
tls:
- hosts:
- {{ .GrafanaIngressHost }}
secretName: {{ .GrafanaIngressHost }}-tls
kubeEtcd:
enabled: {{.Monitor.Etcd}}
endpoints: {{.EtcdEndpoints}}
Expand Down

0 comments on commit 8f36081

Please sign in to comment.