Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.

Commit ff82e66

Browse files
committed
fix: (Chart) remove Nginx rewrite-path: / annotation
1 parent 3a2f02e commit ff82e66

File tree

5 files changed

+142
-108
lines changed

5 files changed

+142
-108
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Create a default tls secrtet name.
4+
*/}}
5+
{{- define "tlssecretname" -}}
6+
{{- tpl (default (printf "tls-%s" (include "ingresshost" $) ) (default .Values.global.gateway.tlsSecret .Values.ingress.tlsSecret)) $ | replace "." "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default ingress host.
11+
*/}}
12+
{{- define "ingresshost" -}}
13+
{{- tpl (default (printf "%s.%s" (include "gateway-prefix" $) (include "domain" $)) ( default .Values.global.gateway.host .Values.ingress.hostName ) ) $ -}}
14+
{{- end -}}
15+
16+
{{/*
17+
Create a keycloak url.
18+
*/}}
19+
{{- define "keycloak-url" -}}
20+
{{- tpl (printf "%s" (default (include "keycloak-default-url" $) .Values.global.keycloak.url )) $ -}}
21+
{{- end -}}
22+
23+
{{/*
24+
Create a default keycloak url
25+
*/}}
26+
{{- define "keycloak-default-url" -}}
27+
{{- printf "%s://%s%s" (include "keycloak-proto" $) (include "keycloak-host" $) (include "keycloak-path" $) -}}
28+
{{- end -}}
29+
30+
{{/*
31+
Create a keycloak path, .i.e /auth.
32+
*/}}
33+
{{- define "keycloak-path" -}}
34+
{{- default "/auth" .Values.global.keycloak.path -}}
35+
{{- end -}}
36+
37+
{{/*
38+
Create a keycloak prefix, .i.e activiti-keycloak
39+
*/}}
40+
{{- define "keycloak-prefix" -}}
41+
{{- default "activiti-keycloak" (default .Values.global.config.prefix .Values.global.keycloak.prefix) -}}
42+
{{- end -}}
43+
44+
{{/*
45+
Create a gateway prefix, .i.e activiti-cloud-gateway
46+
*/}}
47+
{{- define "gateway-prefix" -}}
48+
{{- default "activiti-cloud-gateway" (default .Values.global.config.prefix .Values.global.gateway.prefix) -}}
49+
{{- end -}}
50+
51+
{{/*
52+
Create a domain
53+
*/}}
54+
{{- define "domain" -}}
55+
{{- tpl (default "127.0.0.1.nip.io" .Values.global.config.domain) $ -}}
56+
{{- end -}}
57+
58+
{{/*
59+
Create a keycloak host.
60+
*/}}
61+
{{- define "keycloak-host" -}}
62+
{{- tpl (default (printf "%s.%s" (include "keycloak-prefix" $) (include "domain" $)) .Values.global.keycloak.host) $ -}}
63+
{{- end -}}
64+
65+
{{/*
66+
Create a keycloak protocol
67+
*/}}
68+
{{- define "keycloak-proto" -}}
69+
{{- tpl "http{{ if $.Values.global.config.tls }}s{{ end }}" $ -}}
70+
{{- end -}}
71+
72+
{{/*
73+
Create a kubernetes.io/tls-acme annotation
74+
*/}}
75+
{{- define "kubernetes.io/tls-acme" -}}
76+
{{- if (default .Values.global.config.tls .Values.ingress.tls) }}
77+
kubernetes.io/tls-acme: "true"
78+
{{- end }}
79+
{{- end -}}

charts/activiti-cloud-notifications-graphql/templates/_helpers.tpl

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@ Create a default service name.
2727
{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}}
2828
{{- end -}}
2929

30-
{{/*
31-
Create a default tls secrtet name.
32-
*/}}
33-
{{- define "tlssecretname" -}}
34-
{{- $name := default (printf "tls-%s-%s" .Release.Name "activiti-cloud-gateway") (or .Values.ingress.tlsSecret .Values.global.gateway.ingress.tlsSecret) -}}
35-
{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}}
36-
{{- end -}}
3730

38-
{{/*
39-
Create a default ingress host.
40-
*/}}
41-
{{- define "ingresshost" -}}
42-
{{- default .Values.global.gateway.host .Values.ingress.hostName -}}
43-
{{- end -}}
31+
32+

