|
| 1 | +--- |
| 2 | +suite: Placement (NodeSelector Tolerations and Affinity) |
| 3 | +templates: |
| 4 | + # primary template files |
| 5 | + - deployments.yaml |
| 6 | + - jobs.yaml |
| 7 | + |
| 8 | + # included templates must also be listed |
| 9 | + - configmaps_packs.yaml |
| 10 | + - configmaps_rbac.yaml |
| 11 | + - configmaps_st2-conf.yaml |
| 12 | + - configmaps_st2-urls.yaml |
| 13 | + - configmaps_st2web.yaml |
| 14 | + - secrets_datastore_crypto_key.yaml |
| 15 | + - secrets_ssh.yaml |
| 16 | + - secrets_st2apikeys.yaml |
| 17 | + - secrets_st2auth.yaml |
| 18 | + - secrets_st2chatops.yaml |
| 19 | + |
| 20 | +# nodeSelector & tolerations & affinity: |
| 21 | +# st2web .nodeSelector, .tolerations, .affinity |
| 22 | +# st2auth .nodeSelector, .tolerations, .affinity |
| 23 | +# st2api .nodeSelector, .tolerations, .affinity |
| 24 | +# st2stream .nodeSelector, .tolerations, .affinity |
| 25 | +# st2rulesengine .nodeSelector, .tolerations, .affinity |
| 26 | +# st2timersengine .nodeSelector, .tolerations, .affinity |
| 27 | +# st2workflowengine .nodeSelector, .tolerations, .affinity |
| 28 | +# st2scheduler .nodeSelector, .tolerations, .affinity |
| 29 | +# st2notifier .nodeSelector, .tolerations, .affinity |
| 30 | +# st2actionrunner .nodeSelector, .tolerations, .affinity |
| 31 | +# st2sensorcontainer .nodeSelector, .tolerations, .affinity |
| 32 | +# st2garbagecollector .nodeSelector, .tolerations, .affinity |
| 33 | +# st2chatops .nodeSelector, .tolerations, .affinity |
| 34 | +# jobs .nodeSelector, .tolerations, .affinity |
| 35 | + |
| 36 | +tests: |
| 37 | + - it: Deployments and Jobs have no default placement |
| 38 | + templates: |
| 39 | + - deployments.yaml |
| 40 | + # st2auth, st2api, |
| 41 | + # st2stream, st2web, |
| 42 | + # st2rulesengine, st2timersengine, |
| 43 | + # st2workflowengine, st2scheduler, |
| 44 | + # st2notifier, (1) st2sensorcontainer, |
| 45 | + # st2actionrunner, st2garbagecollector, |
| 46 | + # st2client, st2chatops |
| 47 | + - jobs.yaml |
| 48 | + # job-st2-apply-rbac-defintions |
| 49 | + # job-st2-apikey-load |
| 50 | + # job-st2-key-load |
| 51 | + # job-st2-register-content |
| 52 | + set: |
| 53 | + st2: |
| 54 | + rbac: { enabled: true } # enable rbac job |
| 55 | + packs: { sensors: [] } # ensure only 1 sensor |
| 56 | + st2chatops: |
| 57 | + enabled: true |
| 58 | + asserts: |
| 59 | + - isNull: |
| 60 | + path: spec.template.spec.nodeSelector |
| 61 | + - isNull: |
| 62 | + path: spec.template.spec.tolerations |
| 63 | + - isNull: |
| 64 | + path: spec.template.spec.affinity |
| 65 | + |
| 66 | + - it: Deployments and Jobs accept custom placement |
| 67 | + templates: |
| 68 | + - deployments.yaml |
| 69 | + # st2auth, st2api, |
| 70 | + # st2stream, st2web, |
| 71 | + # st2rulesengine, st2timersengine, |
| 72 | + # st2workflowengine, st2scheduler, |
| 73 | + # st2notifier, (1) st2sensorcontainer, |
| 74 | + # st2actionrunner, st2garbagecollector, |
| 75 | + # st2client, st2chatops |
| 76 | + - jobs.yaml |
| 77 | + # job-st2-apply-rbac-defintions |
| 78 | + # job-st2-apikey-load |
| 79 | + # job-st2-key-load |
| 80 | + # job-st2-register-content |
| 81 | + set: |
| 82 | + st2: |
| 83 | + rbac: { enabled: true } # enable rbac job |
| 84 | + packs: { sensors: [] } # ensure only 1 sensor |
| 85 | + st2web: |
| 86 | + # these examples come from the k8s docs |
| 87 | + nodeSelector: &custom_nodeSelector |
| 88 | + disktype: ssd |
| 89 | + tolerations: &custom_tolerations |
| 90 | + - key: "key1" |
| 91 | + operator: "Equal" |
| 92 | + value: "value1" |
| 93 | + effect: "NoSchedule" |
| 94 | + - key: "key1" |
| 95 | + operator: "Equal" |
| 96 | + value: "value1" |
| 97 | + effect: "NoExecute" |
| 98 | + affinity: &custom_affinity |
| 99 | + podAffinity: |
| 100 | + requiredDuringSchedulingIgnoredDuringExecution: |
| 101 | + - labelSelector: |
| 102 | + matchExpressions: |
| 103 | + - key: security |
| 104 | + operator: In |
| 105 | + values: |
| 106 | + - S1 |
| 107 | + topologyKey: topology.kubernetes.io/zone |
| 108 | + podAntiAffinity: |
| 109 | + preferredDuringSchedulingIgnoredDuringExecution: |
| 110 | + - weight: 100 |
| 111 | + podAffinityTerm: |
| 112 | + labelSelector: |
| 113 | + matchExpressions: |
| 114 | + - key: security |
| 115 | + operator: In |
| 116 | + values: |
| 117 | + - S2 |
| 118 | + topologyKey: topology.kubernetes.io/zone |
| 119 | + st2auth: |
| 120 | + nodeSelector: *custom_nodeSelector |
| 121 | + tolerations: *custom_tolerations |
| 122 | + affinity: *custom_affinity |
| 123 | + st2api: |
| 124 | + nodeSelector: *custom_nodeSelector |
| 125 | + tolerations: *custom_tolerations |
| 126 | + affinity: *custom_affinity |
| 127 | + st2stream: |
| 128 | + nodeSelector: *custom_nodeSelector |
| 129 | + tolerations: *custom_tolerations |
| 130 | + affinity: *custom_affinity |
| 131 | + st2rulesengine: |
| 132 | + nodeSelector: *custom_nodeSelector |
| 133 | + tolerations: *custom_tolerations |
| 134 | + affinity: *custom_affinity |
| 135 | + st2timersengine: |
| 136 | + nodeSelector: *custom_nodeSelector |
| 137 | + tolerations: *custom_tolerations |
| 138 | + affinity: *custom_affinity |
| 139 | + st2workflowengine: |
| 140 | + nodeSelector: *custom_nodeSelector |
| 141 | + tolerations: *custom_tolerations |
| 142 | + affinity: *custom_affinity |
| 143 | + st2scheduler: |
| 144 | + nodeSelector: *custom_nodeSelector |
| 145 | + tolerations: *custom_tolerations |
| 146 | + affinity: *custom_affinity |
| 147 | + st2notifier: |
| 148 | + nodeSelector: *custom_nodeSelector |
| 149 | + tolerations: *custom_tolerations |
| 150 | + affinity: *custom_affinity |
| 151 | + st2actionrunner: |
| 152 | + nodeSelector: *custom_nodeSelector |
| 153 | + tolerations: *custom_tolerations |
| 154 | + affinity: *custom_affinity |
| 155 | + st2sensorcontainer: |
| 156 | + nodeSelector: *custom_nodeSelector |
| 157 | + tolerations: *custom_tolerations |
| 158 | + affinity: *custom_affinity |
| 159 | + st2garbagecollector: |
| 160 | + nodeSelector: *custom_nodeSelector |
| 161 | + tolerations: *custom_tolerations |
| 162 | + affinity: *custom_affinity |
| 163 | + st2client: |
| 164 | + nodeSelector: *custom_nodeSelector |
| 165 | + tolerations: *custom_tolerations |
| 166 | + affinity: *custom_affinity |
| 167 | + st2chatops: |
| 168 | + enabled: true |
| 169 | + nodeSelector: *custom_nodeSelector |
| 170 | + tolerations: *custom_tolerations |
| 171 | + affinity: *custom_affinity |
| 172 | + jobs: |
| 173 | + nodeSelector: *custom_nodeSelector |
| 174 | + tolerations: *custom_tolerations |
| 175 | + affinity: *custom_affinity |
| 176 | + asserts: |
| 177 | + - equal: |
| 178 | + path: spec.template.spec.nodeSelector |
| 179 | + value: *custom_nodeSelector |
| 180 | + - equal: |
| 181 | + path: spec.template.spec.tolerations |
| 182 | + value: *custom_tolerations |
| 183 | + - equal: |
| 184 | + path: spec.template.spec.affinity |
| 185 | + value: *custom_affinity |
0 commit comments