You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2023/02/05 22:26:50 UTC
[streampipes] branch 1207-improve-helm-charts updated: Add configmap to manage nginx configuration (#1207)
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch 1207-improve-helm-charts
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/1207-improve-helm-charts by this push:
new 6a88fc7b5 Add configmap to manage nginx configuration (#1207)
6a88fc7b5 is described below
commit 6a88fc7b56251e86d179e47c325f89f3bca99d90
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sun Feb 5 23:26:38 2023 +0100
Add configmap to manage nginx configuration (#1207)
---
.../k8s/templates/core/backend-deployment.yaml | 6 +--
installer/k8s/templates/core/backend-service.yaml | 2 +-
installer/k8s/templates/core/ui-configmap.yaml | 61 ++++++++++++++++++++++
.../templates/core/{ui.yaml => ui-deployment.yaml} | 18 +++++--
installer/k8s/templates/core/ui-ingress.yaml | 4 +-
installer/k8s/templates/core/ui-service.yaml | 8 +--
installer/k8s/values.yaml | 4 ++
7 files changed, 86 insertions(+), 17 deletions(-)
diff --git a/installer/k8s/templates/core/backend-deployment.yaml b/installer/k8s/templates/core/backend-deployment.yaml
index e8745c440..bd0d081d1 100644
--- a/installer/k8s/templates/core/backend-deployment.yaml
+++ b/installer/k8s/templates/core/backend-deployment.yaml
@@ -41,11 +41,7 @@ spec:
imagePullPolicy: {{ .Values.pullPolicy }}
env:
- name: SP_PRIORITIZED_PROTOCOL
- {{ if (eq .Values.preferredBroker "nats") }}
- value: "nats"
- {{ else }}
- value: "kafka"
- {{ end }}
+ value: {{ .Values.preferredBroker }}
ports:
- containerPort: 8030
volumeMounts:
diff --git a/installer/k8s/templates/core/backend-service.yaml b/installer/k8s/templates/core/backend-service.yaml
index 133dde085..64c3fa511 100644
--- a/installer/k8s/templates/core/backend-service.yaml
+++ b/installer/k8s/templates/core/backend-service.yaml
@@ -16,7 +16,7 @@
apiVersion: v1
kind: Service
metadata:
- name: {{ .Values.streampipes.core.appName }}
+ name: {{ .Values.streampipes.core.svcName }}
spec:
selector:
app: {{ .Values.streampipes.core.appName }}
diff --git a/installer/k8s/templates/core/ui-configmap.yaml b/installer/k8s/templates/core/ui-configmap.yaml
new file mode 100644
index 000000000..6085b088b
--- /dev/null
+++ b/installer/k8s/templates/core/ui-configmap.yaml
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: nginx-conf
+data:
+ default.conf: |
+ server {
+ listen {{ .Values.streampipes.ui.port }} default_server;
+ resolver 127.0.0.11;
+ root /usr/share/nginx/html;
+
+ # Enable gzip compression
+ gzip on;
+ gzip_static on;
+ gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+ gzip_proxied any;
+ gzip_vary on;
+ gzip_comp_level 6;
+ gzip_buffers 16 8k;
+ gzip_http_version 1.1;
+
+ location /streampipes-backend {
+ set $upstream {{ .Values.streampipes.core.svcName }}:8030;
+
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-NginX-Proxy true;
+ proxy_pass http://$upstream;
+ proxy_ssl_session_reuse off;
+ proxy_set_header Host $http_host;
+ proxy_redirect off;
+ }
+
+ location /streampipes-connect/ {
+ set $upstream {{ .Values.streampipes.core.svcName }}:8030;
+
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-NginX-Proxy true;
+ proxy_pass http://$upstream;
+ proxy_ssl_session_reuse off;
+ proxy_set_header Host $http_host;
+ }
+
+ }
+
diff --git a/installer/k8s/templates/core/ui.yaml b/installer/k8s/templates/core/ui-deployment.yaml
similarity index 72%
rename from installer/k8s/templates/core/ui.yaml
rename to installer/k8s/templates/core/ui-deployment.yaml
index 09a457ef2..81f59553c 100644
--- a/installer/k8s/templates/core/ui.yaml
+++ b/installer/k8s/templates/core/ui-deployment.yaml
@@ -16,23 +16,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
- name: ui
+ name: {{ .Values.streampipes.ui.appName }}
spec:
selector:
matchLabels:
- app: ui
+ app: {{ .Values.streampipes.ui.appName }}
replicas: 1
template:
metadata:
labels:
- app: ui
+ app: {{ .Values.streampipes.ui.appName }}
spec:
+ volumes:
+ - name: nginx-conf
+ configMap:
+ name: nginx-conf # place ConfigMap `nginx-conf` on /etc/nginx
containers:
- - name: ui
+ - name: {{ .Values.streampipes.ui.appName }}
image: {{ .Values.streampipes.registry }}/ui:{{ .Values.streampipes.version }}
imagePullPolicy: {{ .Values.pullPolicy }}
ports:
- - containerPort: 80
+ - containerPort: {{ .Values.streampipes.ui.port }}
+ volumeMounts:
+ - name: nginx-conf
+ mountPath: /etc/nginx/conf.d/default.conf
+ subPath: default.conf
# This is necessary because a custom dns resolver is set in nginx default conf
- name: dnsmasq
image: fogsyio/go-dnsmasq:1.0.7
diff --git a/installer/k8s/templates/core/ui-ingress.yaml b/installer/k8s/templates/core/ui-ingress.yaml
index 2f0c2933c..77dd8a5ee 100644
--- a/installer/k8s/templates/core/ui-ingress.yaml
+++ b/installer/k8s/templates/core/ui-ingress.yaml
@@ -25,6 +25,6 @@ spec:
pathType: Prefix
backend:
service:
- name: ui
+ name: {{ .Values.streampipes.ui.appName }}
port:
- number: 80
+ number: {{ .Values.streampipes.ui.port }}
diff --git a/installer/k8s/templates/core/ui-service.yaml b/installer/k8s/templates/core/ui-service.yaml
index f1e3bb75f..c380df066 100644
--- a/installer/k8s/templates/core/ui-service.yaml
+++ b/installer/k8s/templates/core/ui-service.yaml
@@ -16,13 +16,13 @@
apiVersion: v1
kind: Service
metadata:
- name: ui
+ name: {{ .Values.streampipes.ui.appName }}
spec:
selector:
- app: ui
+ app: {{ .Values.streampipes.ui.appName }}
type: NodePort
ports:
- name: main
protocol: TCP
- port: 80
- targetPort: 80
\ No newline at end of file
+ port: {{ .Values.streampipes.ui.port }}
+ targetPort: {{ .Values.streampipes.ui.port }}
diff --git a/installer/k8s/values.yaml b/installer/k8s/values.yaml
index a7fdffa5e..8663e18b0 100644
--- a/installer/k8s/values.yaml
+++ b/installer/k8s/values.yaml
@@ -25,10 +25,14 @@ streampipes:
registry: "apachestreampipes"
core:
appName: "backend"
+ svcName: "backend"
persistence:
storageClassName: ""
claimName: "backend-pvc"
pvName: "backend-pv"
+ ui:
+ appName: "ui"
+ port: 8088
external:
consul: