Skip to content

Commit 627092b

Browse files
ayuskauskaslockwobr
authored andcommitted
fix(agent): container has to run as root so it can do the chroot
1 parent fec6416 commit 627092b

File tree

4 files changed

+108
-1
lines changed

4 files changed

+108
-1
lines changed

agent/skyhook_agent/tests/test_controller.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

containers/agent.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@ FROM nvcr.io/nvidia/distroless/python:3.12-v3.4.10
4545
COPY --from=builder /code/venv/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
4646
COPY --from=builder /code/venv/bin/controller /usr/local/bin/
4747

48+
# Run as root so we can chroot
49+
USER 0:0
50+
4851
# Use Python to run the controller script
4952
ENTRYPOINT [ "python", "-m", "skyhook_agent.controller" ]

demos/debug_pod.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: debug-pod
5+
namespace: default
6+
spec:
7+
containers:
8+
- args:
9+
- -c
10+
- import time; time.sleep(100000)
11+
#- import os; print("hello"); os.chroot("/root"); os.makedirs("/root/test")
12+
command:
13+
- python
14+
image: ghcr.io/nvidia/skyhook/agent:25.04.12-000534-
15+
imagePullPolicy: Always
16+
name: debug
17+
resources:
18+
limits:
19+
cpu: 500m
20+
memory: 256Mi
21+
requests:
22+
cpu: 500m
23+
memory: 256Mi
24+
securityContext:
25+
privileged: true
26+
terminationMessagePath: /dev/termination-log
27+
terminationMessagePolicy: File
28+
volumeMounts:
29+
- mountPath: /home/nvs/root
30+
mountPropagation: HostToContainer
31+
name: root-mount
32+
dnsPolicy: ClusterFirst
33+
enableServiceLinks: true
34+
hostNetwork: true
35+
hostPID: true
36+
imagePullSecrets:
37+
- name: node-init-secret
38+
preemptionPolicy: PreemptLowerPriority
39+
priority: 0
40+
restartPolicy: Never
41+
schedulerName: default-scheduler
42+
securityContext: #{}
43+
runAsUser: 0
44+
runAsGroup: 0
45+
#runAsNonRoot: true
46+
serviceAccount: default
47+
serviceAccountName: default
48+
terminationGracePeriodSeconds: 30
49+
tolerations:
50+
- key: node.kubernetes.io/unschedulable
51+
operator: Exists
52+
- effect: NoExecute
53+
key: node.kubernetes.io/not-ready
54+
operator: Exists
55+
tolerationSeconds: 300
56+
- effect: NoExecute
57+
key: node.kubernetes.io/unreachable
58+
operator: Exists
59+
tolerationSeconds: 300
60+
volumes:
61+
- hostPath:
62+
path: /
63+
type: ""
64+
name: root-mount

demos/simple/scr.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# LICENSE START
3+
#
4+
# Copyright (c) NVIDIA CORPORATION. All rights reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# LICENSE END
19+
#
20+
21+
apiVersion: skyhook.nvidia.com/v1alpha1
22+
kind: Skyhook
23+
metadata:
24+
labels:
25+
app.kubernetes.io/part-of: skyhook-operator
26+
app.kubernetes.io/created-by: skyhook-operator
27+
name: demo
28+
spec:
29+
packages:
30+
baz:
31+
version: 1.1.0
32+
image: ghcr.io/nvidia/skyhook-packages/shellscript
33+
configMap:
34+
config.yaml: |-
35+
#!/bin/bash
36+
sleep 30
37+
echo "Hello, config!"
38+
config_check.yaml: |-
39+
#!/bin/bash
40+
sleep 30
41+
echo "Hello, config check!"

0 commit comments

Comments
 (0)