Skip to content

Commit bb071c1

Browse files
authored
Merge pull request #702 from dashashutosh80/feat/repo-maintenance-configmap
2 parents d3f1b6f + e0cce3a commit bb071c1

File tree

6 files changed

+242
-1
lines changed

6 files changed

+242
-1
lines changed

charts/velero/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ appVersion: 1.16.2
33
kubeVersion: ">=1.16.0-0"
44
description: A Helm chart for velero
55
name: velero
6-
version: 10.0.13
6+
version: 10.1.0
77
home: https://github.com/vmware-tanzu/velero
88
icon: https://cdn-images-1.medium.com/max/1600/1*-9mb3AKnKdcL_QD3CMnthQ.png
99
sources:

charts/velero/README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,107 @@ CSI plugin has been merged into velero repo in v1.14 release. It will be install
102102

103103
This version removes the `nodeAgent.privileged` field, you should use `nodeAgent.containerSecurityContext.privileged` instead
104104

105+
## Repository Maintenance Configuration
106+
107+
Starting from Velero v1.15, you can configure repository maintenance jobs with different resource limits and node affinity settings per repository using a ConfigMap. This feature is supported through the Helm chart.
108+
109+
### Basic Usage
110+
111+
To enable per-repository maintenance configuration, provide repository-specific configurations and provide global configurations that will be applied across all repositories:
112+
113+
```yaml
114+
configuration:
115+
repositoryMaintenanceJob:
116+
repositoryConfigData:
117+
name: "my-repo-maintenance-config" # Optional, defaults to "velero-repo-maintenance"
118+
global:
119+
podResources:
120+
cpuRequest: "100m"
121+
cpuLimit: "200m"
122+
memoryRequest: "100Mi"
123+
memoryLimit: "200Mi"
124+
keepLatestMaintenanceJobs: 1
125+
```
126+
127+
### Per-Repository Configuration
128+
129+
You can configure specific settings for individual repositories using repository keys. Repository keys are formed as: `{namespace}-{storageLocation}-{repositoryType}`.
130+
131+
For example, if you have a BackupRepository for namespace `prod` using storage location `s3-backup` with repository type `kopia`, the key would be `prod-s3-backup-kopia`.
132+
133+
```yaml
134+
configuration:
135+
repositoryMaintenanceJob:
136+
repositoryConfigData:
137+
global:
138+
podResources:
139+
cpuRequest: "100m"
140+
cpuLimit: "200m"
141+
memoryRequest: "100Mi"
142+
memoryLimit: "200Mi"
143+
repositories:
144+
"prod-s3-backup-kopia":
145+
podResources:
146+
cpuRequest: "500m"
147+
cpuLimit: "1000m"
148+
memoryRequest: "512Mi"
149+
memoryLimit: "1024Mi"
150+
loadAffinity:
151+
- nodeSelector:
152+
matchLabels:
153+
dedicated: "backup"
154+
```
155+
156+
### Node Affinity and Priority Class
157+
158+
You can specify node affinity and priority class for maintenance jobs:
159+
160+
```yaml
161+
configuration:
162+
repositoryMaintenanceJob:
163+
repositoryConfigData:
164+
global:
165+
podResources:
166+
cpuRequest: "100m"
167+
cpuLimit: "200m"
168+
memoryRequest: "100Mi"
169+
memoryLimit: "200Mi"
170+
loadAffinity:
171+
- nodeSelector:
172+
matchExpressions:
173+
- key: "cloud.google.com/machine-family"
174+
operator: "In"
175+
values: ["e2"]
176+
- nodeSelector:
177+
matchExpressions:
178+
- key: "topology.kubernetes.io/zone"
179+
operator: "In"
180+
values: ["us-central1-a", "us-central1-b", "us-central1-c"]
181+
priorityClassName: "low-priority"
182+
```
183+
184+
**Note**: `priorityClassName` is only supported in the global configuration section and applies to all maintenance jobs.
185+
186+
### Backward Compatibility
187+
188+
When `repositoryConfigData.global` and `repositoryConfigData.repositories` are not provided (default), the chart continues to use the legacy global settings:
189+
190+
```yaml
191+
configuration:
192+
repositoryMaintenanceJob:
193+
requests:
194+
cpu: 500m
195+
memory: 512Mi
196+
limits:
197+
cpu: 1000m
198+
memory: 1024Mi
199+
latestJobsCount: 3
200+
```
201+
202+
Note: The legacy parameters (`--maintenance-job-cpu-request`, `--maintenance-job-mem-request`, `--maintenance-job-cpu-limit`, `--maintenance-job-mem-limit`) are deprecated in Velero v1.15 and will be removed in v1.17.
203+
204+
For more information, see the [Velero Repository Maintenance documentation](https://velero.io/docs/main/repository-maintenance/).
205+
105206
## Upgrading Velero
106207

107208
### Upgrading to v1.16

charts/velero/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ spec:
180180
- --namespace={{ . }}
181181
{{- end }}
182182
{{- with .repositoryMaintenanceJob }}
183+
{{- if and .repositoryConfigData (or .repositoryConfigData.global .repositoryConfigData.repositories) }}
184+
- --repo-maintenance-job-configmap={{ default "velero-repo-maintenance" .repositoryConfigData.name }}
185+
{{- else }}
183186
{{- with .requests }}
184187
{{- with .cpu }}
185188
- --maintenance-job-cpu-request={{ . }}
@@ -200,6 +203,7 @@ spec:
200203
- --keep-latest-maintenance-jobs={{ . }}
201204
{{- end }}
202205
{{- end }}
206+
{{- end }}
203207
{{- with .extraArgs }}
204208
### User-supplied overwrite flags
205209
{{- toYaml . | nindent 12 }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if and .Values.configuration .Values.configuration.repositoryMaintenanceJob .Values.configuration.repositoryMaintenanceJob.repositoryConfigData (or .Values.configuration.repositoryMaintenanceJob.repositoryConfigData.global .Values.configuration.repositoryMaintenanceJob.repositoryConfigData.repositories) }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ default "velero-repo-maintenance" .Values.configuration.repositoryMaintenanceJob.repositoryConfigData.name }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
app.kubernetes.io/name: {{ include "velero.name" . }}
9+
app.kubernetes.io/instance: {{ .Release.Name }}
10+
app.kubernetes.io/managed-by: {{ .Release.Service }}
11+
helm.sh/chart: {{ include "velero.chart" . }}
12+
data:
13+
{{- with .Values.configuration.repositoryMaintenanceJob.repositoryConfigData.global }}
14+
global: |
15+
{{- . | toPrettyJson | nindent 4 }}
16+
{{- end }}
17+
{{- range $repoKey, $repoConfig := .Values.configuration.repositoryMaintenanceJob.repositoryConfigData.repositories }}
18+
{{ $repoKey }}: |
19+
{{- $repoConfig | toPrettyJson | nindent 4 }}
20+
{{- end }}
21+
{{- end }}

