|
| 1 | +suite: cilium-agent memory requests and limits |
| 2 | + |
| 3 | +# The cilium-agent DaemonSet ran with no resources at all, which put it in the |
| 4 | +# Talos userspace OOM handler's victim set: that handler (v1.12+) only ever |
| 5 | +# selects cgroups that lack memory.max, and picks by QoS class rather than by |
| 6 | +# what caused the pressure. Losing cilium-agent on a node takes that node's |
| 7 | +# datapath programming with it. |
| 8 | +# |
| 9 | +# The limit is what sets memory.max, and it is set on the POD cgroup only when |
| 10 | +# EVERY container in the pod has one — so all seven are asserted here, not just |
| 11 | +# the agent. Five of the init containers take their values from initResources; |
| 12 | +# install-cni-binaries carries upstream's own cni.resources and is asserted to |
| 13 | +# document that it is already covered rather than overlooked. |
| 14 | +# |
| 15 | +# Both keys are set from the umbrella values.yaml against the vendored subchart. |
| 16 | +# An upstream bump that renames or relocates either one renders nothing and |
| 17 | +# leaves no other trace, silently returning the pod to the victim set; catching |
| 18 | +# that is the main thing these assertions are for. |
| 19 | +release: |
| 20 | + name: cilium |
| 21 | + namespace: cozy-cilium |
| 22 | +tests: |
| 23 | + - it: cilium-agent declares a memory limit and request |
| 24 | + template: charts/cilium/templates/cilium-agent/daemonset.yaml |
| 25 | + documentSelector: |
| 26 | + path: kind |
| 27 | + value: DaemonSet |
| 28 | + asserts: |
| 29 | + - equal: |
| 30 | + path: spec.template.spec.containers[?(@.name=="cilium-agent")].resources.limits.memory |
| 31 | + value: 4Gi |
| 32 | + - equal: |
| 33 | + path: spec.template.spec.containers[?(@.name=="cilium-agent")].resources.requests.memory |
| 34 | + value: 256Mi |
| 35 | + |
| 36 | + # Asserted one container at a time. A negated matcher over the init container |
| 37 | + # list reads as if it covers them all but passes vacuously, so each limit is |
| 38 | + # pinned explicitly instead. |
| 39 | + - it: every cilium-agent init container declares a memory limit |
| 40 | + template: charts/cilium/templates/cilium-agent/daemonset.yaml |
| 41 | + documentSelector: |
| 42 | + path: kind |
| 43 | + value: DaemonSet |
| 44 | + asserts: |
| 45 | + - equal: |
| 46 | + path: spec.template.spec.initContainers[?(@.name=="config")].resources.limits.memory |
| 47 | + value: 256Mi |
| 48 | + - equal: |
| 49 | + path: spec.template.spec.initContainers[?(@.name=="mount-cgroup")].resources.limits.memory |
| 50 | + value: 256Mi |
| 51 | + - equal: |
| 52 | + path: spec.template.spec.initContainers[?(@.name=="apply-sysctl-overwrites")].resources.limits.memory |
| 53 | + value: 256Mi |
| 54 | + - equal: |
| 55 | + path: spec.template.spec.initContainers[?(@.name=="mount-bpf-fs")].resources.limits.memory |
| 56 | + value: 256Mi |
| 57 | + - equal: |
| 58 | + path: spec.template.spec.initContainers[?(@.name=="clean-cilium-state")].resources.limits.memory |
| 59 | + value: 256Mi |
| 60 | + # Upstream's cni.resources, not initResources — pinned so a bump that |
| 61 | + # drops it is caught here rather than by a pod that quietly loses |
| 62 | + # memory.max. |
| 63 | + - equal: |
| 64 | + path: spec.template.spec.initContainers[?(@.name=="install-cni-binaries")].resources.limits.memory |
| 65 | + value: 1Gi |
| 66 | + |
| 67 | + # cilium-envoy is a second DaemonSet on the same nodes. Its limit predates |
| 68 | + # this suite; it is pinned here because the pod-level argument above applies |
| 69 | + # to it identically. |
| 70 | + - it: cilium-envoy declares a memory limit and request |
| 71 | + template: charts/cilium/templates/cilium-envoy/daemonset.yaml |
| 72 | + documentSelector: |
| 73 | + path: kind |
| 74 | + value: DaemonSet |
| 75 | + asserts: |
| 76 | + - equal: |
| 77 | + path: spec.template.spec.containers[?(@.name=="cilium-envoy")].resources.limits.memory |
| 78 | + value: 1Gi |
| 79 | + - equal: |
| 80 | + path: spec.template.spec.containers[?(@.name=="cilium-envoy")].resources.requests.memory |
| 81 | + value: 512Mi |
0 commit comments