charts/activiti-cloud-notifications-graphql/templates/deployment.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,19 @@ spec:
2828
value: {{ template "servicename" . }}
2929
- name: SPRING_RABBITMQ_HOST
3030
{{- if .Values.global.rabbitmq.host.value }}
31-
value: "{{ .Values.global.rabbitmq.host.value }}"
31+
value: "{{ tpl .Values.global.rabbitmq.host.value $ }}"
3232
{{ else }}
3333
value: "{{ .Release.Name }}-rabbitmq"
34-
{{ end }}
34+
{{- end }}
3535
- name: SPRING_RABBITMQ_USERNAME
3636
value: {{ .Values.global.rabbitmq.username.value }}
3737
- name: SPRING_RABBITMQ_PASSWORD
3838
value: {{ .Values.global.rabbitmq.password.value }}
39-
{{- if .Values.global.keycloak.url }}
4039
- name: ACT_KEYCLOAK_URL
41-
value: "{{ .Values.global.keycloak.url }}"
42-
{{ end }}
40+
value: {{ include "keycloak-url" $ | quote }}
4341
- name: SPRING_DATASOURCE_URL
4442
{{- if .Values.db.uri }}
45-
value: "{{ .Values.db.uri }}"
43+
value: "{{ tpl .Values.db.uri $ }}"
4644
{{- else }}
4745
value: "jdbc:postgresql://{{ .Release.Name }}-{{ .Values.db.name }}:{{ .Values.db.port }}/postgres"
4846
{{- end }}

charts/activiti-cloud-notifications-graphql/templates/ingress.yaml

Lines changed: 39 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,83 +2,58 @@
22
apiVersion: extensions/v1beta1
33
kind: Ingress
44
metadata:
5-
name: {{ template "fullname" . }}-backend
5+
name: {{ template "fullname" . }}
66
labels:
77
app: {{ template "fullname" . }}
88
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
99
release: {{ .Release.Name }}
1010
heritage: {{ .Release.Service }}
1111
annotations:
12-
{{- range $key, $value := .Values.global.gateway.ingress.annotations }}
12+
kubernetes.io/ingress.class: "nginx"
13+
{{- include "kubernetes.io/tls-acme" . | indent 4}}
14+
nginx.ingress.kubernetes.io/enable-cors: "true"
15+
nginx.ingress.kubernetes.io/cors-allow-headers: "*"
16+
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
17+
nginx.ingress.kubernetes.io/cors-allow-methods: "GET,PUT,POST,DELETE,PATCH,OPTIONS"
18+
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
19+
nginx.ingress.kubernetes.io/x-forwarded-prefix: "true"
20+
nginx.ingress.kubernetes.io/affinity: cookie
21+
nginx.ingress.kubernetes.io/session-cookie-name: "activiti-cloud-notifications-graphql-route"
22+
nginx.ingress.kubernetes.io/session-cookie-hash: "md5"
23+
nginx.ingress.kubernetes.io/session-cookie-path: "/"
24+
{{- range $key, $value := .Values.global.gateway.annotations }}
1325
{{ $key }}: {{ tpl $value $ | quote }}
1426
{{- end }}
1527
{{- range $key, $value := .Values.ingress.annotations }}
1628
{{ $key }}: {{ tpl $value $ | quote }}
1729
{{- end }}
1830
spec:
1931
rules:
20-
{{- if default .Values.global.gateway.host .Values.ingress.hostName }}
21-
- host: {{ template "ingresshost" . }}
32+
- host: {{ include "ingresshost" $ }}
2233
http:
23-
{{- else }}
24-
- http:
25-
{{- end }}
2634
paths:
27-
- path: {{ .Values.ingress.web.path }}
28-
backend:
29-
serviceName: {{ template "servicename" . }}
30-
servicePort: {{ .Values.service.externalPort }}
31-
- path: {{ .Values.ingress.ws.path }}
32-
backend:
33-
serviceName: {{ template "servicename" . }}
34-
servicePort: {{ .Values.service.externalPort }}
35-
{{- if default .Values.global.gateway.ingress.tls .Values.ingress.tls }}
35+
{{- if .Values.ingress.web.enabled }}
36+
- path: {{ .Values.ingress.web.path }}
37+
backend:
38+
serviceName: {{ template "servicename" . }}
39+
servicePort: {{ .Values.service.externalPort }}
40+
{{- end }}
41+
{{- if .Values.ingress.ws.enabled }}
42+
- path: {{ .Values.ingress.ws.path }}
43+
backend:
44+
serviceName: {{ template "servicename" . }}
45+
servicePort: {{ .Values.service.externalPort }}
46+
{{- end }}
47+
{{- if .Values.ingress.graphiql.enabled }}
48+
- path: {{ .Values.ingress.graphiql.path }}
49+
backend:
50+
serviceName: {{ template "servicename" . }}
51+
servicePort: {{ .Values.service.externalPort }}
52+
{{- end }}
53+
{{- if default .Values.global.config.tls .Values.ingress.tls}}
3654
tls:
37-
- secretName: {{ template "tlssecretname" . }}
38-
{{- if default .Values.global.gateway.host .Values.ingress.hostName }}
39-
hosts:
40-
- {{ template "ingresshost" . }}
41-
{{- end }}
42-
{{- end }}
43-
---
44-
{{- if .Values.ingress.graphiql.enabled }}
45-
apiVersion: extensions/v1beta1
46-
kind: Ingress
47-
metadata:
48-
name: {{ template "fullname" . }}-graphiql
49-
labels:
50-
app: {{ template "fullname" . }}
51-
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
52-
release: {{ .Release.Name }}
53-
heritage: {{ .Release.Service }}
54-
annotations:
55-
{{- range $key, $value := .Values.global.gateway.ingress.annotations }}
56-
{{ $key }}: {{ tpl $value $ | quote }}
57-
{{- end }}
58-
{{- range $key, $value := .Values.ingress.graphiql.annotations }}
59-
{{ $key }}: {{ tpl $value $ | quote }}
60-
{{- end }}
61-
spec:
62-
rules:
63-
{{- if default .Values.global.gateway.host .Values.ingress.hostName }}
64-
- host: {{ template "ingresshost" . }}
65-
http:
66-
{{- else }}
67-
- http:
68-
{{- end }}
69-
paths:
70-
- path: {{ .Values.ingress.graphiql.path }}
71-
backend:
72-
serviceName: {{ template "servicename" . }}
73-
servicePort: {{ .Values.service.externalPort }}
74-
{{- if default .Values.global.gateway.ingress.tls .Values.ingress.tls }}
75-
tls:
76-
- secretName: {{ template "tlssecretname" . }}
77-
{{- if default .Values.global.gateway.host .Values.ingress.hostName }}
78-
hosts:
79-
- {{ template "ingresshost" . }}
80-
{{- end }}
81-
{{- end }}
82-
{{- end }}
83-
{{- end }}
84-
55+
- secretName: {{ template "tlssecretname" . }}
56+
hosts:
57+
- {{ include "ingresshost" $ }}
58+
{{- end }}
59+
{{- end }}

