File tree Expand file tree Collapse file tree 7 files changed +43
-13
lines changed Expand file tree Collapse file tree 7 files changed +43
-13
lines changed Original file line number Diff line number Diff line change 3838 ./get_helm.sh
3939
4040 #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
4242
4343 mkdir ~/.kube || echo "~/.kube already existed"
4444 sudo chmod 777 /etc/rancher/k3s/k3s.yaml
Original file line number Diff line number Diff line change 4141 file : ./lightrun-init-agent/Dockerfile
4242 push : true
4343 tags : " lightruncom/k8s-operator-init-java-agent-linux:${{steps.set_tag.outputs.TAG_NAME}}"
44- build-args : |
44+ secrets : |
4545 GITHUB_TOKEN=${{ secrets.PRETTY_GITHUB_READ_TOKEN }}
46+ build-args : |
4647 VERSION=${{ inputs.release_tag }}
4748 FILE=agent.zip
4849
5354 file : ./lightrun-init-agent/Dockerfile
5455 push : true
5556 tags : " lightruncom/k8s-operator-init-java-agent-alpine:${{steps.set_tag.outputs.TAG_NAME}}"
56- build-args : |
57+ secrets : |
5758 GITHUB_TOKEN=${{ secrets.PRETTY_GITHUB_READ_TOKEN }}
59+ build-args : |
5860 VERSION=${{ inputs.release_tag }}
5961 FILE=agent-alpine.zip
6062
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ metadata:
44 name : sample
55spec :
66 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 "
88 sharedVolumeName : lightrun-agent-init
99 sharedVolumeMountPath : " /lightrun"
1010 deploymentName : app
Original file line number Diff line number Diff line change @@ -129,6 +129,18 @@ func (r *LightrunJavaAgentReconciler) addInitContainer(deploymentApplyConfig *ap
129129 corev1 .ResourceMemory : * resource .NewScaledQuantity (int64 (64 ), resource .Scale (6 )),
130130 },
131131 ),
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+ ),
132144 ),
133145 )
134146}
Original file line number Diff line number Diff line change 2020 - name : JAVA_TOOL_OPTIONS
2121 value : -Djava.net.preferIPv4Stack=true
2222 image : lightruncom/operator-demo-app
23+ securityContext :
24+ allowPrivilegeEscalation : false
25+ capabilities :
26+ drop : ["ALL"]
27+ runAsNonRoot : true
28+ seccompProfile :
29+ type : RuntimeDefault
2330 # 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 11FROM --platform=linux/amd64 alpine:latest
22
3- ARG GITHUB_TOKEN
43ARG VERSION
54ARG FILE
65
7-
86RUN apk --no-cache add jq \
97 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" ; \
1111 # curl inside alpine can't properly forward cookies when downloading asset, hence wget
1212 wget -q --auth-no-challenge --header='Accept:application/octet-stream' \
1313 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"; \
1717 rm -rf /tmp/agent.zip && \
1818 # Erase default values
1919 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
2125
2226COPY lightrun-init-agent/update_config.sh /update_config.sh
2327
Original file line number Diff line number Diff line change @@ -24,5 +24,5 @@ echo "Set server and secrets"
2424sed -i.bak " s|com.lightrun.server=.*|com.lightrun.server=https://$LIGHTRUN_SERVER |" /agent/agent.config && rm /agent/agent.config.bak
2525sed -i.bak " s|com.lightrun.secret=.*|com.lightrun.secret=$LIGHTRUN_KEY |" /agent/agent.config && rm /agent/agent.config.bak
2626sed -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
2828echo " Finished"
You can’t perform that action at this time.
0 commit comments