Skip to content

Commit 4553fda

Browse files
authored
Merge pull request #74 from meisterplan/feature/KNUTH-129111-set-retentionlogging-annota
Add new logging control annotations (collect, retention)
2 parents 3067848 + f1ce2e2 commit 4553fda

File tree

14 files changed

+67
-2
lines changed

14 files changed

+67
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
branches: [master]
55
pull_request:
66
branches: [master]
7+
permissions:
8+
checks: write
9+
contents: read
10+
pull-requests: write
711
jobs:
812
test:
913
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# spring-service
22

3+
## 5.5.0
4+
5+
- Add support for logging annotations
6+
37
## 5.4.0
48

59
- Allow to configure `overwriteRequestRetries`
@@ -239,6 +243,10 @@ deployment** with a short 503 service disruption due to a [bug in the ingress co
239243

240244
# cronjob
241245

246+
## 3.2.0
247+
248+
- Add support for logging annotations
249+
242250
## 3.1.1
243251

244252
- Remove now unnecessary, confusing Helm chart labels on prom resources

charts/cronjob/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apiVersion: v1
22
name: cronjob
33
description: A generalized cronjob that can access secrets.
4-
version: 3.1.1
4+
version: 3.2.0
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- define "k8s.annotations" }}
2+
{{- $annotations := dict }}
3+
{{- if ne .Values.logging.collect true }}
4+
{{- $_ := set $annotations "com.meisterplan.logs/collect" (printf "%v" .Values.logging.collect) }}
5+
{{- end }}
6+
{{- if ne .Values.logging.retention "default" }}
7+
{{- $_ := set $annotations "com.meisterplan.logs/retention" .Values.logging.retention }}
8+
{{- end }}
9+
{{- if $annotations }}
10+
{{- toYaml $annotations }}
11+
{{- end }}
12+
{{- end }}

charts/cronjob/templates/cronjob.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ apiVersion: batch/v1
33
metadata:
44
name: "{{ required "cronJobName must be set!" .Values.cronJobName }}"
55
namespace: "{{ required "Namespace must be set!" .Values.namespace }}"
6+
{{- $annotations := include "k8s.annotations" . -}}
7+
{{- if $annotations }}
8+
annotations:
9+
{{- $annotations | nindent 4 }}
10+
{{- end }}
611
spec:
712
concurrencyPolicy: "Replace"
813
schedule: {{ required "Schedule must be set!" .Values.schedule | quote }}

charts/cronjob/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ resources:
3636
cpu:
3737
guarantee: 100m
3838

39+
logging:
40+
collect: true # can be toggled to turn off log collection
41+
retention: default # can be set to 'verbose' to shorten retention
42+
3943
env:
4044
fromSecret: {}
4145
# SOME_SECRET:

charts/spring-service/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apiVersion: v1
22
name: spring-service
33
description: A generalized deployment for Meisterplan Spring Boot services in Kubernetes.
4-
version: 5.4.0
4+
version: 5.5.0

charts/spring-service/templates/post-deployment/_helpers.tpl renamed to charts/spring-service/templates/_helpers.tpl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,16 @@
1313
{{ $.Values.ingress.public.subDomain }}.{{ required "ingress.clusterDomain must be set!" $.Values.ingress.clusterDomain }}
1414
{{- end -}}
1515
{{- end }}
16+
17+
{{- define "k8s.annotations" }}
18+
{{- $annotations := dict }}
19+
{{- if ne .Values.logging.collect true }}
20+
{{- $_ := set $annotations "com.meisterplan.logs/collect" (printf "%v" .Values.logging.collect) }}
21+
{{- end }}
22+
{{- if ne .Values.logging.retention "default" }}
23+
{{- $_ := set $annotations "com.meisterplan.logs/retention" .Values.logging.retention }}
24+
{{- end }}
25+
{{- if $annotations }}
26+
{{- toYaml $annotations }}
27+
{{- end }}
28+
{{- end }}

charts/spring-service/templates/deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ apiVersion: apps/v1
33
metadata:
44
name: "{{ .Values.serviceName }}-{{ required "Image Tag must be set!" .Values.image.tag }}"
55
namespace: "{{ required "Namespace must be set!" .Values.namespace }}"
6+
{{- $annotations := include "k8s.annotations" . -}}
7+
{{- if $annotations }}
8+
annotations:
9+
{{- $annotations | nindent 4 }}
10+
{{- end }}
611
spec:
712
replicas: {{ .Values.replicaCount }}
813
{{- if .Values.timeouts.progressDeadlineSeconds }}

charts/spring-service/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ resources:
3737
cpu:
3838
guarantee: 100m
3939

40+
logging:
41+
collect: true # can be toggled to turn off log collection
42+
retention: default # can be set to 'verbose' to shorten retention
43+
4044
ingress:
4145
clusterDomain: "" # domain of the cluster, e.g. meisterplan.io
4246
public:

0 commit comments

Comments
 (0)