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

Commit fde18b3

Browse files
authored
Merge pull request #104 from Activiti/almerico-helm-duplications-common-usage
common usage helm refactoring
2 parents 435fc10 + 3d3cc46 commit fde18b3

File tree

9 files changed

+138
-208
lines changed

9 files changed

+138
-208
lines changed

.updatebot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ github:
44
repositories:
55
- name: activiti-cloud-application-chart
66
useSinglePullRequest: true
7+
- name: activiti-cloud-full-chart
8+
useSinglePullRequest: true
79

OWNERS_ALIASES

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dependencies:
2+
- name: common
3+
repository: https://activiti.github.io/activiti-cloud-charts/
4+
version: 1.1.4

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

Lines changed: 0 additions & 79 deletions
This file was deleted.

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,3 @@ Create a default service name.
2626
{{- $name := default (include "fullname" .) .Values.service.name -}}
2727
{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}}
2828
{{- end -}}
29-
30-
31-
32-
Lines changed: 75 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
apiVersion: extensions/v1beta1
2-
kind: Deployment
3-
metadata:
4-
name: {{ template "fullname" . }}
5-
labels:
6-
draft: {{ default "draft-app" .Values.draft }}
7-
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
1+
{{- template "common.deployment" (list . "activiti.connector.deployment") -}}
2+
{{- define "activiti.connector.deployment" -}}
83
spec:
94
replicas: {{ .Values.replicaCount }}
105
template:
11-
metadata:
12-
labels:
13-
draft: {{ default "draft-app" .Values.draft }}
14-
app: {{ template "fullname" . }}
15-
{{- if .Values.podAnnotations }}
16-
annotations:
17-
{{ toYaml .Values.podAnnotations | indent 8 }}
18-
{{- end }}
196
spec:
7+
{{- if include "common.registry-pull-secrets" . }}
8+
imagePullSecrets:
9+
{{- include "common.registry-pull-secrets" . | indent 6 }}
10+
{{- end }}
2011
containers:
2112
- name: {{ .Chart.Name }}
2213
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@@ -28,41 +19,86 @@ spec:
2819
value: {{ template "servicename" . }}
2920
- name: SPRING_RABBITMQ_HOST
3021
{{- if .Values.global.rabbitmq.host.value }}
31-
value: "{{ tpl .Values.global.rabbitmq.host.value $ }}"
32-
{{ else }}
22+
value: {{ .Values.global.rabbitmq.host.value | quote }}
23+
{{- else }}
3324
value: "{{ .Release.Name }}-rabbitmq"
3425
{{- end }}
3526
- name: SPRING_RABBITMQ_USERNAME
3627
value: {{ .Values.global.rabbitmq.username.value }}
3728
- name: SPRING_RABBITMQ_PASSWORD
3829
value: {{ .Values.global.rabbitmq.password.value }}
30+
{{- if include "common.keycloak-enabled" $ }}
3931
- name: ACT_KEYCLOAK_URL
40-
value: {{ include "keycloak-url" $ | quote }}
32+
value: {{ include "common.keycloak-url" $ | quote }}
33+
{{- end }}
34+
{{- if include "common.keycloak-realm" . }}
35+
- name: ACT_KEYCLOAK_REALM
36+
value: {{ include "common.keycloak-realm" . | quote }}
37+
{{- end }}
38+
{{- if include "common.keycloak-resource" . }}
39+
- name: ACT_KEYCLOAK_RESOURCE
40+
value: {{ include "common.keycloak-resource" . | quote }}
41+
{{- end }}
42+
{{- if .Values.postgres.enabled }}
4143
- name: SPRING_DATASOURCE_URL
42-
{{- if .Values.db.uri }}
43-
value: "{{ tpl .Values.db.uri $ }}"
44-
{{- else }}
45-
value: "jdbc:postgresql://{{ .Release.Name }}-{{ .Values.db.name }}:{{ .Values.db.port }}/postgres"
46-
{{- end }}
44+
{{- if .Values.postgres.uri }}
45+
value: {{ .Values.postgres.uri | quote }}
46+
{{- else }}
47+
value: "jdbc:postgresql://{{ .Release.Name }}-{{ .Values.postgres.name }}:{{ .Values.postgres.port }}/postgres"
48+
{{- end }}
4749
- name: SPRING_DATASOURCE_DRIVER_CLASS_NAME
48-
value: {{ default "org.postgresql.Driver" .Values.db.driver }}
50+
value: {{ default "org.postgresql.Driver" .Values.postgres.driver | quote }}
4951
- name: SPRING_DATASOURCE_USERNAME
50-
value: {{ default "postgres" .Values.db.user }}
52+
value: {{ default "postgres" .Values.postgres.username | quote }}
5153
- name: SPRING_DATASOURCE_PASSWORD
52-
{{- if .Values.db.pass }}
53-
value: "{{ .Values.db.pass }}"
54-
{{ else }}
54+
{{- if .Values.postgres.password }}
55+
value: {{ .Values.db.password | quote}}
56+
{{- else }}
5557
valueFrom:
5658
secretKeyRef:
57-
name: {{ .Release.Name }}-{{ .Values.db.name }}
58-
key: postgres-password
59-
{{- end }}
59+
name: {{ .Release.Name }}-{{ .Values.postgres.name }}
60+
key: postgresql-password
61+
{{- end }}
62+
- name: SPRING_JPA_DATABASE_PLATFORM
63+
value: {{ default "org.hibernate.dialect.PostgreSQLDialect" .Values.postgres.platform | quote }}
64+
- name: SPRING_JPA_GENERATE_DDL
65+
value: {{ default "true" .Values.postgres.generateDdl | quote }}
66+
- name: SPRING_JPA_HIBERNATE_DDL_AUTO
67+
value: {{ default "update" .Values.postgres.ddlAuto | quote}}
68+
{{- else }}
69+
{{- if .Values.db.uri }}
70+
- name: SPRING_DATASOURCE_URL
71+
value: {{ .Values.db.uri | quote }}
72+
{{- end }}
73+
{{- if .Values.db.driver }}
74+
- name: SPRING_DATASOURCE_DRIVER_CLASS_NAME
75+
value: {{ .Values.db.driver | quote }}
76+
{{- end }}
77+
{{- if .Values.db.username }}
78+
- name: SPRING_DATASOURCE_USERNAME
79+
value: {{ .Values.db.username | quote }}
80+
{{- end }}
81+
{{- if .Values.db.password }}
82+
- name: SPRING_DATASOURCE_PASSWORD
83+
value: {{ .Values.db.password | quote}}
84+
{{- end }}
85+
{{- if .Values.db.platform }}
6086
- name: SPRING_JPA_DATABASE_PLATFORM
61-
value: {{ default "org.hibernate.dialect.PostgreSQLDialect" .Values.db.platform }}
87+
value: {{ .Values.db.platform | quote}}
88+
{{- end }}
89+
{{- if .Values.db.generateDdl }}
6290
- name: SPRING_JPA_GENERATE_DDL
63-
value: "{{ .Values.db.generateDdl }}"
91+
value: {{ .Values.db.generateDdl | quote }}
92+
{{- end }}
93+
{{- if .Values.db.ddlAuto }}
6494
- name: SPRING_JPA_HIBERNATE_DDL_AUTO
65-
value: "{{ .Values.db.ddlAuto }}"
95+
value: {{ default "update" .Values.db.ddlAuto | quote }}
96+
{{- end }}
97+
{{- end }}
98+
{{- if include "common.ingress-path" . }}
99+
- name: SERVER_SERVLET_CONTEXTPATH
100+
value: {{ include "common.ingress-path" . | quote }}
101+
{{- end }}
66102
- name: EUREKA_CLIENT_ENABLED
67103
value: "false"
68104
- name: ACTIVITI_CLOUD_SERVICES_METADATA_EUREKA_STATIC_ENABLED
@@ -71,16 +107,12 @@ spec:
71107
value: "false"
72108
- name: ACT_CLOUD_CONFIG_SERVER_ENABLED
73109
value: "false"
74-
- name: SERVER_SERVLET_CONTEXTPATH
75-
value: {{ tpl .Values.ingress.path . | quote }}
76-
{{- with .Values.extraEnv }}
77-
{{ tpl . $ | indent 8 }}
78-
{{- end }}
110+
{{ include "common.extra-env" . | indent 8 }}
79111
ports:
80112
- containerPort: {{ .Values.service.internalPort }}
81113
livenessProbe:
82114
httpGet:
83-
path: {{ tpl .Values.probePath . | quote }}
115+
path: {{ tpl .Values.probePath . }}
84116
port: {{ .Values.service.internalPort }}
85117
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
86118
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
@@ -89,13 +121,14 @@ spec:
89121
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
90122
readinessProbe:
91123
httpGet:
92-
path: {{ tpl .Values.probePath . | quote }}
124+
path: {{ tpl .Values.probePath . }}
93125
port: {{ .Values.service.internalPort }}
94-
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
126+
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
95127
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
96128
successThreshold: {{ .Values.readinessProbe.successThreshold }}
97129
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
98130
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
99131
resources:
100132
{{ toYaml .Values.resources | indent 12 }}
101133
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
134+
{{- end -}}

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,46 @@ metadata:
99
release: {{ .Release.Name }}
1010
heritage: {{ .Release.Service }}
1111
annotations:
12-
{{- include "kubernetes.io/tls-acme" . | indent 4}}
13-
{{- range $key, $value := .Values.global.gateway.annotations }}
14-
{{ $key }}: {{ tpl $value $ | quote }}
15-
{{- end }}
16-
{{- range $key, $value := .Values.ingress.annotations }}
17-
{{ $key }}: {{ tpl $value $ | quote }}
18-
{{- end }}
12+
{{- include "common.ingress-annotations" . | indent 4 }}
1913
spec:
2014
rules:
21-
- host: {{ include "ingresshost" $ | quote }}
15+
{{- if include "common.ingress-host" . }}
16+
- host: {{ template "common.ingress-host" . }}
2217
http:
18+
{{- else }}
19+
- http:
20+
{{- end }}
2321
paths:
2422
{{- if .Values.ingress.actuator.enabled }}
25-
- path: {{ tpl .Values.ingress.path . }}{{ .Values.ingress.actuator.path }}
23+
- path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.actuator.path . }}
2624
backend:
2725
serviceName: {{ template "servicename" . }}
2826
servicePort: {{ .Values.service.externalPort }}
2927
{{- end }}
3028
{{- if .Values.ingress.web.enabled }}
31-
- path: {{ tpl .Values.ingress.path . }}{{ .Values.ingress.web.path }}
29+
- path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.web.path . }}
3230
backend:
3331
serviceName: {{ template "servicename" . }}
3432
servicePort: {{ .Values.service.externalPort }}
3533
{{- end }}
3634
{{- if .Values.ingress.ws.enabled }}
37-
- path: {{ tpl .Values.ingress.path . }}{{ .Values.ingress.ws.path }}
35+
- path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.ws.path . }}
3836
backend:
3937
serviceName: {{ template "servicename" . }}
4038
servicePort: {{ .Values.service.externalPort }}
4139
{{- end }}
4240
{{- if .Values.ingress.graphiql.enabled }}
43-
- path: {{ tpl .Values.ingress.path . }}{{ .Values.ingress.graphiql.path }}
41+
- path: {{ template "common.ingress-path" . }}{{ tpl .Values.ingress.graphiql.path . }}
4442
backend:
4543
serviceName: {{ template "servicename" . }}
4644
servicePort: {{ .Values.service.externalPort }}
4745
{{- end }}
48-
{{- if default .Values.global.config.tls .Values.ingress.tls}}
46+
{{- if include "common.ingress-tls" . }}
4947
tls:
50-
- secretName: {{ template "tlssecretname" . }}
48+
- secretName: {{ template "common.ingress-tlssecretname" . }}
49+
{{- if include "common.ingress-host" . }}
5150
hosts:
52-
- {{ include "ingresshost" $ }}
51+
- {{ template "common.ingress-host" . }}
52+
{{- end }}
5353
{{- end }}
5454
{{- end }}
Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
apiVersion: v1
2-
kind: Service
3-
metadata:
4-
{{- if .Values.service.name }}
5-
name: {{ .Values.service.name }}
6-
{{- else }}
7-
name: {{ template "fullname" . }}
8-
{{- end }}
9-
labels:
10-
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
11-
{{- if .Values.service.annotations }}
12-
annotations:
13-
{{ toYaml .Values.service.annotations | indent 4 }}
14-
{{- end }}
15-
spec:
16-
type: {{ .Values.service.type }}
17-
ports:
18-
- port: {{ .Values.service.externalPort }}
19-
targetPort: {{ .Values.service.internalPort }}
20-
protocol: TCP
21-
name: http
22-
selector:
23-
app: {{ template "fullname" . }}
1+
{{- template "common.service" (list . "activiti.graphql.service") -}}
2+
{{- define "activiti.graphql.service" -}}
3+
{{- end -}}

0 commit comments

Comments
 (0)