pod.yaml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. apiVersion: v1
  2. kind: Pod
  3. metadata:
  4. name: openwrt
  5. annotations:
  6. # Setting spec.force to true will make Flux recreate the Pod when any
  7. # immutable field is changed, forcing the Pod to run every time the
  8. # container image tag changes.
  9. kustomize.toolkit.fluxcd.io/force: enabled
  10. spec:
  11. restartPolicy: Never
  12. automountServiceAccountToken: false
  13. containers:
  14. - image: harbor.home.wugi.info/openwrt/rootfs:latest
  15. name: openwrt
  16. command:
  17. - /bin/sleep
  18. - infinity
  19. # - /bin/sh
  20. # - -c
  21. # - |
  22. # set -o nounset -o errexit -o pipefail -o xtrace
  23. # while [ -e /continue ]
  24. # do
  25. # sleep 5
  26. # done
  27. # network_namespace=$(printf ip-netns-%s $(tr -dc A-Za-z0-9 </dev/urandom | head -c 12))
  28. # ip netns add $network_namespace
  29. # network_interface=$(printf macvlan%s $(tr -dc A-Za-z0-9 </dev/urandom | head -c 8))
  30. # ip link add $network_interface link $SOURCE_NETWORK_INTERFACE_NAME type macvlan mode bridge
  31. # ip link set $network_interface netns $network_namespace
  32. # ip netns exec $network_namespace ip link set dev $network_interface name eth0
  33. # ip netns exec $network_namespace ip link set eth0 up
  34. # ip netns exec $network_namespace ip addr add $TARGET_NETWORK_INTERFACE_IP_ADDRESS dev eth0
  35. # ip netns exec $network_namespace ip route add default via $TARGET_NETWORK_INTERFACE_GATEWAY dev eth0
  36. # # XXX: Delete ping after fixing network availability without egress traffic from pod.
  37. # ip netns exec $network_namespace ping -c1 $TARGET_NETWORK_INTERFACE_GATEWAY || true
  38. # exec ip netns exec $network_namespace /sbin/init
  39. env:
  40. - name: SOURCE_NETWORK_INTERFACE_NAME
  41. value: eth0
  42. - name: TARGET_NETWORK_INTERFACE_IP_ADDRESS
  43. value: 192.168.0.148/24
  44. - name: TARGET_NETWORK_INTERFACE_GATEWAY
  45. value: 192.168.0.1
  46. ports:
  47. - containerPort: 80
  48. name: http
  49. protocol: TCP
  50. resources:
  51. limits:
  52. cpu: 2000m
  53. memory: 4096Mi
  54. requests:
  55. cpu: 100m
  56. memory: 512Mi
  57. securityContext:
  58. capabilities:
  59. add:
  60. - NET_ADMIN
  61. - NET_BIND_SERVICE
  62. - NET_RAW
  63. - SYS_ADMIN
  64. tty: true
  65. volumeMounts:
  66. - mountPath: /run
  67. name: run
  68. - mountPath: /tmp
  69. name: tmp
  70. volumes:
  71. - emptyDir:
  72. medium: Memory
  73. sizeLimit: 512M
  74. name: run
  75. - emptyDir:
  76. medium: Memory
  77. sizeLimit: 2G
  78. name: tmp