Skip to content

Commit

Permalink
Merge pull request #65 from lleszczu/add_ingress_tls
Browse files Browse the repository at this point in the history
Add support for tls termination on ingress
  • Loading branch information
pb82 authored Oct 29, 2019
2 parents a35bd7b + c98c9ba commit 621936b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ORG?=integreatly
NAMESPACE=grafana
PROJECT=grafana-operator
REG=quay.io
REG?=quay.io
SHELL=/bin/bash
TAG?=latest
PKG=github.com/integr8ly/grafana-operator
Expand Down
12 changes: 7 additions & 5 deletions pkg/apis/integreatly/v1alpha1/grafana_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ type GrafanaService struct {

// GrafanaIngress provides a means to configure the ingress created
type GrafanaIngress struct {
Annotations map[string]string `json:"annotations,omitempty"`
Hostname string `json:"hostname,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Path string `json:"path,omitempty"`
Enabled bool `json:"enabled,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Hostname string `json:"hostname,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Path string `json:"path,omitempty"`
Enabled bool `json:"enabled,omitempty"`
TLSEnabled bool `json:"tlsEnabled,omitempty"`
TLSSecretName string `json:"tlsSecretName,omitempty"`
}

// GrafanaConfig is the configuration for grafana
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/grafana/templateHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type GrafanaParameters struct {
GrafanaIngressLabels map[string]string
GrafanaIngressName string
GrafanaIngressPath string
GrafanaIngressTLSEnabled bool
GrafanaIngressTLSSecretName string
GrafanaProvidersConfigMapName string
GrafanaRouteName string
GrafanaServiceAccountName string
Expand Down Expand Up @@ -123,6 +125,8 @@ func newTemplateHelper(cr *integreatly.Grafana) *TemplateHelper {
GrafanaIngressLabels: cr.Spec.Ingress.Labels,
GrafanaIngressName: common.GrafanaIngressName,
GrafanaIngressPath: cr.Spec.Ingress.Path,
GrafanaIngressTLSEnabled: cr.Spec.Ingress.TLSEnabled,
GrafanaIngressTLSSecretName: cr.Spec.Ingress.TLSSecretName,
GrafanaProvidersConfigMapName: common.GrafanaProvidersConfigMapName,
GrafanaRouteName: common.GrafanaRouteName,
GrafanaServiceAccountName: common.GrafanaServiceAccountName,
Expand Down
6 changes: 6 additions & 0 deletions templates/grafana-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ spec:
{{- if .GrafanaIngressPath }}
path: {{ .GrafanaServiceName }}
{{- end }}
{{- if .GrafanaIngressTLSEnabled }}
tls:
- hosts:
- {{ .Hostname }}
secretName: {{ .GrafanaIngressTLSSecretName }}
{{- end }}

0 comments on commit 621936b

Please sign in to comment.