Skip to content

Commit 2c0f092

Browse files
authored
Added SMG deployment (#63)
* Added SMG deployment * Update * Bump chart version * Update * Update * Update * Update * Update * Update * Update
1 parent b3a1295 commit 2c0f092

14 files changed

Lines changed: 437 additions & 14 deletions

charts/relution/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ sources:
1111

1212
type: application
1313

14-
version: 3.1.2
14+
version: 3.2.0
1515

16-
appVersion: "26.2.1"
16+
appVersion: "26.2.2"
1717

1818
dependencies:
1919
- name: mariadb

charts/relution/ci/full-values.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,15 @@ s2s:
132132
local:
133133
nat: 10.10.10.10
134134
transferSubnet: 10.10.10.10/32
135+
136+
smg:
137+
enabled: true
138+
app:
139+
config:
140+
relution:
141+
server:
142+
apiKey: test
143+
environment:
144+
RELUTION_SMG_FOO: bar
145+
secrets:
146+
RELUTION_SERVER_APIKEY: test

charts/relution/templates/_helpers.tpl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,51 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/*
65+
Common labels
66+
*/}}
67+
{{- define "relution-smg.labels" -}}
68+
helm.sh/chart: {{ include "relution.chart" . }}
69+
{{ include "relution-smg.selectorLabels" . }}
70+
{{- if .Chart.AppVersion }}
71+
app.kubernetes.io/version: {{ .Values.smg.image.tag | quote }}
72+
{{- end }}
73+
app.kubernetes.io/managed-by: {{ .Release.Service }}
74+
{{- end }}
75+
76+
{{/*
77+
Selector labels
78+
*/}}
79+
{{- define "relution-smg.selectorLabels" -}}
80+
app.kubernetes.io/name: {{ include "relution.name" . }}-smg
81+
app.kubernetes.io/instance: {{ .Release.Name }}
82+
{{- end }}
83+
84+
{{/*
85+
Create the name of the service account to use
86+
*/}}
87+
{{- define "relution-smg.serviceAccountName" -}}
88+
{{- if .Values.smg.serviceAccount.create }}
89+
{{- default (printf "%s-smg" (include "relution.fullname" .)) .Values.smg.serviceAccount.name }}
90+
{{- else }}
91+
{{- default "default" .Values.smg.serviceAccount.name }}
92+
{{- end }}
93+
{{- end }}
94+
95+
{{/*
96+
Render the ingressRoute.defaultRoute match expression without route-specific path filters.
97+
*/}}
98+
{{- define "relution.ingressRoute.defaultRouteMatch" -}}
99+
{{- $root := . -}}
100+
{{- $route := .Values.ingressRoute.defaultRoute -}}
101+
{{- if $route.match -}}
102+
{{ tpl $route.match $root }}
103+
{{- else if $route.hosts -}}
104+
Host(`{{ tpl (index $route.hosts 0) $root }}`)
105+
{{- range (slice $route.hosts 1) }} || Host(`{{ tpl . $root }}`)
106+
{{- end -}}
107+
{{- else -}}
108+
Host(`{{ tpl $route.host $root }}`)
109+
{{- end -}}
110+
{{- end }}

charts/relution/templates/ingress.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ spec:
4141
- host: {{ tpl .host $ | quote }}
4242
http:
4343
paths:
44+
{{- if $.Values.smg.enabled }}
45+
- path: /Microsoft-Server-ActiveSync
46+
pathType: Exact
47+
backend:
48+
service:
49+
name: {{ $fullName }}-smg
50+
port:
51+
number: {{ $.Values.smg.service.port }}
52+
{{- end }}
4453
{{- range .paths }}
4554
- path: {{ .path }}
4655
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}

