mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-20 22:26:07 +00:00
Perf improvements for existing resource restore
Use informer cache with dynamic client for Get calls on restore When enabled, also make the Get call before create. Add server and install parameter to allow disabling this feature, but enable by default Signed-off-by: Scott Seago <sseago@redhat.com>
This commit is contained in:
@@ -48,6 +48,7 @@ type podTemplateConfig struct {
|
||||
uploaderType string
|
||||
defaultSnapshotMoveData bool
|
||||
privilegedNodeAgent bool
|
||||
disableInformerCache bool
|
||||
}
|
||||
|
||||
func WithImage(image string) podTemplateOption {
|
||||
@@ -144,6 +145,12 @@ func WithDefaultSnapshotMoveData() podTemplateOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithDisableInformerCache() podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.disableInformerCache = true
|
||||
}
|
||||
}
|
||||
|
||||
func WithServiceAccountName(sa string) podTemplateOption {
|
||||
return func(c *podTemplateConfig) {
|
||||
c.serviceAccountName = sa
|
||||
@@ -185,6 +192,10 @@ func Deployment(namespace string, opts ...podTemplateOption) *appsv1.Deployment
|
||||
args = append(args, "--default-snapshot-move-data=true")
|
||||
}
|
||||
|
||||
if c.disableInformerCache {
|
||||
args = append(args, "--disable-informer-cache=true")
|
||||
}
|
||||
|
||||
if len(c.uploaderType) > 0 {
|
||||
args = append(args, fmt.Sprintf("--uploader-type=%s", c.uploaderType))
|
||||
}
|
||||
|
||||
@@ -64,4 +64,8 @@ func TestDeployment(t *testing.T) {
|
||||
|
||||
deploy = Deployment("velero", WithServiceAccountName("test-sa"))
|
||||
assert.Equal(t, "test-sa", deploy.Spec.Template.Spec.ServiceAccountName)
|
||||
|
||||
deploy = Deployment("velero", WithDisableInformerCache())
|
||||
assert.Len(t, deploy.Spec.Template.Spec.Containers[0].Args, 2)
|
||||
assert.Equal(t, "--disable-informer-cache=true", deploy.Spec.Template.Spec.Containers[0].Args[1])
|
||||
}
|
||||
|
||||
@@ -253,6 +253,7 @@ type VeleroOptions struct {
|
||||
DefaultVolumesToFsBackup bool
|
||||
UploaderType string
|
||||
DefaultSnapshotMoveData bool
|
||||
DisableInformerCache bool
|
||||
}
|
||||
|
||||
func AllCRDs() *unstructured.UnstructuredList {
|
||||
@@ -357,6 +358,10 @@ func AllResources(o *VeleroOptions) *unstructured.UnstructuredList {
|
||||
deployOpts = append(deployOpts, WithDefaultSnapshotMoveData())
|
||||
}
|
||||
|
||||
if o.DisableInformerCache {
|
||||
deployOpts = append(deployOpts, WithDisableInformerCache())
|
||||
}
|
||||
|
||||
deploy := Deployment(o.Namespace, deployOpts...)
|
||||
|
||||
if err := appendUnstructured(resources, deploy); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user