Skip to content

Commit efc248e

Browse files
Inject Pod and Container Security Context (#38)
* Inject Pod and Container Security Context * Inject Pod and Container Security Context * fix vulnerabilities * fix vulnerabilities * update trivy ignores --------- Co-authored-by: Ravi Singal <ravi.singal@traceable.ai>
1 parent 34bfa83 commit efc248e

9 files changed

Lines changed: 371 additions & 2432 deletions

File tree

.trivyignore

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
1-
# org.scala-lang:scala-library (from upstream opensource dependency)
2-
CVE-2022-36944 exp:2023-09-30
3-
4-
# org.xerial.snappy:snappy-java (from upstream opensource dependency)
5-
CVE-2023-34453 exp:2023-09-30
6-
7-
# org.xerial.snappy:snappy-java (from upstream opensource dependency)
8-
CVE-2023-34454 exp:2023-09-30
9-
10-
# org.xerial.snappy:snappy-java (from upstream opensource dependency)
11-
CVE-2023-34455 exp:2023-09-30
12-
131
# usr/local/bin/kubectl (gobinary)
14-
CVE-2023-2253 exp:2023-09-30
2+
CVE-2024-34156 exp:2024-10-31

kafka-topic-creator/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.21 AS builder
1+
FROM golang:1.22.7 AS builder
22
COPY src/main/go /opt
33
WORKDIR /opt
44

kafka-topic-creator/helm/templates/kafka-topic-creation-hook.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ spec:
2424
containers:
2525
- name: topic-creator
2626
image: {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
27+
{{- with .Values.containerSecurityContext }}
28+
securityContext:
29+
{{- toYaml . | nindent 12 }}
30+
{{- end }}
2731
imagePullPolicy: {{ .Values.image.pullPolicy }}
2832
resources:
2933
{{- toYaml .Values.resources | nindent 12 }}
@@ -49,7 +53,7 @@ spec:
4953
tolerations:
5054
{{- toYaml . | nindent 8 }}
5155
{{- end }}
52-
{{- with .Values.securityContext }}
56+
{{- with .Values.podSecurityContext }}
5357
securityContext:
5458
{{- toYaml . | nindent 8 }}
5559
{{- end }}

kafka-topic-creator/helm/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ kafka:
4545
# for these keys in minValueOverrideForTopicConfig, we will set for all topics to value here if either not set or when lower is provided
4646
# ensure provided value for these keys is a 64 bit integer, else job will throw an error
4747
minValueOverrideForTopicConfig: {}
48+
49+
containerSecurityContext: {}
50+
podSecurityContext: {}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module hypertrace.org/kafka-topic-creator
22

3-
go 1.21
3+
go 1.22.7
44

55
require (
6-
github.com/confluentinc/confluent-kafka-go/v2 v2.1.0
6+
github.com/confluentinc/confluent-kafka-go/v2 v2.5.3
77
gopkg.in/yaml.v3 v3.0.1
88
)

kafka-topic-creator/src/main/go/go.sum

Lines changed: 344 additions & 2412 deletions
Large diffs are not rendered by default.

kstreams-app-version-checker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM alpine:3.18
1+
FROM alpine:3.20
22

3-
ENV KUBECTL_VERSION=v1.28.12
3+
ENV KUBECTL_VERSION=v1.28.14
44

55
RUN apk add curl jq --no-cache && \
66
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" && \

kstreams-app-version-checker/helm/templates/job.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@ spec:
1919
app: {{ $jobName }}
2020
release: {{ .Release.Name }}
2121
spec:
22+
{{- with .Values.podSecurityContext }}
23+
securityContext:
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
2226
containers:
2327
- name: kstreams-app-version-checker
2428
image: {{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tagOverride }}
29+
{{- with .Values.resources }}
30+
resources:
31+
{{- toYaml . | nindent 12 }}
32+
{{- end }}
2533
imagePullPolicy: {{ .Values.image.pullPolicy }}
2634
env:
2735
- name: NAMESPACE
@@ -32,7 +40,7 @@ spec:
3240
value: {{ int .Values.waitSeconds | default 360 | quote }}
3341
- name: WORKLOADS
3442
value: "{{ range $workload := .Values.workloads }}{{ $workload.name }},{{ $workload.type }},{{ $workload.container }};{{ end }}"
35-
{{- with .Values.securityContext }}
43+
{{- with .Values.containerSecurityContext }}
3644
securityContext:
3745
{{- toYaml . | nindent 12 }}
3846
{{- end }}

kstreams-app-version-checker/helm/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ jobName: ""
3838
configMapName: ""
3939

4040
workloads: []
41+
42+
resources: {}
43+
containerSecurityContext: {}
44+
podSecurityContext: {}

0 commit comments

Comments
 (0)