charts/relution/templates/ingressroute.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,21 @@ metadata:
1414
spec:
1515
entryPoints: {{ toYaml .Values.ingressRoute.entryPoints | nindent 4 }}
1616
routes:
17+
{{- if $.Values.smg.enabled }}
18+
- kind: Rule
19+
{{- with .Values.ingressRoute.defaultRoute }}
20+
match: "({{ include "relution.ingressRoute.defaultRouteMatch" $ }}) && Path(`/Microsoft-Server-ActiveSync`)"
21+
{{- end }}
22+
services:
23+
- kind: Service
24+
name: {{ $fullName }}-smg
25+
namespace: {{ $.Release.Namespace }}
26+
port: {{ $.Values.smg.service.port }}
27+
{{- end }}
1728
{{- with .Values.ingressRoute.defaultRoute }}
1829
{{- if .enabled }}
1930
- kind: Rule
20-
{{- if .match }}
21-
match: {{ tpl .match $ | quote }}
22-
{{- else if .hosts }}
23-
match: "Host(`{{ tpl (index .hosts 0) $ }}`)
24-
{{- range (slice .hosts 1) }} || Host(`{{ tpl . $ }}`)
25-
{{- end}}"
26-
{{- else }}
27-
match: "Host(`{{ tpl .host $ }}`)"
28-
{{- end}}
31+
match: {{ include "relution.ingressRoute.defaultRouteMatch" $ | quote }}
2932
{{- with .middlewares }}
3033
middlewares:
3134
{{- range . }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- $fixedConfig := dict "relution" (dict "server" (dict "url" (printf "http://%s:%v" (include "relution.fullname" .) .Values.service.port))) -}}
2+
{{- $config := mergeOverwrite (deepCopy .Values.smg.app.config) $fixedConfig -}}
3+
kind: ConfigMap
4+
apiVersion: v1
5+
metadata:
6+
name: {{ include "relution.fullname" . }}-smg-config
7+
labels:
8+
{{- include "relution.labels" . | nindent 4 }}
9+
data:
10+
application.yml: |
11+
{{- toYaml $config | nindent 4 }}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{{- if .Values.smg.enabled }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ include "relution.fullname" . }}-smg
6+
labels:
7+
{{- include "relution-smg.labels" . | nindent 4 }}
8+
spec:
9+
replicas: {{ .Values.smg.replicaCount }}
10+
selector:
11+
matchLabels:
12+
{{- include "relution-smg.selectorLabels" . | nindent 6 }}
13+
template:
14+
metadata:
15+
annotations:
16+
{{- if .Values.smg.app.config }}
17+
checksum/config: {{ include (print $.Template.BasePath "/smg/smg-config.yaml") . | sha256sum }}
18+
{{- end }}
19+
{{- if .Values.smg.app.environment }}
20+
checksum/environment: {{ include (print $.Template.BasePath "/smg/smg-environment.yaml") . | sha256sum }}
21+
{{- end }}
22+
{{- if .Values.smg.app.secrets }}
23+
checksum/secrets: {{ include (print $.Template.BasePath "/smg/smg-secrets.yaml") . | sha256sum }}
24+
{{- end }}
25+
{{- with .Values.smg.podAnnotations }}
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
labels:
29+
{{- include "relution-smg.selectorLabels" . | nindent 8 }}
30+
spec:
31+
{{- with .Values.smg.imagePullSecrets }}
32+
imagePullSecrets:
33+
{{- toYaml . | nindent 8 }}
34+
{{- end }}
35+
serviceAccountName: {{ include "relution-smg.serviceAccountName" . }}
36+
securityContext:
37+
{{- toYaml .Values.smg.podSecurityContext | nindent 8 }}
38+
{{- if .Values.smg.hostAliases }}
39+
hostAliases:
40+
{{- toYaml .Values.smg.hostAliases | nindent 8 }}
41+
{{- end }}
42+
terminationGracePeriodSeconds: {{ .Values.smg.terminationGracePeriodSeconds }}
43+
containers:
44+
- name: {{ .Chart.Name }}-smg
45+
securityContext:
46+
{{- toYaml .Values.smg.securityContext | nindent 12 }}
47+
image: "{{ .Values.smg.image.repository }}:{{ .Values.smg.image.tag }}"
48+
imagePullPolicy: {{ .Values.smg.image.pullPolicy }}
49+
volumeMounts:
50+
- name: config
51+
mountPath: /opt/app/application.yml
52+
subPath: application.yml
53+
{{- if or .Values.smg.app.environment .Values.smg.app.secrets }}
54+
envFrom:
55+
{{- if .Values.smg.app.environment }}
56+
- configMapRef:
57+
name: {{ include "relution.fullname" . }}-smg-environment
58+
{{- end }}
59+
{{- if .Values.smg.app.secrets }}
60+
- secretRef:
61+
name: {{ include "relution.fullname" . }}-smg-secrets
62+
{{- end }}
63+
{{- end }}
64+
ports:
65+
- name: http
66+
containerPort: 8093
67+
protocol: TCP
68+
{{- if .Values.smg.startupProbe.enabled }}
69+
startupProbe:
70+
httpGet:
71+
path: /actuator/health
72+
port: http
73+
periodSeconds: {{ .Values.smg.startupProbe.periodSeconds | default 10 }}
74+
timeoutSeconds: {{ .Values.smg.startupProbe.timeoutSeconds | default 1 }}
75+
failureThreshold: {{ .Values.smg.startupProbe.failureThreshold | default 30 }}
76+
{{- end }}
77+
{{- if .Values.smg.livenessProbe.enabled }}
78+
livenessProbe:
79+
httpGet:
80+
path: /actuator/health/liveness
81+
port: http
82+
periodSeconds: {{ .Values.smg.livenessProbe.periodSeconds | default 10 }}
83+
timeoutSeconds: {{ .Values.smg.livenessProbe.timeoutSeconds | default 1 }}
84+
failureThreshold: {{ .Values.smg.livenessProbe.failureThreshold | default 3 }}
85+
{{- end }}
86+
{{- if .Values.smg.readinessProbe.enabled }}
87+
readinessProbe:
88+
httpGet:
89+
path: /actuator/health/readiness
90+
port: http
91+
periodSeconds: {{ .Values.smg.readinessProbe.periodSeconds | default 10 }}
92+
timeoutSeconds: {{ .Values.smg.readinessProbe.timeoutSeconds | default 1 }}
93+
failureThreshold: {{ .Values.smg.readinessProbe.failureThreshold | default 3 }}
94+
{{- end }}
95+
resources:
96+
{{- toYaml .Values.smg.resources | nindent 12 }}
97+
volumes:
98+
- name: config
99+
configMap:
100+
name: {{ include "relution.fullname" . }}-smg-config
101+
{{- with .Values.smg.nodeSelector }}
102+
nodeSelector:
103+
{{- toYaml . | nindent 8 }}
104+
{{- end }}
105+
{{- with .Values.smg.affinity }}
106+
affinity:
107+
{{- toYaml . | nindent 8 }}
108+
{{- end }}
109+
{{- with .Values.smg.tolerations }}
110+
tolerations:
111+
{{- toYaml . | nindent 8 }}
112+
{{- end }}
113+
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.smg.app.environment }}
2+
kind: ConfigMap
3+
apiVersion: v1
4+
metadata:
5+
name: {{ include "relution.fullname" . }}-smg-environment
6+
labels:
7+
{{- include "relution.labels" . | nindent 4 }}
8+
data:
9+
{{- range $key, $val := .Values.smg.app.environment }}
10+
{{ $key }}: {{ $val | quote }}
11+
{{- end }}
12+
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.smg.app.secrets }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "relution.fullname" . }}-smg-secrets
6+
labels:
7+
{{- include "relution.labels" . | nindent 4 }}
8+
type: Opaque
9+
data:
10+
{{- range $key, $val := .Values.smg.app.secrets }}
11+
{{ $key }}: {{ $val | b64enc }}
12+
{{ end -}}
13+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "relution.fullname" . }}-smg
5+
labels:
6+
{{- include "relution.labels" . | nindent 4 }}
7+
{{- with .Values.smg.service.annotations }}
8+
annotations:
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
type: {{ .Values.smg.service.type }}
13+
ports:
14+
- port: {{ .Values.smg.service.port }}
15+
targetPort: http
16+
protocol: TCP
17+
name: http
18+
selector:
19+
{{- include "relution-smg.selectorLabels" . | nindent 4 }}

0 commit comments

Comments
 (0)