Skip to content

Commit b3d343b

Browse files
committed
wip
1 parent 3d5954a commit b3d343b

File tree

14 files changed

+220
-234
lines changed

14 files changed

+220
-234
lines changed

Dockerfile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,33 @@ ARG BUILD_SNAPSHOT=true
1212
ARG SKIP_LICENSES_REPORT=false
1313
ARG VERSION=unknown
1414
ARG REVISION=unknown
15+
ARG RUNC_VERSION=v1.1.15
16+
ARG CRUN_VERSION=1.21
1517

1618
WORKDIR /app
1719

1820
RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' > /etc/apt/sources.list.d/goreleaser.list \
1921
&& apt-get -qq update \
20-
&& apt-get -qq install -y --no-install-recommends build-essential libcap2-bin goreleaser
22+
&& apt-get -qq install -y --no-install-recommends build-essential libcap2-bin goreleaser gpg curl
2123

2224
COPY . .
2325

26+
#Ambient set of capabilities are not really working, therefore we set the capabilities on the binary directly. More on this: https://github.com/kubernetes/kubernetes/issues/56374
2427
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH goreleaser build --snapshot="${BUILD_SNAPSHOT}" --single-target -o extension \
2528
&& setcap "cap_setuid,cap_setgid,cap_sys_admin,cap_dac_override,cap_sys_ptrace+eip" ./extension
2629

30+
# As of today the runc binary from debian is built using golang 1.19.8 and will be flagged by CVE scanners as vulnerable to several CVEs.
31+
# We are dowonloading the runc binary from the official github release page and will use it instead of the one from the debian package.
32+
RUN curl --proto "=https" -sfL https://github.com/opencontainers/runc/releases/download/$RUNC_VERSION/runc.$TARGETARCH -o ./runc \
33+
&& curl --proto "=https" -sfL -o - https://raw.githubusercontent.com/opencontainers/runc/refs/heads/main/runc.keyring | gpg --import \
34+
&& curl --proto "=https" -sfL -o - https://github.com/opencontainers/runc/releases/download/$RUNC_VERSION/runc.$TARGETARCH.asc | gpg --verify - ./runc \
35+
&& chmod a+x ./runc
36+
37+
RUN curl --proto "=https" -sfL https://github.com/containers/crun/releases/download/$CRUN_VERSION/crun-$CRUN_VERSION-linux-$TARGETARCH -o ./crun \
38+
&& curl --proto "=https" -sfL -o - https://github.com/giuseppe.gpg | gpg --import \
39+
&& curl --proto "=https" -sfL -o - https://github.com/containers/crun/releases/download/$CRUN_VERSION/crun-$CRUN_VERSION-linux-$TARGETARCH.asc | gpg --verify - ./crun \
40+
&& chmod a+x ./crun
41+
2742
##
2843
## Runtime
2944
##
@@ -50,10 +65,13 @@ RUN groupadd --gid $USER_GID $USERNAME \
5065
RUN apt-get -qq update \
5166
&& apt-get -qq upgrade -y \
5267
&& apt-get -y autoremove \
53-
&& apt-get -qq install -y --no-install-recommends runc procps \
68+
&& apt-get -qq install -y --no-install-recommends procps \
5469
&& apt-get -y autoremove \
5570
&& rm -rf /var/lib/apt/lists/*
5671

72+
COPY --from=build /app/runc /usr/sbin/runc
73+
COPY --from=build /app/crun /usr/bin/crun
74+
5775
USER $USER_UID
5876

5977
WORKDIR /

charts/steadybit-extension-jvm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: steadybit-extension-jvm
33
description: Steadybit jvm extension Helm chart for Kubernetes.
4-
version: 1.1.21
4+
version: 1.2.0
55
appVersion: v1.2.4
66
home: https://www.steadybit.com/
77
icon: https://steadybit-website-assets.s3.amazonaws.com/logo-symbol-transparent.png

charts/steadybit-extension-jvm/templates/_helpers.tpl

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,26 @@
22
{{/*
33
checks the .Values.containerRuntime for valid values
44
*/}}
5-
{{- define "containerRuntime.valid" -}}
6-
{{- $valid := keys .Values.containerRuntimes | sortAlpha -}}
7-
{{- $runtime := .Values.container.runtime -}}
8-
{{- if has $runtime $valid -}}
9-
{{- $runtime -}}
5+
{{- define "containerEngine.valid" -}}
6+
{{- $valid := keys .Values.containerEngines | sortAlpha -}}
7+
{{- if has .Values.container.runtime $valid -}}
8+
{{- .Values.container.runtime -}}
9+
{{- else if has .Values.container.engine $valid -}}
10+
{{- .Values.container.engine -}}
1011
{{- else -}}
11-
{{- fail (printf "unknown container runtime: %v (must be one of %s)" $runtime (join ", " $valid)) -}}
12+
{{- fail (printf "unknown container.engine: %v (must be one of %s)" .Values.container.engine (join ", " $valid)) -}}
1213
{{- end -}}
1314
{{- end -}}
1415

