sdn-ovs.yaml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.10"},"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. containers:
  33. - name: openvswitch
  34. image: " "
  35. command:
  36. - /bin/bash
  37. - -c
  38. - |
  39. #!/bin/bash
  40. set -euo pipefail
  41. # if another process is listening on the cni-server socket, wait until it exits
  42. trap 'kill $(jobs -p); exit 0' TERM
  43. retries=0
  44. while true; do
  45. if /usr/share/openvswitch/scripts/ovs-ctl status &>/dev/null; then
  46. echo "warning: Another process is currently managing OVS, waiting 15s ..." 2>&1
  47. sleep 15 & wait
  48. (( retries += 1 ))
  49. else
  50. break
  51. fi
  52. if [[ "${retries}" -gt 40 ]]; then
  53. echo "error: Another process is currently managing OVS, exiting" 2>&1
  54. exit 1
  55. fi
  56. done
  57. # launch OVS
  58. function quit {
  59. /usr/share/openvswitch/scripts/ovs-ctl stop
  60. exit 0
  61. }
  62. trap quit SIGTERM
  63. /usr/share/openvswitch/scripts/ovs-ctl start --system-id=random
  64. while true; do sleep 5; done
  65. securityContext:
  66. runAsUser: 0
  67. privileged: true
  68. volumeMounts:
  69. - mountPath: /lib/modules
  70. name: host-modules
  71. readOnly: true
  72. - mountPath: /run/openvswitch
  73. name: host-run-ovs
  74. - mountPath: /var/run/openvswitch
  75. name: host-run-ovs
  76. - mountPath: /sys
  77. name: host-sys
  78. readOnly: true
  79. - mountPath: /etc/openvswitch
  80. name: host-config-openvswitch
  81. resources:
  82. requests:
  83. cpu: 100m
  84. memory: 200Mi
  85. limits:
  86. cpu: 200m
  87. memory: 300Mi
  88. volumes:
  89. - name: host-modules
  90. hostPath:
  91. path: /lib/modules
  92. - name: host-run-ovs
  93. hostPath:
  94. path: /run/openvswitch
  95. - name: host-sys
  96. hostPath:
  97. path: /sys
  98. - name: host-config-openvswitch
  99. hostPath:
  100. path: /etc/origin/openvswitch