add velero install flags for configuring restic resource requirements (#1710)
* add velero install flags for configuring restic resource requirements Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>pull/1721/head
parent
b24a603711
commit
2a6929d453
|
@ -0,0 +1 @@
|
|||
Adds configurable CPU/memory requests and limits to the restic DaemonSet generated by velero install.
|
|
@ -49,6 +49,10 @@ type InstallOptions struct {
|
|||
VeleroPodMemRequest string
|
||||
VeleroPodCPULimit string
|
||||
VeleroPodMemLimit string
|
||||
ResticPodCPURequest string
|
||||
ResticPodMemRequest string
|
||||
ResticPodCPULimit string
|
||||
ResticPodMemLimit string
|
||||
RestoreOnly bool
|
||||
SecretFile string
|
||||
DryRun bool
|
||||
|
@ -66,12 +70,16 @@ func (o *InstallOptions) BindFlags(flags *pflag.FlagSet) {
|
|||
flags.StringVar(&o.SecretFile, "secret-file", o.SecretFile, "file containing credentials for backup and volume provider")
|
||||
flags.StringVar(&o.Image, "image", o.Image, "image to use for the Velero and restic server pods. Optional.")
|
||||
flags.StringVar(&o.Prefix, "prefix", o.Prefix, "prefix under which all Velero data should be stored within the bucket. Optional.")
|
||||
flags.Var(&o.PodAnnotations, "pod-annotations", "annotations to add to the Velero and Restic pods. Optional. Format is key1=value1,key2=value2")
|
||||
flags.Var(&o.PodAnnotations, "pod-annotations", "annotations to add to the Velero and restic pods. Optional. Format is key1=value1,key2=value2")
|
||||
flags.StringVar(&o.Namespace, "namespace", o.Namespace, "namespace to install Velero and associated data into. Optional.")
|
||||
flags.StringVar(&o.VeleroPodCPURequest, "velero-pod-cpu-request", o.VeleroPodCPURequest, "CPU request for Velero pod. Optional.")
|
||||
flags.StringVar(&o.VeleroPodMemRequest, "velero-pod-mem-request", o.VeleroPodMemRequest, "memory request for Velero pod. Optional.")
|
||||
flags.StringVar(&o.VeleroPodCPULimit, "velero-pod-cpu-limit", o.VeleroPodCPULimit, "CPU limit for Velero pod. Optional.")
|
||||
flags.StringVar(&o.VeleroPodMemLimit, "velero-pod-mem-limit", o.VeleroPodMemLimit, "memory limit for Velero pod. Optional.")
|
||||
flags.StringVar(&o.ResticPodCPURequest, "restic-pod-cpu-request", o.ResticPodCPURequest, "CPU request for restic pods. Optional.")
|
||||
flags.StringVar(&o.ResticPodMemRequest, "restic-pod-mem-request", o.ResticPodMemRequest, "memory request for restic pods. Optional.")
|
||||
flags.StringVar(&o.ResticPodCPULimit, "restic-pod-cpu-limit", o.ResticPodCPULimit, "CPU limit for restic pods. Optional.")
|
||||
flags.StringVar(&o.ResticPodMemLimit, "restic-pod-mem-limit", o.ResticPodMemLimit, "memory limit for restic pods. Optional.")
|
||||
flags.Var(&o.BackupStorageConfig, "backup-location-config", "configuration to use for the backup storage location. Format is key1=value1,key2=value2")
|
||||
flags.Var(&o.VolumeSnapshotConfig, "snapshot-location-config", "configuration to use for the volume snapshot location. Format is key1=value1,key2=value2")
|
||||
flags.BoolVar(&o.UseVolumeSnapshots, "use-volume-snapshots", o.UseVolumeSnapshots, "whether or not to create snapshot location automatically. Set to false if you do not plan to create volume snapshots via a storage provider.")
|
||||
|
@ -93,6 +101,10 @@ func NewInstallOptions() *InstallOptions {
|
|||
VeleroPodMemRequest: install.DefaultVeleroPodMemRequest,
|
||||
VeleroPodCPULimit: install.DefaultVeleroPodCPULimit,
|
||||
VeleroPodMemLimit: install.DefaultVeleroPodMemLimit,
|
||||
ResticPodCPURequest: install.DefaultResticPodCPURequest,
|
||||
ResticPodMemRequest: install.DefaultResticPodMemRequest,
|
||||
ResticPodCPULimit: install.DefaultResticPodCPULimit,
|
||||
ResticPodMemLimit: install.DefaultResticPodMemLimit,
|
||||
// Default to creating a VSL unless we're told otherwise
|
||||
UseVolumeSnapshots: true,
|
||||
}
|
||||
|
@ -112,6 +124,10 @@ func (o *InstallOptions) AsVeleroOptions() (*install.VeleroOptions, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resticPodResources, err := parseResourceRequests(o.ResticPodCPURequest, o.ResticPodMemRequest, o.ResticPodCPULimit, o.ResticPodMemLimit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &install.VeleroOptions{
|
||||
Namespace: o.Namespace,
|
||||
|
@ -121,6 +137,7 @@ func (o *InstallOptions) AsVeleroOptions() (*install.VeleroOptions, error) {
|
|||
Prefix: o.Prefix,
|
||||
PodAnnotations: o.PodAnnotations.Data(),
|
||||
VeleroPodResources: veleroPodResources,
|
||||
ResticPodResources: resticPodResources,
|
||||
SecretData: secretData,
|
||||
RestoreOnly: o.RestoreOnly,
|
||||
UseRestic: o.UseRestic,
|
||||
|
@ -166,6 +183,8 @@ This is useful as a starting point for more customized installations.
|
|||
|
||||
# velero install --bucket gcp-backups --provider gcp --secret-file ./gcp-creds.json --velero-pod-cpu-request=1000m --velero-pod-cpu-limit=5000m --velero-pod-mem-request=512Mi --velero-pod-mem-limit=1024Mi
|
||||
|
||||
# velero install --bucket gcp-backups --provider gcp --secret-file ./gcp-creds.json --restic-pod-cpu-request=1000m --restic-pod-cpu-limit=5000m --restic-pod-mem-request=512Mi --restic-pod-mem-limit=1024Mi
|
||||
|
||||
`,
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
cmd.CheckError(o.Validate(c, args, f))
|
||||
|
|
|
@ -142,6 +142,7 @@ func DaemonSet(namespace string, opts ...podTemplateOption) *appsv1.DaemonSet {
|
|||
Value: "/credentials/cloud",
|
||||
},
|
||||
},
|
||||
Resources: c.resources,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -43,6 +43,10 @@ var (
|
|||
DefaultVeleroPodMemRequest = "128Mi"
|
||||
DefaultVeleroPodCPULimit = "1000m"
|
||||
DefaultVeleroPodMemLimit = "256Mi"
|
||||
DefaultResticPodCPURequest = "0"
|
||||
DefaultResticPodMemRequest = "0"
|
||||
DefaultResticPodCPULimit = "0"
|
||||
DefaultResticPodMemLimit = "0"
|
||||
)
|
||||
|
||||
func labels() map[string]string {
|
||||
|
@ -196,6 +200,7 @@ type VeleroOptions struct {
|
|||
Prefix string
|
||||
PodAnnotations map[string]string
|
||||
VeleroPodResources corev1.ResourceRequirements
|
||||
ResticPodResources corev1.ResourceRequirements
|
||||
SecretData []byte
|
||||
RestoreOnly bool
|
||||
UseRestic bool
|
||||
|
@ -254,6 +259,7 @@ func AllResources(o *VeleroOptions) (*unstructured.UnstructuredList, error) {
|
|||
ds := DaemonSet(o.Namespace,
|
||||
WithAnnotations(o.PodAnnotations),
|
||||
WithImage(o.Image),
|
||||
WithResources(o.ResticPodResources),
|
||||
)
|
||||
appendUnstructured(resources, ds)
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ Additionally, you can specify `--use-restic` to enable restic support, and `--wa
|
|||
|
||||
(Optional) Specify [additional configurable parameters][6] for the `--snapshot-location-config` flag.
|
||||
|
||||
(Optional) Specify [CPU and memory resource requests and limits][22] for the Velero pod.
|
||||
(Optional) Specify [CPU and memory resource requests and limits][22] for the Velero/restic pods.
|
||||
|
||||
For more complex installation needs, use either the Helm chart, or add `--dry-run -o yaml` options for generating the YAML representation for the installation.
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ Additionally, you can specify `--use-restic` to enable restic support, and `--wa
|
|||
|
||||
(Optional) Specify [additional configurable parameters][8] for the `--snapshot-location-config` flag.
|
||||
|
||||
(Optional) Specify [CPU and memory resource requests and limits][23] for the Velero pod.
|
||||
(Optional) Specify [CPU and memory resource requests and limits][23] for the Velero/restic pods.
|
||||
|
||||
For more complex installation needs, use either the Helm chart, or add `--dry-run -o yaml` options for generating the YAML representation for the installation.
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ Additionally, you can specify `--use-restic` to enable restic support, and `--wa
|
|||
|
||||
(Optional) Specify [additional configurable parameters][8] for the `--snapshot-location-config` flag.
|
||||
|
||||
(Optional) Specify [CPU and memory resource requests and limits][23] for the Velero pod.
|
||||
(Optional) Specify [CPU and memory resource requests and limits][23] for the Velero/restic pods.
|
||||
|
||||
For more complex installation needs, use either the Helm chart, or add `--dry-run -o yaml` options for generating the YAML representation for the installation.
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ Velero does not currently have a volume snapshot plugin for IBM Cloud, so creati
|
|||
|
||||
Additionally, you can specify `--use-restic` to enable restic support, and `--wait` to wait for the deployment to be ready.
|
||||
|
||||
(Optional) Specify [CPU and memory resource requests and limits][15] for the Velero pod.
|
||||
(Optional) Specify [CPU and memory resource requests and limits][15] for the Velero/restic pods.
|
||||
|
||||
Once the installation is complete, remove the default `VolumeSnapshotLocation` that was created by `velero install`, since it's specific to AWS and won't work for IBM Cloud:
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ For details, see the documentation topics for individual cloud providers.
|
|||
## Velero resource requirements
|
||||
|
||||
By default, the Velero deployment requests 500m CPU, 128Mi memory and sets a limit of 1000m CPU, 256Mi.
|
||||
Default requests and limits are not set for the restic pods as CPU/Memory usage can depend heavily on the size of volumes being backed up.
|
||||
If you need to customize these resource requests and limits, you can set the following flags in your `velero install` command:
|
||||
|
||||
```
|
||||
|
@ -69,8 +70,14 @@ velero install \
|
|||
--velero-pod-mem-request <MEMORY_REQUEST> \
|
||||
--velero-pod-cpu-limit <CPU_LIMIT> \
|
||||
--velero-pod-mem-limit <MEMORY_LIMIT> \
|
||||
[--use-restic] \
|
||||
[--restic-pod-cpu-request <CPU_REQUEST>] \
|
||||
[--restic-pod-mem-request <MEMORY_REQUEST>] \
|
||||
[--restic-pod-cpu-limit <CPU_LIMIT>] \
|
||||
[--restic-pod-mem-limit <MEMORY_LIMIT>]
|
||||
```
|
||||
|
||||
|
||||
Values for these flags follow the same format as [Kubernetes resource requirements][103].
|
||||
|
||||
## Removing Velero
|
||||
|
|
Loading…
Reference in New Issue