From f2fda4f23299f2466e990d767539f024979fa2fe Mon Sep 17 00:00:00 2001 From: Alex Merkulov Date: Tue, 25 Feb 2020 09:56:57 +0200 Subject: [PATCH 1/2] ingresses --- .../templates/_helpers.tpl | 8 +++ .../templates/ingress-audit.yaml | 3 ++ .../templates/ingress-notifications.yaml | 54 +++++++++++++++++++ .../{ingress.yaml => ingress-query.yaml} | 0 charts/activiti-cloud-query/values.yaml | 50 ++++++++++++++++- 5 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 charts/activiti-cloud-query/templates/ingress-audit.yaml create mode 100644 charts/activiti-cloud-query/templates/ingress-notifications.yaml rename charts/activiti-cloud-query/templates/{ingress.yaml => ingress-query.yaml} (100%) diff --git a/charts/activiti-cloud-query/templates/_helpers.tpl b/charts/activiti-cloud-query/templates/_helpers.tpl index f0d83d2..5348036 100644 --- a/charts/activiti-cloud-query/templates/_helpers.tpl +++ b/charts/activiti-cloud-query/templates/_helpers.tpl @@ -14,3 +14,11 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{/* +Create a default service name. +*/}} +{{- define "servicename" -}} +{{- $name := default (include "fullname" .) .Values.service.name -}} +{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} \ No newline at end of file diff --git a/charts/activiti-cloud-query/templates/ingress-audit.yaml b/charts/activiti-cloud-query/templates/ingress-audit.yaml new file mode 100644 index 0000000..132e231 --- /dev/null +++ b/charts/activiti-cloud-query/templates/ingress-audit.yaml @@ -0,0 +1,3 @@ +{{- template "common.ingress" (list . "activiti.audit.ingress") -}} +{{- define "activiti.audit.ingress" -}} +{{- end -}} \ No newline at end of file diff --git a/charts/activiti-cloud-query/templates/ingress-notifications.yaml b/charts/activiti-cloud-query/templates/ingress-notifications.yaml new file mode 100644 index 0000000..da5d209 --- /dev/null +++ b/charts/activiti-cloud-query/templates/ingress-notifications.yaml @@ -0,0 +1,54 @@ +{{- if .Values.ingress.enabled }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }}-notifications + labels: + app: {{ template "fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: +{{ toYaml .Values.ingress.notificationsannotations | indent 8 }} +spec: + rules: + {{- if include "common.ingress-host" . }} + - host: {{ template "common.ingress-host" . }} + http: + {{- else }} + - http: + {{- end }} + paths: + {{- if .Values.ingress.actuator.enabled }} + - path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.actuator.path . }} + backend: + serviceName: {{ template "servicename" . }} + servicePort: {{ .Values.service.externalPort }} + {{- end }} + {{- if .Values.ingress.web.enabled }} + - path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.web.path . }} + backend: + serviceName: {{ template "servicename" . }} + servicePort: {{ .Values.service.externalPort }} + {{- end }} + {{- if .Values.ingress.ws.enabled }} + - path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.ws.path . }} + backend: + serviceName: {{ template "servicename" . }} + servicePort: {{ .Values.service.externalPort }} + {{- end }} + {{- if .Values.ingress.graphiql.enabled }} + - path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.graphiql.path . }} + backend: + serviceName: {{ template "servicename" . }} + servicePort: {{ .Values.service.externalPort }} + {{- end }} + {{- if include "common.ingress-tls" . }} + tls: + - secretName: {{ template "common.ingress-tlssecretname" . }} + {{- if include "common.ingress-host" . }} + hosts: + - {{ template "common.ingress-host" . }} + {{- end }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/activiti-cloud-query/templates/ingress.yaml b/charts/activiti-cloud-query/templates/ingress-query.yaml similarity index 100% rename from charts/activiti-cloud-query/templates/ingress.yaml rename to charts/activiti-cloud-query/templates/ingress-query.yaml diff --git a/charts/activiti-cloud-query/values.yaml b/charts/activiti-cloud-query/values.yaml index dd5df0b..9c47dad 100644 --- a/charts/activiti-cloud-query/values.yaml +++ b/charts/activiti-cloud-query/values.yaml @@ -113,4 +113,52 @@ ingress: tlsSecret: ## Ingress annotations done as key:value pairs - annotations: {} + annotations: + ingress: + # Set to true to enable ingress record generation + + #path: /notifications # configure base path template for ingress, i.e. /{{ .Release.Name }}/notifications + + actuator: + enabled: true + path: /notifications/actuator + graphiql: + enabled: true + path: /notifications/graphiql + web: + enabled: true + path: /notifications/graphql + ws: + enabled: true + path: /notifications/ws/graphql + query: + enabled: true + path: /query + audit: + enabled: true + path: /audit + + + + + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/cors-allow-header: X-Forwarded-For, X-Forwarded-Proto, + X-Forwarded-Port, X-Forwarded-Prefix, Authorization, Content-Type, Accept + nginx.ingress.kubernetes.io/enable-cors: "true" + nginx.ingress.kubernetes.io/rewrite-target: /$1 + nginx.ingress.kubernetes.io/x-forwarded-prefix: "true" + + notificationsannotations: + kubernetes.io/ingress.class: "nginx" + nginx.ingress.kubernetes.io/enable-cors: "true" + nginx.ingress.kubernetes.io/cors-allow-headers: "*" + nginx.ingress.kubernetes.io/cors-allow-methods: "GET,PUT,POST,DELETE,PATCH,OPTIONS" + nginx.ingress.kubernetes.io/cors-allow-credentials: "true" + nginx.ingress.kubernetes.io/configuration-snippet: | + more_set_headers 'Access-Control-Allow-Origin: $http_origin'; + nginx.ingress.kubernetes.io/x-forwarded-prefix: "true" + nginx.ingress.kubernetes.io/affinity: cookie + nginx.ingress.kubernetes.io/session-cookie-name: "activiti-cloud-notifications-graphql-route" + nginx.ingress.kubernetes.io/session-cookie-hash: "md5" + nginx.ingress.kubernetes.io/session-cookie-path: '{{ include "common.ingress-path" . }}' From dbda78ef87088a4b749c810789d23404a01dc260 Mon Sep 17 00:00:00 2001 From: Alex Merkulov Date: Tue, 25 Feb 2020 17:41:10 +0200 Subject: [PATCH 2/2] query update --- .../templates/ingress-audit.yaml | 12 ++++++++++++ .../templates/ingress-query.yaml | 12 ++++++++++++ charts/activiti-cloud-query/values.yaml | 4 ++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/charts/activiti-cloud-query/templates/ingress-audit.yaml b/charts/activiti-cloud-query/templates/ingress-audit.yaml index 132e231..4bfc487 100644 --- a/charts/activiti-cloud-query/templates/ingress-audit.yaml +++ b/charts/activiti-cloud-query/templates/ingress-audit.yaml @@ -1,3 +1,15 @@ {{- template "common.ingress" (list . "activiti.audit.ingress") -}} {{- define "activiti.audit.ingress" -}} +pec: + rules: + {{- if include "common.ingress-host" . }} + - host: {{ template "common.ingress-host" . }} + http: + {{- else }} + - http: + {{- end }} + paths: + {{- if .Values.ingress.audit.enabled }} + - path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.audit.path . }} + {{- end -}} {{- end -}} \ No newline at end of file diff --git a/charts/activiti-cloud-query/templates/ingress-query.yaml b/charts/activiti-cloud-query/templates/ingress-query.yaml index 6de3fc2..d663246 100644 --- a/charts/activiti-cloud-query/templates/ingress-query.yaml +++ b/charts/activiti-cloud-query/templates/ingress-query.yaml @@ -1,3 +1,15 @@ {{- template "common.ingress" (list . "activiti.query.ingress") -}} {{- define "activiti.query.ingress" -}} +pec: + rules: + {{- if include "common.ingress-host" . }} + - host: {{ template "common.ingress-host" . }} + http: + {{- else }} + - http: + {{- end }} + paths: + {{- if .Values.ingress.query.enabled }} + - path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.query.path . }} + {{- end -}} {{- end -}} \ No newline at end of file diff --git a/charts/activiti-cloud-query/values.yaml b/charts/activiti-cloud-query/values.yaml index 9c47dad..13e21e5 100644 --- a/charts/activiti-cloud-query/values.yaml +++ b/charts/activiti-cloud-query/values.yaml @@ -133,10 +133,10 @@ ingress: path: /notifications/ws/graphql query: enabled: true - path: /query + path: /query/?(.*) audit: enabled: true - path: /audit + path: /audit/?(.*)