Skip to content

Commit 83dec36

Browse files
mlautzasjs-subkunstkomputer
authored
[sophora-ugc] [sophora-ugc-proxy] add ServiceMonitors (#304)
* [ugc] add ServiceMonitor objects for UGC and UGC multimedia * [ugc-proxy] add ServiceMonitor * [ugc] add per service config for serviceMonitor and remove management port * [ugc] rename "jolokia" service to "management" across chart files * [ugc] allow monitoring via management service * [ugc] deploy ServiceMonitor only if UGC multimedia is enabled * [ugc] add health probes configuration * [ugc] make management service optional and configure port * [ugc] move gcp config to ugc and ugcMultimedia sections and make it adjustable per service * [ugc] refactor ServiceMonitor target selection * [ugc] adjust gcp backend policy test * [ugc] revert test changes to gcp health * [ugc] disable ServiceMonitor by default * [ugc] move management service configuration to toplevel * [ugc] improve docs * [ugc] add changelog * Update explaining comment Co-authored-by: Jonas Pruditsch <6641029+kunstkomputer@users.noreply.github.com> * Update explaining comment Co-authored-by: Jonas Pruditsch <6641029+kunstkomputer@users.noreply.github.com> * Update explaining comment Co-authored-by: Jonas Pruditsch <6641029+kunstkomputer@users.noreply.github.com> * Update explaining comment Co-authored-by: Jonas Pruditsch <6641029+kunstkomputer@users.noreply.github.com> --------- Co-authored-by: Jan Stubenrauch <129169967+js-sub@users.noreply.github.com> Co-authored-by: Jonas Pruditsch <6641029+kunstkomputer@users.noreply.github.com>
1 parent d32e616 commit 83dec36

20 files changed

Lines changed: 323 additions & 112 deletions

charts/sophora-ugc-proxy/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ description: A Helm chart for Kubernetes to install Sophora UGC Proxy connected
44

55
type: application
66

7-
version: 1.6.0
7+
version: 1.7.0
88
annotations:
99
artifacthub.io/changes: |
1010
- kind: added
11-
description: "Add support for supplying API basic-auth credentials from a Kubernetes Secret"
11+
description: "ServiceMonitor object for UGC proxy"
1212
1313
# This is the version number of the application being deployed. This version number should be
1414
# incremented each time you make changes to the application. Versions are not expected to

charts/sophora-ugc-proxy/templates/service.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ spec:
1313
{{- include "sophora-ugc-proxy.selectorLabels" . | nindent 4 }}
1414
type: {{ .Values.service.type }}
1515
ports:
16-
- protocol: TCP
16+
- name: http
17+
protocol: TCP
1718
targetPort: proxy
1819
port: {{ .Values.service.port }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if .Values.serviceMonitor.enabled -}}
2+
{{- $fullName := include "sophora-ugc-proxy.fullname" . -}}
3+
apiVersion: monitoring.coreos.com/v1
4+
kind: ServiceMonitor
5+
metadata:
6+
name: {{ $fullName }}
7+
labels: {{- include "sophora-ugc-proxy.labels" . | nindent 8 }}
8+
spec:
9+
selector:
10+
matchLabels: {{- include "sophora-ugc-proxy.selectorLabels" . | nindent 12 }}
11+
endpoints:
12+
- interval: {{ .Values.serviceMonitor.interval }}
13+
port: http
14+
path: {{ .Values.serviceMonitor.path }}
15+
{{- end }}

charts/sophora-ugc-proxy/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,12 @@ gcp:
227227

228228
# extraDeploy is a list of full Kubernetes manifests that will be rendered additionally by this chart
229229
extraDeploy: []
230+
231+
232+
# serviceMonitor.enabled Whether the serviceMonitor resource should be deployed
233+
# serviceMonitor.interval Prometheus scrape interval
234+
# serviceMonitor.path HTTP path prometheus should use to scrape the application's metrics
235+
serviceMonitor:
236+
enabled: false
237+
interval: 10s
238+
path: "/actuator/prometheus"