charts/velero/values.schema.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,80 @@
470470
},
471471
"latestJobsCount": {
472472
"type": "number"
473+
},
474+
"repositoryConfigData": {
475+
"type": "object",
476+
"properties": {
477+
"name": {
478+
"type": "string",
479+
"description": "Name of the ConfigMap to create for per-repository maintenance configuration"
480+
},
481+
"global": {
482+
"type": "object",
483+
"description": "Global configuration applied to all repositories when no specific repository configuration is found",
484+
"properties": {
485+
"podResources": {
486+
"type": "object",
487+
"properties": {
488+
"cpuRequest": {"type": "string"},
489+
"cpuLimit": {"type": "string"},
490+
"memoryRequest": {"type": "string"},
491+
"memoryLimit": {"type": "string"}
492+
}
493+
},
494+
"keepLatestMaintenanceJobs": {
495+
"type": "number"
496+
},
497+
"priorityClassName": {
498+
"type": "string"
499+
},
500+
"loadAffinity": {
501+
"type": "array",
502+
"items": {
503+
"type": "object",
504+
"properties": {
505+
"nodeSelector": {
506+
"type": "object"
507+
}
508+
}
509+
}
510+
}
511+
}
512+
},
513+
"repositories": {
514+
"type": "object",
515+
"description": "Repository-specific configurations keyed by repository identifier (namespace-storageLocation-repositoryType)",
516+
"additionalProperties": {
517+
"type": "object",
518+
"properties": {
519+
"podResources": {
520+
"type": "object",
521+
"properties": {
522+
"cpuRequest": {"type": "string"},
523+
"cpuLimit": {"type": "string"},
524+
"memoryRequest": {"type": "string"},
525+
"memoryLimit": {"type": "string"}
526+
}
527+
},
528+
"keepLatestMaintenanceJobs": {
529+
"type": "number"
530+
},
531+
"loadAffinity": {
532+
"type": "array",
533+
"items": {
534+
"type": "object",
535+
"properties": {
536+
"nodeSelector": {
537+
"type": "object"
538+
}
539+
}
540+
}
541+
}
542+
}
543+
}
544+
}
545+
},
546+
"required": []
473547
}
474548
},
475549
"required": []

charts/velero/values.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,47 @@ configuration:
512512
# memory: 1024Mi
513513
# Number of latest maintenance jobs to keep for each repository
514514
latestJobsCount: 3
515+
# Per-repository resource settings ConfigMap
516+
# This ConfigMap allows specifying different settings for different repositories
517+
# See: https://velero.io/docs/main/repository-maintenance/
518+
repositoryConfigData:
519+
# Name of the ConfigMap to create. If not provided, will use "velero-repo-maintenance"
520+
name: "velero-repo-maintenance"
521+
# Global configuration applied to all repositories
522+
# This configuration is used when no specific repository configuration is found
523+
# global:
524+
# podResources:
525+
# cpuRequest: "100m"
526+
# cpuLimit: "200m"
527+
# memoryRequest: "100Mi"
528+
# memoryLimit: "200Mi"
529+
# keepLatestMaintenanceJobs: 1
530+
# loadAffinity:
531+
# - nodeSelector:
532+
# matchExpressions:
533+
# - key: "cloud.google.com/machine-family"
534+
# operator: "In"
535+
# values: ["e2"]
536+
# - nodeSelector:
537+
# matchExpressions:
538+
# - key: "topology.kubernetes.io/zone"
539+
# operator: "In"
540+
# values: ["us-central1-a", "us-central1-b", "us-central1-c"]
541+
# priorityClassName: "low-priority" # Note: priorityClassName is only supported in global configuration
542+
global: {}
543+
# Repository-specific configurations
544+
# Repository keys are formed as: "{namespace}-{storageLocation}-{repositoryType}"
545+
# For example: "default-default-kopia" or "prod-s3-backup-kopia"
546+
# Note: priorityClassName is NOT supported in repository-specific configurations
547+
# repositories:
548+
# "kibishii-default-kopia":
549+
# podResources:
550+
# cpuRequest: "200m"
551+
# cpuLimit: "400m"
552+
# memoryRequest: "200Mi"
553+
# memoryLimit: "400Mi"
554+
# keepLatestMaintenanceJobs: 2
555+
repositories: {}
515556
# `velero server` default: velero
516557
namespace:
517558
# additional command-line arguments that will be passed to the `velero server`

0 commit comments

Comments
 (0)