From c61c45f72def4e692e5ff58b080c688fc6e660d8 Mon Sep 17 00:00:00 2001 From: Steven Fitzpatrick Date: Wed, 9 Sep 2020 14:05:54 +0000 Subject: [PATCH] Alerta: Add ingress templates This change adds templates to the alerta chart for enabling ingress to the application Change-Id: I5e4fb71465555dc1cb113bc4332d3c3957f81a45 --- alerta/templates/ingress.yaml | 18 ++++++++++++++++++ alerta/templates/secret-ingress-tls.yaml | 17 +++++++++++++++++ alerta/templates/service-ingress.yaml | 18 ++++++++++++++++++ alerta/templates/service.yaml | 2 +- alerta/values.yaml | 19 +++++++++++++++++++ 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 alerta/templates/ingress.yaml create mode 100644 alerta/templates/secret-ingress-tls.yaml create mode 100644 alerta/templates/service-ingress.yaml diff --git a/alerta/templates/ingress.yaml b/alerta/templates/ingress.yaml new file mode 100644 index 000000000..54cc6404d --- /dev/null +++ b/alerta/templates/ingress.yaml @@ -0,0 +1,18 @@ +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if and .Values.manifests.alerta.ingress .Values.network.alerta.ingress.public }} +{{- $ingressOpts := dict "envAll" . "backendService" "alerta" "backendServiceType" "alerta" "backendPort" "server" -}} +{{ $ingressOpts | include "helm-toolkit.manifests.ingress" }} +{{- end }} diff --git a/alerta/templates/secret-ingress-tls.yaml b/alerta/templates/secret-ingress-tls.yaml new file mode 100644 index 000000000..7655f3ff3 --- /dev/null +++ b/alerta/templates/secret-ingress-tls.yaml @@ -0,0 +1,17 @@ +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.secret_ingress_tls }} +{{- include "helm-toolkit.manifests.secret_ingress_tls" ( dict "envAll" . "backendServiceType" "alerta" "backendService" "alerta" ) }} +{{- end }} diff --git a/alerta/templates/service-ingress.yaml b/alerta/templates/service-ingress.yaml new file mode 100644 index 000000000..c8ba82d1b --- /dev/null +++ b/alerta/templates/service-ingress.yaml @@ -0,0 +1,18 @@ +{{/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if and .Values.manifests.service_ingress .Values.network.alerta.ingress.public }} +{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "alerta" -}} +{{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }} +{{- end }} diff --git a/alerta/templates/service.yaml b/alerta/templates/service.yaml index 5d046425e..a17848928 100644 --- a/alerta/templates/service.yaml +++ b/alerta/templates/service.yaml @@ -21,7 +21,7 @@ metadata: name: alerta spec: ports: - - name: http + - name: server {{ if .Values.network.alerta.node_port.enabled }} nodePort: {{ .Values.network.alerta.node_port.port }} {{ end }} diff --git a/alerta/values.yaml b/alerta/values.yaml index aa579af7b..ead0410f4 100644 --- a/alerta/values.yaml +++ b/alerta/values.yaml @@ -151,6 +151,10 @@ endpoints: secrets: postgresql: admin: postgresql-admin + tls: + alerta: + alerta: + public: alerta-tls-public storage: [] @@ -160,6 +164,18 @@ jobs: [] network: alerta: + ingress: + public: true + classes: + namespace: "nginx" + cluster: "nginx-cluster" + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/affinity: cookie + nginx.ingress.kubernetes.io/session-cookie-name: kube-ingress-session-alerta + nginx.ingress.kubernetes.io/session-cookie-hash: sha1 + nginx.ingress.kubernetes.io/session-cookie-expires: "600" + nginx.ingress.kubernetes.io/session-cookie-max-age: "600" node_port: enabled: true port: 30480 @@ -171,8 +187,11 @@ manifests: configmap_bin: true configmap_etc: true deployment: true + ingress: false secret: true + secret_ingress_tls: false service: true + service_ingress: false create_db: true conf: