Skip to content

Commit

Permalink
fix paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jpc committed Mar 10, 2022
1 parent 2c5b2fa commit 4cab280
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions k8s-socketcan-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,23 @@ spec:
- sh
- -c
- chroot /root/ modprobe vcan || { chroot /root/ apt-get install -y linux-modules-extra-$(uname -r) && chroot /root/ modprobe vcan; } && echo Succesfully installed and loaded the vcan kernel module;
chroot /root/ mkdir -p /var/run/k8s-socketcan/ && echo Succesfully created the /var/run/k8s-socketcan/ folder;
chroot /root/ mknod /var/run/k8s-socketcan/fakedev b 1 1 && echo Succesfully created the /var/run/k8s-socketcan/fakedev device;
for path in /var/run/containerd/containerd.sock /var/snap/microk8s/common/run/containerd.sock /run/k3s/containerd/containerd.sock; do [ -S /root/$path ] && chroot /root/ ln -sfn $path /var/run/k8s-socketcan/containerd.sock && echo "Found containerd socket in $path" && break; done;
mknod /var/run/k8s-socketcan/fakedev b 1 1 && echo Succesfully created the /var/run/k8s-socketcan/fakedev device;
for path in /root/var/run/containerd/containerd.sock /root/var/snap/microk8s/common/run/containerd.sock /root/run/k3s/containerd/containerd.sock; do [ -S $path ] && ln -sfn $path /var/run/k8s-socketcan/containerd.sock && echo "Found containerd socket in $path" && break; done;
#tail -f /dev/null
securityContext:
privileged: true
capabilities:
drop: ["ALL"]
volumeMounts:
- name: root
mountPath: /root
- name: var-run-k8s-socketcan
mountPath: /var/run/k8s-socketcan
containers:
- name: k8s-socketcan
# image: busybox
# command: [ 'sh' ]
# args: [ '-c', 'exec tail -f /dev/null' ]
image: ghcr.io/collabora/k8s-socketcan:latest
env:
- name: SOCKETCAN_DEVICES
Expand All @@ -48,6 +53,8 @@ spec:
- name: device-plugin
mountPath: /var/lib/kubelet/device-plugins
volumes:
- name: var-run-k8s-socketcan
emptyDir: {}
- name: device-plugin
hostPath:
path: /var/lib/kubelet/device-plugins
Expand Down
4 changes: 2 additions & 2 deletions socketcan.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (scl SocketCANLister) NewPlugin(kind string) dpm.PluginInterface {

// Device plugin class
const (
fakeDevicePath = "/root/var/run/k8s-socketcan/fakedev"
fakeDevicePath = "/var/run/k8s-socketcan/fakedev"
)

type VCANDevicePlugin struct {
Expand Down Expand Up @@ -156,7 +156,7 @@ func (VCANDevicePlugin) GetPreferredAllocation(ctx context.Context, in *pluginap
// and keep checking all containers to look for this sentinel device. After we find one, we
// inject the network interface into it's namespace.
func (p *VCANDevicePlugin) interfaceCreator() {
client, err := containerd.New("/root/var/run/k8s-socketcan/containerd.sock")
client, err := containerd.New("/var/run/k8s-socketcan/containerd.sock")
if err != nil {
glog.V(3).Info("Failed to connect to containerd")
panic(err)
Expand Down

0 comments on commit 4cab280

Please sign in to comment.