Skip to content

Instantly share code, notes, and snippets.

View clementnuss's full-sized avatar
🐄

Clément Nussbaumer clementnuss

🐄
View GitHub Profile

the following ffmpeg permits to save images in highest quality to generate a timelapse:

export RTSP_STREAM='rtsps://abcdeffhijklmnop:1234/asdlfkjasdlf'
ffmpeg -loglevel error -rtsp_transport tcp \
  -i $RTSP_STREAM \
  -vf fps=1/120 \
  -q:v 1 -strftime 1 \
  "%Y-%m-%d_%H-%M-%S.jpg"
CNI_PATH=/opt/cni/bin:/opt/cni/bin
CNI_ARGS=IgnoreUnknown=true;K8S_POD_NAMESPACE=default;K8S_POD_NAME=nginx-f89759699-dv4hf;K8S_POD_INFRA_CONTAINER_ID=96638ef97eaf430ea57999413e5bc36caf25240bff2d24c49679fc7854850af0
CNI_CONTAINERID=96638ef97eaf430ea57999413e5bc36caf25240bff2d24c49679fc7854850af0
CNI_IFNAME=eth0
CNI_COMMAND=ADD
CNI_NETNS=/proc/280526/ns/net
@clementnuss
clementnuss / cni_interceptor.sh
Last active March 29, 2021 12:00
Bash script permitting to intercept CNI calls and log env, stdin, stdout, stderr
#!/bin/bash
# Auther Clément Nussbaumer <[email protected]>, Aug 2020
#
# CNI interception script: permits to do live debugging of CNI calls.
# Usage: rename the real cni binary file with by prepending the orginal binary name with real_
# E.g. for multus, real_multus. Now put this script in place the binary:
# Concretely, name it `multus` if you want to intercept multus calls.
cni=$(echo $0 | awk '{split($0,r,"/"); print r[length(r)]}')
echo 'intercepted '$cni' cni with command: ' $CNI_COMMAND ' and caller: ' $(ps -o comm= $PPID) | logger -t cni
# given $netns the the network namespace id. e.g. netns=46165437
# 1st: we create a virtual interface
ip link add name toto_if type ipip local 10.20.30.46 remote 10.30.30.1
# 2nd, we put this interface in the network namespace of our pod
ip link set dev toto_if netns $netns
# 3rd, we can for example change the ip address or routing parameters:
nsenter -t $netns --network ip addr add 1.2.3.4/30 dev toto_if