Skip to content

Instantly share code, notes, and snippets.

@kyrtapz
Last active October 8, 2021 06:25
Show Gist options
  • Save kyrtapz/dfdef0b93ebaddd6879ad43b8b0ad4de to your computer and use it in GitHub Desktop.
Save kyrtapz/dfdef0b93ebaddd6879ad43b8b0ad4de to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ovsdb-mon
spec:
selector:
matchLabels:
name: ovsdb-mon
template:
metadata:
labels:
name: ovsdb-mon
spec:
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
containers:
- name: ovsdb-mon
image: quay.io/pdiak/fedora-ovn:latest
resources:
requests:
memory: "64Mi"
limits:
memory: "256Mi"
imagePullPolicy: IfNotPresent
env:
- name: OVS_RUNDIR
value: "/run/ovn"
command:
- /bin/bash
- -c
- "set -xe\n
\ git clone https://github.com/amorenoz/ovsdb-mon\n
\ pushd ovsdb-mon\n
\ declare -A db_schemas=( [\"OVN_Northbound\"]=\"ovnnb_db.sock\" [\"OVN_Southbound\"]=\"ovnsb_db.sock\" [\"Open_vSwitch\"]=\"db.sock\") \n
\ for k in \"${!db_schemas[@]}\"; do\n
\ #The following trick makes it work on upstream ovn-kubernetes as it uses different paths, it does nothing on openshift\n
\ ln -s /run/openvswitch/${db_schemas[${k}]} ${OVS_RUNDIR}/${db_schemas[${k}]} 2> /dev/null || true\n
\ if [ -e \"${OVS_RUNDIR}/${db_schemas[${k}]}\" ]; then\n
\ ovsdb-client get-schema \"unix:${OVS_RUNDIR}/${db_schemas[${k}]}\" ${k} > ${k}.schema\n
\ SCHEMA=${k}.schema make build \n
\ mv ./bin/ovsdb-mon /usr/local/bin/ovsdb-mon.${k}\n
\ fi\n
\ done \n
\ touch /tmp/build_finished
\ popd\n
\ trap : TERM INT; sleep infinity & wait"
volumeMounts:
- mountPath: /run/ovn/
name: run-ovn
- mountPath: /run/openvswitch/
name: run-ovs
readinessProbe:
exec:
command:
- ls
- /tmp/build_finished
initialDelaySeconds: 5
volumes:
- hostPath:
path: /run/ovn
type: ""
name: run-ovn
- hostPath:
path: /run/openvswitch
type: ""
name: run-ovs
hostNetwork: true
@kyrtapz
Copy link
Author

kyrtapz commented Oct 8, 2021

done, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment