sdn-ovs.yaml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. kind: DaemonSet
  2. apiVersion: apps/v1
  3. metadata:
  4. name: ovs
  5. namespace: openshift-sdn
  6. annotations:
  7. kubernetes.io/description: |
  8. This daemon set launches the openvswitch daemon.
  9. image.openshift.io/triggers: |
  10. [{"from":{"kind":"ImageStreamTag","name":"node:v3.11"},"fieldPath":"spec.template.spec.containers[?(@.name==\"openvswitch\")].image"}]
  11. spec:
  12. selector:
  13. matchLabels:
  14. app: ovs
  15. updateStrategy:
  16. type: RollingUpdate
  17. template:
  18. metadata:
  19. labels:
  20. app: ovs
  21. component: network
  22. type: infra
  23. openshift.io/component: network
  24. annotations:
  25. scheduler.alpha.kubernetes.io/critical-pod: ''
  26. spec:
  27. # Requires fairly broad permissions - ability to read all services and network functions as well
  28. # as all pods.
  29. serviceAccountName: sdn
  30. hostNetwork: true
  31. hostPID: true
  32. priorityClassName: system-node-critical
  33. containers:
  34. - name: openvswitch
  35. image: " "
  36. command:
  37. - /bin/bash
  38. - -c
  39. - |
  40. #!/bin/bash
  41. set -euo pipefail
  42. # if another process is listening on the cni-server socket, wait until it exits
  43. trap 'kill $(jobs -p); exit 0' TERM
  44. retries=0
  45. while true; do
  46. if /usr/share/openvswitch/scripts/ovs-ctl status &>/dev/null; then
  47. echo "warning: Another process is currently managing OVS, waiting 15s ..." 2>&1
  48. sleep 15 & wait
  49. (( retries += 1 ))
  50. else
  51. break
  52. fi
  53. if [[ "${retries}" -gt 40 ]]; then
  54. echo "error: Another process is currently managing OVS, exiting" 2>&1
  55. exit 1
  56. fi
  57. done
  58. # launch OVS
  59. function quit {
  60. /usr/share/openvswitch/scripts/ovs-ctl stop
  61. exit 0
  62. }
  63. trap quit SIGTERM
  64. /usr/share/openvswitch/scripts/ovs-ctl start --no-ovs-vswitchd --system-id=random
  65. # Restrict the number of pthreads ovs-vswitchd creates to reduce the
  66. # amount of RSS it uses on hosts with many cores
  67. # https://bugzilla.redhat.com/show_bug.cgi?id=1571379
  68. # https://bugzilla.redhat.com/show_bug.cgi?id=1572797
  69. if [[ `nproc` -gt 12 ]]; then
  70. ovs-vsctl --no-wait set Open_vSwitch . other_config:n-revalidator-threads=4
  71. ovs-vsctl --no-wait set Open_vSwitch . other_config:n-handler-threads=10
  72. fi
  73. /usr/share/openvswitch/scripts/ovs-ctl start --no-ovsdb-server --system-id=random
  74. while true; do sleep 5; done
  75. securityContext:
  76. runAsUser: 0
  77. privileged: true
  78. volumeMounts:
  79. - mountPath: /lib/modules
  80. name: host-modules
  81. readOnly: true
  82. - mountPath: /run/openvswitch
  83. name: host-run-ovs
  84. - mountPath: /var/run/openvswitch
  85. name: host-run-ovs
  86. - mountPath: /sys
  87. name: host-sys
  88. readOnly: true
  89. - mountPath: /etc/openvswitch
  90. name: host-config-openvswitch
  91. resources:
  92. requests:
  93. cpu: 100m
  94. memory: 300Mi
  95. limits:
  96. cpu: 200m
  97. memory: 400Mi
  98. volumes:
  99. - name: host-modules
  100. hostPath:
  101. path: /lib/modules
  102. - name: host-run-ovs
  103. hostPath:
  104. path: /run/openvswitch
  105. - name: host-sys
  106. hostPath:
  107. path: /sys
  108. - name: host-config-openvswitch
  109. hostPath:
  110. path: /etc/origin/openvswitch