sdn-ovs.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 --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 set Open_vSwitch . other_config:n-revalidator-threads=4
  71. ovs-vsctl set Open_vSwitch . other_config:n-handler-threads=10
  72. fi
  73. while true; do sleep 5; done
  74. securityContext:
  75. runAsUser: 0
  76. privileged: true
  77. volumeMounts:
  78. - mountPath: /lib/modules
  79. name: host-modules
  80. readOnly: true
  81. - mountPath: /run/openvswitch
  82. name: host-run-ovs
  83. - mountPath: /var/run/openvswitch
  84. name: host-run-ovs
  85. - mountPath: /sys
  86. name: host-sys
  87. readOnly: true
  88. - mountPath: /etc/openvswitch
  89. name: host-config-openvswitch
  90. resources:
  91. requests:
  92. cpu: 100m
  93. memory: 300Mi
  94. limits:
  95. cpu: 200m
  96. memory: 400Mi
  97. volumes:
  98. - name: host-modules
  99. hostPath:
  100. path: /lib/modules
  101. - name: host-run-ovs
  102. hostPath:
  103. path: /run/openvswitch
  104. - name: host-sys
  105. hostPath:
  106. path: /sys
  107. - name: host-config-openvswitch
  108. hostPath:
  109. path: /etc/origin/openvswitch