charts/activiti-cloud-notifications-graphql/values.yaml

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
# Declare variables to be passed into your templates.
44
replicaCount: 1
55

6+
# Application
67
global:
8+
config:
9+
domain: "192.168.99.100.nip.io"
10+
tls: # true | false
11+
prefix: # commmon domain prefix, i.e. activiti
712
rabbitmq:
813
host:
914
value: ""
@@ -12,21 +17,18 @@ global:
1217
password:
1318
value: guest
1419
keycloak:
15-
url: ""
20+
url: # "http{{ if $.Values.global.config.tls }}s{{ end }}://activiti-keycloak.{{ .Values.global.config.domain }}/auth"
21+
host: # "activiti-keycloak.{{ .Release.Name }}.{{ .Values.global.config.domain }}"
22+
path: # /auth
1623
name: keycloak
1724
service:
1825
type: http
1926
port: 80
20-
gateway:
21-
host: ""
22-
ingress:
23-
tls: # true | false
24-
tlsSecret: # custom secret name or auto-generated 'tls-.Release.Name-activiti-cloud-gateway' if tls true
25-
# global annotations to be added to all service ingresses i.e.
26-
# certmanager.k8s.io/issuer: letsencrypt-prod
27-
# kubernetes.io/tls-acme: "true"
28-
annotations:
29-
kubernetes.io/ingress.class: "nginx"
27+
gateway:
28+
host: # "activiti-cloud-gateway.{{ .Release.Name }}.{{ .Values.global.config.domain }}"
29+
tlsSecret: # tls-{{ .Release.Name }}-activiti-cloud-gateway
30+
# global annotations to be added to all service ingresses
31+
annotations: {}
3032

3133
db:
3234
uri: ""
@@ -37,7 +39,7 @@ db:
3739
ddlAuto: none
3840

3941
javaOpts:
40-
xmx: 2048m
42+
xmx: 1768m
4143
xms: 1024m
4244
other: -XX:+UnlockExperimentalVMOptions -Dsun.zip.disableMemoryMapping=true -XX:+UseParallelGC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
4345

@@ -92,21 +94,12 @@ ingress:
9294
graphiql:
9395
enabled: true
9496
path: /graphiql
95-
annotations:
96-
nginx.ingress.kubernetes.io/rewrite-target: /
97-
nginx.ingress.kubernetes.io/add-base-url: "true"
9897
web:
98+
enabled: true
9999
path: /graphql
100100
ws:
101+
enabled: true
101102
path: /ws/graphql
102-
annotations:
103-
nginx.ingress.kubernetes.io/enable-cors: "true"
104-
nginx.ingress.kubernetes.io/cors-allow-headers: "*"
105-
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
106-
nginx.ingress.kubernetes.io/cors-allow-methods: "GET,PUT,POST,DELETE,PATCH,OPTIONS"
107-
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
108-
nginx.ingress.kubernetes.io/x-forwarded-prefix: "true"
109-
nginx.ingress.kubernetes.io/affinity: cookie
110-
nginx.ingress.kubernetes.io/session-cookie-name: "activiti-cloud-notifications-graphql-route"
111-
nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"
103+
annotations: {}
104+
112105

0 commit comments

Comments
 (0)