15-
1616
{{- /*
17-
containerRuntime.volumeMounts will render pod volume mounts(without indentation) for the selected container runtime
17+
ociRuntime.root will render the root for the selected container runtime
1818
*/}}
19-
{{- define "containerRuntime.volumeMounts" -}}
20-
{{- $runtime := (include "containerRuntime.valid" . ) -}}
21-
{{- $runtimeValues := get .Values.containerRuntimes $runtime -}}
22-
- name: "runtime-socket"
23-
mountPath: "{{ $runtimeValues.socket }}"
24-
- name: "runtime-runc-root"
25-
mountPath: "{{ $runtimeValues.runcRoot }}"
26-
{{- end -}}
27-
28-
{{- /*
29-
containerRuntime.volumes will render pod volumes (without indentation) for the selected container runtime
30-
*/}}
31-
{{- define "containerRuntime.volumes" -}}
32-
{{- $runtime := (include "containerRuntime.valid" . ) -}}
33-
{{- $runtimeValues := get .Values.containerRuntimes $runtime -}}
34-
- name: "runtime-socket"
35-
hostPath:
36-
path: "{{ $runtimeValues.socket }}"
37-
type: Socket
38-
- name: "runtime-runc-root"
39-
hostPath:
40-
path: "{{ $runtimeValues.runcRoot }}"
41-
type: Directory
19+
{{- define "ociRuntime.get" -}}
20+
{{- $top := index . 0 -}}
21+
{{- $field := index . 1 -}}
22+
{{- $engine := (include "containerEngine.valid" $top ) -}}
23+
{{- $engineValues := get $top.Values.containerEngines $engine -}}
24+
{{- index $engineValues.ociRuntime $field -}}
4225
{{- end -}}
4326

4427
{{- /*
@@ -54,3 +37,4 @@ will omit attribute from the passed in object depending on the KubeVersion
5437
{{- end -}}
5538
{{- $dict | toYaml -}}
5639
{{- end -}}
40+

charts/steadybit-extension-jvm/templates/daemonset.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ metadata:
44
name: {{ include "extensionlib.names.fullname" . }}
55
namespace: {{ .Release.Namespace }}
66
labels:
7+
{{- include "extensionlib.labels" (list .) | nindent 4 }}
78
{{- range $key, $value := .Values.extraLabels }}
89
{{ $key }}: {{ $value }}
910
{{- end }}
10-
{{- include "extensionlib.labels" (list .) | nindent 4 }}
1111
spec:
1212
selector:
1313
matchLabels:
1414
app.kubernetes.io/name: {{ include "extensionlib.names.name" . }}
1515
app: {{ include "extensionlib.names.name" . }}
1616
updateStrategy:
17-
# updateStrategy.type -- Specifies the strategy used to replace old Pods by new ones.
18-
type: RollingUpdate
17+
type: {{ .Values.updateStrategy.type }}
18+
{{- if eq .Values.updateStrategy.type "RollingUpdate" }}
1919
rollingUpdate:
20-
# updateStrategy.rollingUpdate.maxSurge -- The maximum number of DaemonSet pods that can be unavailable during the update.
21-
maxUnavailable: 1
20+
maxUnavailable: {{ .Values.updateStrategy.rollingUpdate.maxUnavailable }}
21+
{{- end }}
2222
template:
2323
metadata:
2424
labels:
@@ -33,7 +33,7 @@ spec:
3333
{{- end }}
3434
annotations:
3535
{{- if semverCompare "<1.30-0" .Capabilities.KubeVersion.Version}}
36-
"container.apparmor.security.beta.kubernetes.io/{{ include "extensionlib.names.name" . }}": unconfined
36+
"container.apparmor.security.beta.kubernetes.io/steadybit-extension-jvm": unconfined
3737
{{- end }}
3838
{{- include "extensionlib.annotation" (list . .Values.containerPorts.http (.Values.daemonSet.extensionlib.list) ) | nindent 8 }}
3939
oneagent.dynatrace.com/injection: "false"
@@ -61,7 +61,7 @@ spec:
6161
limits:
6262
memory: {{ .Values.resources.limits.memory }}
6363
cpu: {{ .Values.resources.limits.cpu }}
64-
name: {{ include "extensionlib.names.name" . }}
64+
name: steadybit-extension-jvm
6565
ports:
6666
- name: http
6767
containerPort: {{ .Values.containerPorts.http }}
@@ -82,6 +82,10 @@ spec:
8282
- name: STEADYBIT_EXTENSION_DISCOVERY_ATTRIBUTES_EXCLUDES_JVM
8383
value: {{ join "," .Values.discovery.attributes.excludes.jvm | quote }}
8484
{{- end }}
85+
- name: STEADYBIT_EXTENSION_OCIRUNTIME_ROOT
86+
value: {{ include "ociRuntime.get" (list . "root") | quote }}
87+
- name: STEADYBIT_EXTENSION_OCIRUNTIME_PATH
88+
value: {{ include "ociRuntime.get" (list . "path") | quote }}
8589
{{- include "extensionlib.deployment.env" (list .) | nindent 12 }}
8690
{{- with .Values.extraEnv }}
8791
{{- toYaml . | nindent 12 }}
@@ -95,7 +99,8 @@ spec:
9599
mountPath: /tmp
96100
- name: cgroup-root
97101
mountPath: /sys/fs/cgroup
98-
{{- include "containerRuntime.volumeMounts" . | nindent 12 }}
102+
- name: "ociruntime-root"
103+
mountPath: {{ include "ociRuntime.get" (list . "root") | quote }}
99104
{{- include "extensionlib.deployment.volumeMounts" (list .) | nindent 12 }}
100105
livenessProbe:
101106
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }}
@@ -126,7 +131,10 @@ spec:
126131
hostPath:
127132
path: /sys/fs/cgroup
128133
type: Directory
129-
{{- include "containerRuntime.volumes" . | nindent 8 }}
134+
- name: "ociruntime-root"
135+
hostPath:
136+
path: {{ include "ociRuntime.get" (list . "root") | quote }}
137+
type: Directory
130138
{{- include "extensionlib.deployment.volumes" (list .) | nindent 8 }}
131139
serviceAccountName: {{ .Values.serviceAccount.name }}
132140
{{- with .Values.nodeSelector }}

0 commit comments

Comments
 (0)