Skip to content

Commit

Permalink
Inject Pod and Container Security Context (#38)
Browse files Browse the repository at this point in the history
* Inject Pod and Container Security Context

* Inject Pod and Container Security Context

* fix vulnerabilities

* fix vulnerabilities

* update trivy ignores

---------

Co-authored-by: Ravi Singal <[email protected]>
  • Loading branch information
abeytom07 and ravisingal authored Sep 24, 2024
1 parent 34bfa83 commit efc248e
Show file tree
Hide file tree
Showing 9 changed files with 371 additions and 2,432 deletions.
14 changes: 1 addition & 13 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
# org.scala-lang:scala-library (from upstream opensource dependency)
CVE-2022-36944 exp:2023-09-30

# org.xerial.snappy:snappy-java (from upstream opensource dependency)
CVE-2023-34453 exp:2023-09-30

# org.xerial.snappy:snappy-java (from upstream opensource dependency)
CVE-2023-34454 exp:2023-09-30

# org.xerial.snappy:snappy-java (from upstream opensource dependency)
CVE-2023-34455 exp:2023-09-30

# usr/local/bin/kubectl (gobinary)
CVE-2023-2253 exp:2023-09-30
CVE-2024-34156 exp:2024-10-31
2 changes: 1 addition & 1 deletion kafka-topic-creator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 AS builder
FROM golang:1.22.7 AS builder
COPY src/main/go /opt
WORKDIR /opt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ spec:
containers:
- name: topic-creator
image: {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
{{- with .Values.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
Expand All @@ -49,7 +53,7 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.securityContext }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions kafka-topic-creator/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ kafka:
# for these keys in minValueOverrideForTopicConfig, we will set for all topics to value here if either not set or when lower is provided
# ensure provided value for these keys is a 64 bit integer, else job will throw an error
minValueOverrideForTopicConfig: {}

containerSecurityContext: {}
podSecurityContext: {}
4 changes: 2 additions & 2 deletions kafka-topic-creator/src/main/go/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module hypertrace.org/kafka-topic-creator

go 1.21
go 1.22.7

require (
github.com/confluentinc/confluent-kafka-go/v2 v2.1.0
github.com/confluentinc/confluent-kafka-go/v2 v2.5.3
gopkg.in/yaml.v3 v3.0.1
)
2,756 changes: 344 additions & 2,412 deletions kafka-topic-creator/src/main/go/go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions kstreams-app-version-checker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine:3.18
FROM alpine:3.20

ENV KUBECTL_VERSION=v1.28.12
ENV KUBECTL_VERSION=v1.28.14

RUN apk add curl jq --no-cache && \
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" && \
Expand Down
10 changes: 9 additions & 1 deletion kstreams-app-version-checker/helm/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ spec:
app: {{ $jobName }}
release: {{ .Release.Name }}
spec:
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: kstreams-app-version-checker
image: {{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tagOverride }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: NAMESPACE
Expand All @@ -32,7 +40,7 @@ spec:
value: {{ int .Values.waitSeconds | default 360 | quote }}
- name: WORKLOADS
value: "{{ range $workload := .Values.workloads }}{{ $workload.name }},{{ $workload.type }},{{ $workload.container }};{{ end }}"
{{- with .Values.securityContext }}
{{- with .Values.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
4 changes: 4 additions & 0 deletions kstreams-app-version-checker/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ jobName: ""
configMapName: ""

workloads: []

resources: {}
containerSecurityContext: {}
podSecurityContext: {}

0 comments on commit efc248e

Please sign in to comment.