File tree 7 files changed +43
-13
lines changed
7 files changed +43
-13
lines changed Original file line number Diff line number Diff line change 38
38
./get_helm.sh
39
39
40
40
#Install k3s
41
- curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -s - --docker
41
+ curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" INSTALL_K3S_VERSION="v1.24.4+k3s1" sh -s - --docker
42
42
43
43
mkdir ~/.kube || echo "~/.kube already existed"
44
44
sudo chmod 777 /etc/rancher/k3s/k3s.yaml
Original file line number Diff line number Diff line change 41
41
file : ./lightrun-init-agent/Dockerfile
42
42
push : true
43
43
tags : " lightruncom/k8s-operator-init-java-agent-linux:${{steps.set_tag.outputs.TAG_NAME}}"
44
- build-args : |
44
+ secrets : |
45
45
GITHUB_TOKEN=${{ secrets.PRETTY_GITHUB_READ_TOKEN }}
46
+ build-args : |
46
47
VERSION=${{ inputs.release_tag }}
47
48
FILE=agent.zip
48
49
53
54
file : ./lightrun-init-agent/Dockerfile
54
55
push : true
55
56
tags : " lightruncom/k8s-operator-init-java-agent-alpine:${{steps.set_tag.outputs.TAG_NAME}}"
56
- build-args : |
57
+ secrets : |
57
58
GITHUB_TOKEN=${{ secrets.PRETTY_GITHUB_READ_TOKEN }}
59
+ build-args : |
58
60
VERSION=${{ inputs.release_tag }}
59
61
FILE=agent-alpine.zip
60
62
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ metadata:
4
4
name : sample
5
5
spec :
6
6
initContainer :
7
- image : " lightruncom/k8s-operator-init-java-agent-linux:1.7.0 -init.0 "
7
+ image : " lightruncom/k8s-operator-init-java-agent-linux:1.8.5 -init.1 "
8
8
sharedVolumeName : lightrun-agent-init
9
9
sharedVolumeMountPath : " /lightrun"
10
10
deploymentName : app
Original file line number Diff line number Diff line change @@ -129,6 +129,18 @@ func (r *LightrunJavaAgentReconciler) addInitContainer(deploymentApplyConfig *ap
129
129
corev1 .ResourceMemory : * resource .NewScaledQuantity (int64 (64 ), resource .Scale (6 )),
130
130
},
131
131
),
132
+ ).
133
+ WithSecurityContext (
134
+ corev1ac .SecurityContext ().
135
+ WithCapabilities (
136
+ corev1ac .Capabilities ().WithDrop (corev1 .Capability ("ALL" )),
137
+ ).
138
+ WithAllowPrivilegeEscalation (false ).
139
+ WithRunAsNonRoot (true ).
140
+ WithSeccompProfile (
141
+ corev1ac .SeccompProfile ().
142
+ WithType (corev1 .SeccompProfileTypeRuntimeDefault ),
143
+ ),
132
144
),
133
145
)
134
146
}
Original file line number Diff line number Diff line change 20
20
- name : JAVA_TOOL_OPTIONS
21
21
value : -Djava.net.preferIPv4Stack=true
22
22
image : lightruncom/operator-demo-app
23
+ securityContext :
24
+ allowPrivilegeEscalation : false
25
+ capabilities :
26
+ drop : ["ALL"]
27
+ runAsNonRoot : true
28
+ seccompProfile :
29
+ type : RuntimeDefault
23
30
# Second container will be not patched, as not mentioned in the custom resource
24
- - name : busybox
25
- image : busybox
26
- command : ["/bin/sh", "-c", "--"]
27
- args : ["while true; do sleep 30; done;"]
31
+ - name : non-patched-app
32
+ image : lightruncom/operator-demo-app
33
+ securityContext :
34
+ allowPrivilegeEscalation : false
35
+ capabilities :
36
+ drop : ["ALL"]
37
+ runAsNonRoot : true
38
+ seccompProfile :
39
+ type : RuntimeDefault
Original file line number Diff line number Diff line change 1
1
FROM --platform=linux/amd64 alpine:latest
2
2
3
- ARG GITHUB_TOKEN
4
3
ARG VERSION
5
4
ARG FILE
6
5
7
-
8
6
RUN apk --no-cache add jq \
9
7
wget
10
- RUN export REPO="lightrun-platform/athena" ; \
8
+ RUN --mount=type=secret,id=GITHUB_TOKEN \
9
+ GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) \
10
+ export REPO="lightrun-platform/athena" ; \
11
11
# curl inside alpine can't properly forward cookies when downloading asset, hence wget
12
12
wget -q --auth-no-challenge --header='Accept:application/octet-stream' \
13
13
https://$GITHUB_TOKEN:@api.github.com/repos/$REPO/releases/assets/`wget -q -O- --auth-no-challenge --header "Accept: application/vnd.github+json" https://$GITHUB_TOKEN:@api.github.com/repos/$REPO/releases | jq ". | map(select(.tag_name == \" $VERSION\" ))[0].assets | map(select(.name == \" $FILE\" ))[0].id" ` \
@@ -17,7 +17,11 @@ RUN export REPO="lightrun-platform/athena"; \
17
17
rm -rf /tmp/agent.zip && \
18
18
# Erase default values
19
19
sed -i.bak "s|com.lightrun.secret=.*|com.lightrun.secret=|" /agent/agent.config && rm /agent/agent.config.bak && \
20
- sed -i.bak "s|pinned_certs=.*|pinned_certs=|" /agent/agent.config && rm /agent/agent.config.bak
20
+ sed -i.bak "s|pinned_certs=.*|pinned_certs=|" /agent/agent.config && rm /agent/agent.config.bak && \
21
+ # In openshift UID will be dynamic per project, hence chmo and not chown
22
+ chmod -R 777 /agent
23
+
24
+ USER 1000
21
25
22
26
COPY lightrun-init-agent/update_config.sh /update_config.sh
23
27
Original file line number Diff line number Diff line change @@ -24,5 +24,5 @@ echo "Set server and secrets"
24
24
sed -i.bak " s|com.lightrun.server=.*|com.lightrun.server=https://$LIGHTRUN_SERVER |" /agent/agent.config && rm /agent/agent.config.bak
25
25
sed -i.bak " s|com.lightrun.secret=.*|com.lightrun.secret=$LIGHTRUN_KEY |" /agent/agent.config && rm /agent/agent.config.bak
26
26
sed -i.bak " s|pinned_certs=.*|pinned_certs=$PINNED_CERT |" /agent/agent.config && rm /agent/agent.config.bak
27
- mv /agent /tmp/agent
27
+ cp -R /agent /tmp/agent
28
28
echo " Finished"
You can’t perform that action at this time.
0 commit comments