|
| 1 | +suite: VM, VL and VT cluster replicas and Alertmanager spread over nodes |
| 2 | + |
| 3 | +# vm-operator copies spec.affinity onto the pods as written and adds none of |
| 4 | +# its own, so every tier below would otherwise be free to start both of its |
| 5 | +# replicas on one node. The term has to select the pods of its own component |
| 6 | +# and resource, which the operator labels app.kubernetes.io/name=<vm|vl|vt><kind> |
| 7 | +# and app.kubernetes.io/instance=<resource name>. A selector that misses them |
| 8 | +# spreads nothing. It has to stay a preference, because a storage pod on a |
| 9 | +# node-local volume cannot leave its node, and a required term would keep it |
| 10 | +# Pending wherever its replicas already share one. |
| 11 | + |
| 12 | +release: |
| 13 | + name: monitoring-system |
| 14 | + namespace: tenant-root |
| 15 | + |
| 16 | +set: |
| 17 | + _namespace: |
| 18 | + host: example.org |
| 19 | + ingress: tenant-root |
| 20 | + _cluster: |
| 21 | + expose-ingress: ingress |
| 22 | + host: example.org |
| 23 | + |
| 24 | +tests: |
| 25 | + - it: spreads every VMCluster tier over nodes with a preference |
| 26 | + templates: |
| 27 | + - templates/vm/vmcluster.yaml |
| 28 | + documentSelector: |
| 29 | + path: metadata.name |
| 30 | + value: shortterm |
| 31 | + asserts: |
| 32 | + - equal: |
| 33 | + path: spec.vmstorage.affinity |
| 34 | + value: |
| 35 | + podAntiAffinity: |
| 36 | + preferredDuringSchedulingIgnoredDuringExecution: |
| 37 | + - weight: 100 |
| 38 | + podAffinityTerm: |
| 39 | + topologyKey: kubernetes.io/hostname |
| 40 | + labelSelector: |
| 41 | + matchLabels: |
| 42 | + app.kubernetes.io/name: vmstorage |
| 43 | + app.kubernetes.io/instance: shortterm |
| 44 | + - equal: |
| 45 | + path: spec.vmselect.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchLabels |
| 46 | + value: |
| 47 | + app.kubernetes.io/name: vmselect |
| 48 | + app.kubernetes.io/instance: shortterm |
| 49 | + - equal: |
| 50 | + path: spec.vminsert.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchLabels |
| 51 | + value: |
| 52 | + app.kubernetes.io/name: vminsert |
| 53 | + app.kubernetes.io/instance: shortterm |
| 54 | + - notExists: |
| 55 | + path: spec.vmstorage.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution |
| 56 | + - notExists: |
| 57 | + path: spec.vmselect.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution |
| 58 | + - notExists: |
| 59 | + path: spec.vminsert.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution |
| 60 | + |
| 61 | + # Each metrics storage is its own VMCluster, so its term must count only its |
| 62 | + # own pods. Pods of shortterm do not keep longterm replicas apart. |
| 63 | + - it: keys each VMCluster's spread to its own resource |
| 64 | + templates: |
| 65 | + - templates/vm/vmcluster.yaml |
| 66 | + documentSelector: |
| 67 | + path: metadata.name |
| 68 | + value: longterm |
| 69 | + asserts: |
| 70 | + - equal: |
| 71 | + path: spec.vmstorage.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchLabels |
| 72 | + value: |
| 73 | + app.kubernetes.io/name: vmstorage |
| 74 | + app.kubernetes.io/instance: longterm |
| 75 | + |
| 76 | + - it: spreads every VLCluster tier over nodes with a preference |
| 77 | + templates: |
| 78 | + - templates/vlogs/vlogs.yaml |
| 79 | + documentSelector: |
| 80 | + path: metadata.name |
| 81 | + value: generic |
| 82 | + asserts: |
| 83 | + - equal: |
| 84 | + path: spec.vlstorage.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0] |
| 85 | + value: |
| 86 | + weight: 100 |
| 87 | + podAffinityTerm: |
| 88 | + topologyKey: kubernetes.io/hostname |
| 89 | + labelSelector: |
| 90 | + matchLabels: |
| 91 | + app.kubernetes.io/name: vlstorage |
| 92 | + app.kubernetes.io/instance: generic |
| 93 | + - equal: |
| 94 | + path: spec.vlselect.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchLabels |
| 95 | + value: |
| 96 | + app.kubernetes.io/name: vlselect |
| 97 | + app.kubernetes.io/instance: generic |
| 98 | + - equal: |
| 99 | + path: spec.vlinsert.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchLabels |
| 100 | + value: |
| 101 | + app.kubernetes.io/name: vlinsert |
| 102 | + app.kubernetes.io/instance: generic |
| 103 | + - notExists: |
| 104 | + path: spec.vlstorage.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution |
| 105 | + |
| 106 | + - it: spreads every VTCluster tier over nodes with a preference |
| 107 | + templates: |
| 108 | + - templates/vtraces/vtraces.yaml |
| 109 | + set: |
| 110 | + tracingStorages: |
| 111 | + - name: generic |
| 112 | + mode: cluster |
| 113 | + retentionPeriod: "14d" |
| 114 | + storage: 10Gi |
| 115 | + documentSelector: |
| 116 | + path: metadata.name |
| 117 | + value: generic |
| 118 | + asserts: |
| 119 | + - equal: |
| 120 | + path: spec.storage.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0] |
| 121 | + value: |
| 122 | + weight: 100 |
| 123 | + podAffinityTerm: |
| 124 | + topologyKey: kubernetes.io/hostname |
| 125 | + labelSelector: |
| 126 | + matchLabels: |
| 127 | + app.kubernetes.io/name: vtstorage |
| 128 | + app.kubernetes.io/instance: generic |
| 129 | + - equal: |
| 130 | + path: spec.select.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchLabels |
| 131 | + value: |
| 132 | + app.kubernetes.io/name: vtselect |
| 133 | + app.kubernetes.io/instance: generic |
| 134 | + - equal: |
| 135 | + path: spec.insert.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchLabels |
| 136 | + value: |
| 137 | + app.kubernetes.io/name: vtinsert |
| 138 | + app.kubernetes.io/instance: generic |
| 139 | + - notExists: |
| 140 | + path: spec.storage.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution |
| 141 | + |
| 142 | + - it: spreads the Alertmanager replicas over nodes with a preference |
| 143 | + templates: |
| 144 | + - templates/alerta/alerta.yaml |
| 145 | + documentSelector: |
| 146 | + path: kind |
| 147 | + value: VMAlertmanager |
| 148 | + asserts: |
| 149 | + - equal: |
| 150 | + path: spec.affinity |
| 151 | + value: |
| 152 | + podAntiAffinity: |
| 153 | + preferredDuringSchedulingIgnoredDuringExecution: |
| 154 | + - weight: 100 |
| 155 | + podAffinityTerm: |
| 156 | + topologyKey: kubernetes.io/hostname |
| 157 | + labelSelector: |
| 158 | + matchLabels: |
| 159 | + app.kubernetes.io/name: vmalertmanager |
| 160 | + app.kubernetes.io/instance: alertmanager |
0 commit comments