Skip to content

Commit 2a0401d

Browse files
committed
Maintenance Job only uses the first element of the LoadAffinity array from the ConfigMap.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
1 parent 7442d20 commit 2a0401d

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Maintenance Job only uses the first element of the LoadAffinity array

pkg/repository/maintenance/maintenance.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ func buildJob(
671671
}
672672

673673
if config != nil && len(config.LoadAffinities) > 0 {
674-
affinity := kube.ToSystemAffinity(config.LoadAffinities)
674+
// Maintenance job only takes the first loadAffinity.
675+
affinity := kube.ToSystemAffinity([]*kube.LoadAffinity{config.LoadAffinities[0]})
675676
job.Spec.Template.Spec.Affinity = affinity
676677
}
677678

site/content/docs/main/repository-maintenance.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,6 @@ data:
7777
},
7878
"keepLatestMaintenanceJobs": 1,
7979
"loadAffinity": [
80-
{
81-
"nodeSelector": {
82-
"matchExpressions": [
83-
{
84-
"key": "cloud.google.com/machine-family",
85-
"operator": "In",
86-
"values": [
87-
"e2"
88-
]
89-
}
90-
]
91-
}
92-
},
9380
{
9481
"nodeSelector": {
9582
"matchExpressions": [
@@ -119,10 +106,10 @@ data:
119106
}
120107
EOF
121108
```
122-
This sample showcases two affinity configurations:
123-
- matchLabels: maintenance job runs on nodes with label key `cloud.google.com/machine-family` and value `e2`.
109+
Notice: although loadAffinity is an array, Velero only takes the first element of the array.
110+
111+
This sample showcases how to use affinity configuration:
124112
- matchLabels: maintenance job runs on nodes located in `us-central1-a`, `us-central1-b` and `us-central1-c`.
125-
The nodes matching one of the two conditions are selected.
126113

127114
To create the configMap, users need to save something like the above sample to a json file and then run below command:
128115
```

0 commit comments

Comments
 (0)