charts/sophora-ugc/Chart.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 2.10.4
18+
version: 2.11.0
1919
annotations:
2020
artifacthub.io/changes: |
21-
- kind: fixed
22-
description: "fix linting issue on enabled GCPHealthChecks and GCPBackendPolicies"
21+
- kind: added
22+
description: "ServiceMonitor objects for UGC and UGC multimedia"
23+
- kind: changed
24+
description: "The parameter `service.jolokia.clusterIP` is now `service.management.clusterIP`. The deployed service and the corresponding container port are now named `management` instead of `jolokia`."
25+
- kind: changed
26+
description: "The `gcp` parameters can now be configured for UGC and UGC multimedia independently at `ugc.gcp` and `ugcMultimedia.gcp`."
27+
28+
2329
artifacthub.io/links: |
2430
- name: Documentation for Sophora UGC
2531
url: https://subshell.com/docs/ugc/

charts/sophora-ugc/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ For details, check the [UGC Multimedia Service documentation page](https://subsh
2222

2323
```yaml
2424
service:
25-
jolokia:
26-
clusterIP: None
25+
# Options for the services exposing UGC Webapp and UGC Multimedia
2726
webapp:
2827
type: LoadBalancer
28+
# Options for the service exposing the UGC management port
29+
management:
30+
# Whether to deploy a management service
31+
enabled: true
32+
# Port on which the management service should listen
33+
# Must match Spring's management.server.port property in ugc.config.
34+
port: 1694
35+
# ClusterIP for the management service
36+
clusterIP: None
2937

3038
ingress:
3139
enabled: false
@@ -59,9 +67,6 @@ ugc:
5967
pullPolicy: IfNotPresent
6068
# Overrides the image tag whose default is the chart appVersion.
6169
tag: "latest"
62-
binariesStorage:
63-
size: 1G
64-
storageClass: standard
6570

6671
logback: |
6772
<?xml version="1.0" encoding="UTF-8"?>
@@ -123,6 +128,10 @@ ugc:
123128
rating:
124129
primaryTypes: ["sophora-content-nt:story"]
125130

131+
healthCheck:
132+
# Which port to use for Kubernetes liveness/readiness probes at the ugc container, "webapp" or "management"
133+
port: webapp
134+
126135
ugcMultimedia:
127136
enabled: false # enable to deploy UGC Multimedia Service
128137
image:

charts/sophora-ugc/templates/deployment.yaml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,47 @@ spec:
9393
ports:
9494
- containerPort: {{ default 8080 (.Values.ugc.config.server).port }}
9595
name: webapp
96-
- containerPort: 1694
97-
name: jolokia
96+
{{- with .Values.service.management.port }}
97+
- containerPort: {{ . }}
98+
name: management
99+
{{- end }}
98100
volumeMounts:
99101
- name: logback-xml
100102
mountPath: /config/logback
101103
- name: application-yml
102104
mountPath: /config/application
103105
resources:
104106
{{- toYaml .Values.resources | nindent 12 }}
107+
{{- with .Values.startupProbe }}
108+
startupProbe:
109+
httpGet:
110+
port: {{ $.Values.ugc.healthCheck.port }}
111+
path: /actuator/health/liveness
112+
failureThreshold: {{ .failureThreshold }}
113+
initialDelaySeconds: {{ .initialDelaySeconds }}
114+
periodSeconds: {{ .periodSeconds }}
115+
timeoutSeconds: {{ .timeoutSeconds }}
116+
{{- end }}
117+
{{- with .Values.livenessProbe }}
118+
livenessProbe:
119+
httpGet:
120+
port: {{ $.Values.ugc.healthCheck.port }}
121+
path: /actuator/health/liveness
122+
failureThreshold: {{ .failureThreshold }}
123+
initialDelaySeconds: {{ .initialDelaySeconds }}
124+
periodSeconds: {{ .periodSeconds }}
125+
timeoutSeconds: {{ .timeoutSeconds }}
126+
{{- end }}
127+
{{- with .Values.readinessProbe }}
128+
readinessProbe:
129+
httpGet:
130+
port: {{ $.Values.ugc.healthCheck.port }}
131+
path: /actuator/health/readiness
132+
failureThreshold: {{ .failureThreshold }}
133+
initialDelaySeconds: {{ .initialDelaySeconds }}
134+
periodSeconds: {{ .periodSeconds }}
135+
timeoutSeconds: {{ .timeoutSeconds }}
136+
{{- end }}
105137
{{- if .Values.ugc.extraContainers }}
106138
{{ include "common.tplvalues.render" (dict "value" .Values.ugc.extraContainers "context" $) | nindent 8 }}
107139
{{- end }}

charts/sophora-ugc/templates/gcpBackendPolicy.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.gcp.enabled .Values.gcp.backendPolicy.enabled }}
1+
{{- if and .Values.ugc.gcp.enabled .Values.ugc.gcp.backendPolicy.enabled }}
22
{{- $fullName := printf "%s-webapp" (include "sophora-ugc.fullname" .) -}}
33
{{- $labels := include "sophora-ugc.labels" . -}}
44
apiVersion: networking.gke.io/v1
@@ -9,27 +9,27 @@ metadata:
99
{{- $labels | nindent 4 }}
1010
spec:
1111
default:
12-
{{- with .Values.gcp.backendPolicy.logging }}
12+
{{- with .Values.ugc.gcp.backendPolicy.logging }}
1313
logging:
1414
enabled: {{ .enabled | default false }}
1515
{{- if .enabled }}
1616
sampleRate: {{ .sampleRate | default 1000000 }}
1717
{{- end }}
1818
{{- end }}
19-
{{- with .Values.gcp.backendPolicy.sessionAffinity }}
19+
{{- with .Values.ugc.gcp.backendPolicy.sessionAffinity }}
2020
sessionAffinity:
2121
type: {{ .type | default "NONE" }}
2222
{{- if or (eq .type "GENERATED_COOKIE") (eq .type "HTTP_COOKIE") }}
2323
cookieTtlSec: {{ .cookieTtlSec | default 0 }}
2424
{{- end }}
2525
{{- end }}
2626
connectionDraining:
27-
drainingTimeoutSec: {{ dig "drainingTimeoutSec" 0 (.Values.gcp.backendPolicy.connectionDraining | default dict) }}
28-
timeoutSec: {{ .Values.gcp.backendPolicy.timeoutSec | default 30 }}
29-
{{- with .Values.gcp.backendPolicy.securityPolicy }}
27+
drainingTimeoutSec: {{ dig "drainingTimeoutSec" 0 (.Values.ugc.gcp.backendPolicy.connectionDraining | default dict) }}
28+
timeoutSec: {{ .Values.ugc.gcp.backendPolicy.timeoutSec | default 30 }}
29+
{{- with .Values.ugc.gcp.backendPolicy.securityPolicy }}
3030
securityPolicy: {{ . | quote }}
3131
{{- end }}
32-
{{- with .Values.gcp.backendPolicy.iap }}
32+
{{- with .Values.ugc.gcp.backendPolicy.iap }}
3333
iap:
3434
enabled: {{ .enabled | default false }}
3535
{{- if .enabled }}

charts/sophora-ugc/templates/gcpHealthCheck.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.gcp.enabled .Values.gcp.healthCheck.enabled }}
1+
{{- if and .Values.ugc.gcp.enabled .Values.ugc.gcp.healthCheck.enabled }}
22
{{- $fullName := include "sophora-ugc.fullname" . -}}
33
{{- $labels := include "sophora-ugc.labels" . -}}
44
apiVersion: networking.gke.io/v1
@@ -12,15 +12,15 @@ spec:
1212
config:
1313
type: HTTP
1414
httpHealthCheck:
15-
{{- with .Values.gcp.healthCheck.port }}
15+
{{- with .Values.ugc.gcp.healthCheck.port }}
1616
port: {{ . }}
1717
{{- end }}
18-
{{- with .Values.gcp.healthCheck.portName }}
18+
{{- with .Values.ugc.gcp.healthCheck.portName }}
1919
portName: {{ . | quote }}
2020
{{- end }}
21-
requestPath: {{ .Values.gcp.healthCheck.path | quote }}
21+
requestPath: {{ .Values.ugc.gcp.healthCheck.path | quote }}
2222
logConfig:
23-
enabled: {{ .Values.gcp.healthCheck.logging }}
23+
enabled: {{ .Values.ugc.gcp.healthCheck.logging }}
2424
targetRef:
2525
group: ""
2626
kind: Service

charts/sophora-ugc/templates/jolokia-service.yaml

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

0 commit comments

Comments
 (0)