Add pod affinity weight input to pod scheduling tab

This commit is contained in:
Jordon 2021-09-13 10:11:25 -04:00
parent 75354adee1
commit b542e6157e
2 changed files with 21 additions and 3 deletions

View File

@ -4461,6 +4461,9 @@ workload:
label: Topology Key
placeholder: e.g. failure-domain.beta.kubernetes.io/zone
type: Type
weight:
label: Weight
placeholder: Must be a weight between 1 and 100
priority:
className: Priority Class Name
priority: Priority

View File

@ -106,14 +106,14 @@ export default {
this.allSelectorTerms.forEach((term) => {
if (term._anti) {
if (term.weight) {
const neu = { podAffinityTerm: term, weight: 1 };
const neu = { podAffinityTerm: term, weight: term.weight || this.defaultWeight };
podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution.push(neu);
} else {
podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution.push(term);
}
} else if (term.weight) {
const neu = { podAffinityTerm: term, weight: 1 };
const neu = { podAffinityTerm: term, weight: term.weight || this.defaultWeight };
podAffinity.preferredDuringSchedulingIgnoredDuringExecution.push(neu);
} else {
@ -139,7 +139,7 @@ export default {
if (term.weight) {
delete term.weight;
} else {
term.weight = 1;
term.weight = this.defaultWeight;
}
this.$set(this.allSelectorTerms, idx, clone(term));
@ -238,6 +238,21 @@ export default {
/>
</div>
</div>
<div class="spacer"></div>
<div class="row">
<div class="col span-6">
<LabeledInput
v-model.number="props.row.value.weight"
:mode="mode"
type="number"
min="1"
max="100"
:label="t('workload.scheduling.affinity.weight.label')"
:placeholder="t('workload.scheduling.affinity.weight.placeholder')"
/>
</div>
</div>
</template>
</ArrayListGrouped>
</div>