From 0b9756c02785364fcfc3d289739db1770ef14e91 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 22 May 2024 11:22:43 -0300 Subject: [PATCH 1/7] fix: Default value of qps and burst Signed-off-by: Mateus Oliveira --- Makefile | 2 +- api/v1alpha1/oadp_types.go | 6 + api/v1alpha1/zz_generated.deepcopy.go | 10 ++ ...enshift.io_dataprotectionapplications.yaml | 6 + ...enshift.io_dataprotectionapplications.yaml | 6 + controllers/velero.go | 19 +++ controllers/velero_test.go | 134 ++++++++++++++++++ 7 files changed, 182 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 79f416ad33..e08920e3ae 100644 --- a/Makefile +++ b/Makefile @@ -107,7 +107,7 @@ BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) # Image URL to use all building/pushing image targets IMG ?= quay.io/konveyor/oadp-operator:latest -CRD_OPTIONS ?= "crd" +CRD_OPTIONS ?= "crd:allowDangerousTypes=true" # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) diff --git a/api/v1alpha1/oadp_types.go b/api/v1alpha1/oadp_types.go index c5015d1182..cca48cd5a4 100644 --- a/api/v1alpha1/oadp_types.go +++ b/api/v1alpha1/oadp_types.go @@ -109,6 +109,12 @@ type VeleroConfig struct { // Default is 10m // +optional ResourceTimeout string `json:"resourceTimeout,omitempty"` + // Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 30) + // +optional + ClientBurst *int `json:"client-burst,omitempty"` + // Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 20) + // +optional + ClientQPS *float32 `json:"client-qps,omitempty"` // Velero args are settings to customize velero server arguments. Overrides values in other fields. // +optional Args *server.Args `json:"args,omitempty"` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index d7bce3d2f2..7de6256c38 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -663,6 +663,16 @@ func (in *VeleroConfig) DeepCopyInto(out *VeleroConfig) { *out = new(bool) **out = **in } + if in.ClientBurst != nil { + in, out := &in.ClientBurst, &out.ClientBurst + *out = new(int) + **out = **in + } + if in.ClientQPS != nil { + in, out := &in.ClientQPS, &out.ClientQPS + *out = new(float32) + **out = **in + } if in.Args != nil { in, out := &in.Args, &out.Args *out = new(server.Args) diff --git a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml index c955481608..e5df178474 100644 --- a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml +++ b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml @@ -798,6 +798,12 @@ spec: description: comma-separated list of pattern=N settings for file-filtered logging type: string type: object + client-burst: + description: Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 30) + type: integer + client-qps: + description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 20) + type: number customPlugins: description: customPlugins defines the custom plugin to be installed with Velero items: diff --git a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml index 6eb9918bd2..7ca2062ace 100644 --- a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml +++ b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml @@ -798,6 +798,12 @@ spec: description: comma-separated list of pattern=N settings for file-filtered logging type: string type: object + client-burst: + description: Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 30) + type: integer + client-qps: + description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 20) + type: number customPlugins: description: customPlugins defines the custom plugin to be installed with Velero items: diff --git a/controllers/velero.go b/controllers/velero.go index 363d6c74f5..bc34e73e3e 100644 --- a/controllers/velero.go +++ b/controllers/velero.go @@ -556,6 +556,9 @@ func (r *DPAReconciler) customizeVeleroContainer(dpa *oadpv1alpha1.DataProtectio veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--fs-backup-timeout=%s", getFsBackupTimeout(dpa))) // Overriding velero restore resource priorities to OpenShift default (ie. SecurityContextConstraints needs to be restored before pod/SA) veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--restore-resource-priorities=%s", common.DefaultRestoreResourcePriorities.String())) + + veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--client-burst=%v", getClientBurst(dpa))) + veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--client-qps=%v", getClientQPS(dpa))) setContainerDefaults(veleroContainer) // if server args is set, override the default server args if dpa.Spec.Configuration.Velero.Args != nil { @@ -570,6 +573,22 @@ func (r *DPAReconciler) customizeVeleroContainer(dpa *oadpv1alpha1.DataProtectio return nil } +func getClientBurst(dpa *oadpv1alpha1.DataProtectionApplication) int { + if dpa.Spec.Configuration.Velero != nil && dpa.Spec.Configuration.Velero.ClientBurst != nil { + return *dpa.Spec.Configuration.Velero.ClientBurst + } + // Velero default until 1.13 + return 30 +} + +func getClientQPS(dpa *oadpv1alpha1.DataProtectionApplication) float32 { + if dpa.Spec.Configuration.Velero != nil && dpa.Spec.Configuration.Velero.ClientQPS != nil { + return *dpa.Spec.Configuration.Velero.ClientQPS + } + // Velero default until 1.13 + return 20.0 +} + func getFsBackupTimeout(dpa *oadpv1alpha1.DataProtectionApplication) string { if dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 { return dpa.Spec.Configuration.Restic.Timeout diff --git a/controllers/velero_test.go b/controllers/velero_test.go index ff47049744..1d4a012a90 100644 --- a/controllers/velero_test.go +++ b/controllers/velero_test.go @@ -40,6 +40,8 @@ const ( defaultFileSystemBackupTimeout = "--fs-backup-timeout=4h" defaultRestoreResourcePriorities = "--restore-resource-priorities=securitycontextconstraints,customresourcedefinitions,klusterletconfigs.config.open-cluster-management.io,managedcluster.cluster.open-cluster-management.io,namespaces,roles,rolebindings,clusterrolebindings,klusterletaddonconfig.agent.open-cluster-management.io,managedclusteraddon.addon.open-cluster-management.io,storageclasses,volumesnapshotclass.snapshot.storage.k8s.io,volumesnapshotcontents.snapshot.storage.k8s.io,volumesnapshots.snapshot.storage.k8s.io,datauploads.velero.io,persistentvolumes,persistentvolumeclaims,serviceaccounts,secrets,configmaps,limitranges,pods,replicasets.apps,clusterclasses.cluster.x-k8s.io,endpoints,services,-,clusterbootstraps.run.tanzu.vmware.com,clusters.cluster.x-k8s.io,clusterresourcesets.addons.cluster.x-k8s.io" defaultDisableInformerCache = "--disable-informer-cache=false" + defaultClientBurst = "--client-burst=30" + defaultClientQPS = "--client-qps=20" ) var ( @@ -377,6 +379,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -449,6 +453,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -535,6 +541,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "--features=EnableCSI", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: append(baseVolumeMounts, []corev1.VolumeMount{ @@ -641,6 +649,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -734,6 +744,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -1179,6 +1191,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -1358,6 +1372,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -1539,6 +1555,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -1720,6 +1738,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -1901,6 +1921,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2083,6 +2105,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2265,6 +2289,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2446,6 +2472,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2628,6 +2656,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2809,6 +2839,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2934,6 +2966,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), defaultDisableInformerCache, @@ -3057,6 +3091,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--resource-timeout=5m", @@ -3232,6 +3268,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3318,6 +3356,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3401,6 +3441,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3484,6 +3526,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3570,6 +3614,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3688,6 +3734,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3796,6 +3844,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3866,6 +3916,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: append(baseVolumeMounts, []corev1.VolumeMount{ @@ -3950,6 +4002,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: []corev1.VolumeMount{ @@ -4047,6 +4101,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: []corev1.VolumeMount{ @@ -4166,6 +4222,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: []corev1.VolumeMount{ @@ -4270,6 +4328,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, + defaultClientBurst, + defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: []corev1.VolumeMount{ @@ -4559,6 +4619,80 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, }, }, + { + name: "Override burst and qps", + veleroDeployment: &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-velero-deployment", + Namespace: "test-ns", + }, + Spec: appsv1.DeploymentSpec{ + Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, + }, + }, + dpa: &oadpv1alpha1.DataProtectionApplication{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-Velero-CR", + Namespace: "test-ns", + }, + Spec: oadpv1alpha1.DataProtectionApplicationSpec{ + Configuration: &oadpv1alpha1.ApplicationConfig{ + Velero: &oadpv1alpha1.VeleroConfig{ + ClientBurst: pointer.Int(123), + ClientQPS: pointer.Float32(123), + }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + UploaderType: "kopia", + }, + }, + }, + }, + wantVeleroDeployment: &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-velero-deployment", + Namespace: "test-ns", + Labels: veleroDeploymentLabel, + }, + TypeMeta: metav1.TypeMeta{ + Kind: "Deployment", + APIVersion: appsv1.SchemeGroupVersion.String(), + }, + Spec: appsv1.DeploymentSpec{ + Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, + Replicas: pointer.Int32(1), + Template: corev1.PodTemplateSpec{ + ObjectMeta: veleroPodObjectMeta, + Spec: corev1.PodSpec{ + RestartPolicy: corev1.RestartPolicyAlways, + ServiceAccountName: common.Velero, + Containers: []corev1.Container{ + { + Name: common.Velero, + Image: common.VeleroImage, + ImagePullPolicy: corev1.PullAlways, + Ports: []corev1.ContainerPort{{Name: "metrics", ContainerPort: 8085}}, + Resources: corev1.ResourceRequirements{Requests: corev1.ResourceList{corev1.ResourceCPU: resource.MustParse("500m"), corev1.ResourceMemory: resource.MustParse("128Mi")}}, + Command: []string{"/velero"}, + Args: []string{ + "server", + "--uploader-type=kopia", + defaultFileSystemBackupTimeout, + defaultRestoreResourcePriorities, + "--client-burst=123", + "--client-qps=123", + defaultDisableInformerCache, + }, + VolumeMounts: baseVolumeMounts, + Env: baseEnvVars, + }, + }, + Volumes: baseVolumes, + InitContainers: []corev1.Container{}, + }, + }, + }, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { From 43d1b567dfe3a2a004f4843c6e5f5fbb4a796ad1 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 22 May 2024 15:48:31 -0300 Subject: [PATCH 2/7] fixup! fix: Default value of qps and burst Signed-off-by: Mateus Oliveira --- controllers/velero_test.go | 81 ++++++++++++++++++++++++++++++++++++++ debug.md | 19 +++++++++ 2 files changed, 100 insertions(+) create mode 100644 debug.md diff --git a/controllers/velero_test.go b/controllers/velero_test.go index 1d4a012a90..895ef15eb4 100644 --- a/controllers/velero_test.go +++ b/controllers/velero_test.go @@ -4693,6 +4693,87 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, }, }, + { + name: "Conflicting burst and qps", + veleroDeployment: &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-velero-deployment", + Namespace: "test-ns", + }, + Spec: appsv1.DeploymentSpec{ + Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, + }, + }, + dpa: &oadpv1alpha1.DataProtectionApplication{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-Velero-CR", + Namespace: "test-ns", + }, + Spec: oadpv1alpha1.DataProtectionApplicationSpec{ + Configuration: &oadpv1alpha1.ApplicationConfig{ + Velero: &oadpv1alpha1.VeleroConfig{ + ClientBurst: pointer.Int(123), + ClientQPS: pointer.Float32(123), + Args: &server.Args{ + ServerConfig: server.ServerConfig{ + ClientBurst: pointer.Int(321), + ClientQPS: pointer.String("321"), + }, + }, + }, + NodeAgent: &oadpv1alpha1.NodeAgentConfig{ + UploaderType: "kopia", + }, + }, + }, + }, + wantVeleroDeployment: &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-velero-deployment", + Namespace: "test-ns", + Labels: veleroDeploymentLabel, + }, + TypeMeta: metav1.TypeMeta{ + Kind: "Deployment", + APIVersion: appsv1.SchemeGroupVersion.String(), + }, + Spec: appsv1.DeploymentSpec{ + Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, + Replicas: pointer.Int32(1), + Template: corev1.PodTemplateSpec{ + ObjectMeta: veleroPodObjectMeta, + Spec: corev1.PodSpec{ + RestartPolicy: corev1.RestartPolicyAlways, + ServiceAccountName: common.Velero, + Containers: []corev1.Container{ + { + Name: common.Velero, + Image: common.VeleroImage, + ImagePullPolicy: corev1.PullAlways, + Ports: []corev1.ContainerPort{{Name: "metrics", ContainerPort: 8085}}, + Resources: corev1.ResourceRequirements{Requests: corev1.ResourceList{corev1.ResourceCPU: resource.MustParse("500m"), corev1.ResourceMemory: resource.MustParse("128Mi")}}, + Command: []string{"/velero"}, + Args: []string{ + "server", + // should be present... "--uploader-type=kopia", + "--client-burst=321", + "--client-qps=321", + "--fs-backup-timeout=4h0m0s", + defaultRestoreResourcePriorities, + defaultDisableInformerCache, + }, + VolumeMounts: baseVolumeMounts, + Env: baseEnvVars, + }, + }, + Volumes: baseVolumes, + InitContainers: []corev1.Container{}, + }, + }, + }, + }, + wantErr: true, // TODO should error to avoid user confusion? + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/debug.md b/debug.md new file mode 100644 index 0000000000..432a9d1438 --- /dev/null +++ b/debug.md @@ -0,0 +1,19 @@ +registry.redhat.io/oadp/oadp-velero-rhel9@sha256:40810b794f6e67983466a687d1f320301e85dfb476671742ec89874dfa4e9117 +registry.redhat.io/oadp/oadp-velero-restic-restore-helper-rhel9@sha256:2a2c3fa07eedb1b2568b17f8d202a5322189626608041652ce32b6a5cd90e4c6 +registry.redhat.io/oadp/oadp-velero-plugin-rhel9@sha256:36f396227846d8b849f364beddf65524c9817f7c9f7e9713db8d4b4e2729cde2 +registry.redhat.io/oadp/oadp-velero-plugin-for-aws-rhel9@sha256:8fa90687d6c3a6147858f6df87a63c3edd77531fff12091eb04df86a4f6811d4 +registry.redhat.io/oadp/oadp-velero-plugin-for-microsoft-azure-rhel9@sha256:6f56f6730b77e65dda90f4ff9b3446850a68670b55d47300cf50cab818c2d967 +registry.redhat.io/oadp/oadp-velero-plugin-for-gcp-rhel9@sha256:985dfe920ab0def40f4d4c6baa3bbb845921617a0f73cf82e8a425039fdefce5 +registry.redhat.io/oadp/oadp-velero-plugin-for-csi-rhel9@sha256:c8979074fe11a5d1d0f5ecb0328fabb752f01103a9c03cf34e8df06bcad27f29 +registry.redhat.io/oadp/oadp-kubevirt-velero-plugin-rhel9@sha256:476fbe152797d15731a77e710b3c666317fbe9aeb998966309a021e2f1b5402f +registry.redhat.io/oadp/oadp-mustgather-rhel9@sha256:dbe4baaac15515f9c7547b77b3c2d8f3994169442a42381bcd3b0210fb53a7bf +quay.io/konveyor/velero:latest +quay.io/konveyor/velero-restore-helper:latest +quay.io/konveyor/openshift-velero-plugin:latest +quay.io/konveyor/velero-plugin-for-aws:latest +quay.io/konveyor/velero-plugin-for-microsoft-azure:latest +quay.io/konveyor/velero-plugin-for-gcp:latest +quay.io/konveyor/velero-plugin-for-csi:latest +quay.io/konveyor/kubevirt-velero-plugin:v0.2.0 +registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.2 +quay.io/konveyor/oadp-non-admin:latest \ No newline at end of file From 61f26cacb158571989ce5b2f3ab9287be1787497 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 22 May 2024 15:50:21 -0300 Subject: [PATCH 3/7] fixup! fix: Default value of qps and burst Signed-off-by: Mateus Oliveira --- debug.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 debug.md diff --git a/debug.md b/debug.md deleted file mode 100644 index 432a9d1438..0000000000 --- a/debug.md +++ /dev/null @@ -1,19 +0,0 @@ -registry.redhat.io/oadp/oadp-velero-rhel9@sha256:40810b794f6e67983466a687d1f320301e85dfb476671742ec89874dfa4e9117 -registry.redhat.io/oadp/oadp-velero-restic-restore-helper-rhel9@sha256:2a2c3fa07eedb1b2568b17f8d202a5322189626608041652ce32b6a5cd90e4c6 -registry.redhat.io/oadp/oadp-velero-plugin-rhel9@sha256:36f396227846d8b849f364beddf65524c9817f7c9f7e9713db8d4b4e2729cde2 -registry.redhat.io/oadp/oadp-velero-plugin-for-aws-rhel9@sha256:8fa90687d6c3a6147858f6df87a63c3edd77531fff12091eb04df86a4f6811d4 -registry.redhat.io/oadp/oadp-velero-plugin-for-microsoft-azure-rhel9@sha256:6f56f6730b77e65dda90f4ff9b3446850a68670b55d47300cf50cab818c2d967 -registry.redhat.io/oadp/oadp-velero-plugin-for-gcp-rhel9@sha256:985dfe920ab0def40f4d4c6baa3bbb845921617a0f73cf82e8a425039fdefce5 -registry.redhat.io/oadp/oadp-velero-plugin-for-csi-rhel9@sha256:c8979074fe11a5d1d0f5ecb0328fabb752f01103a9c03cf34e8df06bcad27f29 -registry.redhat.io/oadp/oadp-kubevirt-velero-plugin-rhel9@sha256:476fbe152797d15731a77e710b3c666317fbe9aeb998966309a021e2f1b5402f -registry.redhat.io/oadp/oadp-mustgather-rhel9@sha256:dbe4baaac15515f9c7547b77b3c2d8f3994169442a42381bcd3b0210fb53a7bf -quay.io/konveyor/velero:latest -quay.io/konveyor/velero-restore-helper:latest -quay.io/konveyor/openshift-velero-plugin:latest -quay.io/konveyor/velero-plugin-for-aws:latest -quay.io/konveyor/velero-plugin-for-microsoft-azure:latest -quay.io/konveyor/velero-plugin-for-gcp:latest -quay.io/konveyor/velero-plugin-for-csi:latest -quay.io/konveyor/kubevirt-velero-plugin:v0.2.0 -registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.2 -quay.io/konveyor/oadp-non-admin:latest \ No newline at end of file From 75ede00104aa6d22e6dbbf66b2b0d8d37abd0f43 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Tue, 28 May 2024 15:55:50 -0300 Subject: [PATCH 4/7] fixup! fix: Default value of qps and burst Signed-off-by: Mateus Oliveira --- api/v1alpha1/oadp_types.go | 4 +- ...enshift.io_dataprotectionapplications.yaml | 4 +- ...enshift.io_dataprotectionapplications.yaml | 4 +- controllers/velero.go | 24 ++------ controllers/velero_test.go | 60 ------------------- 5 files changed, 12 insertions(+), 84 deletions(-) diff --git a/api/v1alpha1/oadp_types.go b/api/v1alpha1/oadp_types.go index cca48cd5a4..9bfaadc8df 100644 --- a/api/v1alpha1/oadp_types.go +++ b/api/v1alpha1/oadp_types.go @@ -109,10 +109,10 @@ type VeleroConfig struct { // Default is 10m // +optional ResourceTimeout string `json:"resourceTimeout,omitempty"` - // Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 30) + // Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) // +optional ClientBurst *int `json:"client-burst,omitempty"` - // Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 20) + // Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) // +optional ClientQPS *float32 `json:"client-qps,omitempty"` // Velero args are settings to customize velero server arguments. Overrides values in other fields. diff --git a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml index e5df178474..caa78a1079 100644 --- a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml +++ b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml @@ -799,10 +799,10 @@ spec: type: string type: object client-burst: - description: Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 30) + description: Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) type: integer client-qps: - description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 20) + description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) type: number customPlugins: description: customPlugins defines the custom plugin to be installed with Velero diff --git a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml index 7ca2062ace..59f097042d 100644 --- a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml +++ b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml @@ -799,10 +799,10 @@ spec: type: string type: object client-burst: - description: Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 30) + description: Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) type: integer client-qps: - description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 20) + description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) type: number customPlugins: description: customPlugins defines the custom plugin to be installed with Velero diff --git a/controllers/velero.go b/controllers/velero.go index bc34e73e3e..d31c1a2424 100644 --- a/controllers/velero.go +++ b/controllers/velero.go @@ -557,8 +557,12 @@ func (r *DPAReconciler) customizeVeleroContainer(dpa *oadpv1alpha1.DataProtectio // Overriding velero restore resource priorities to OpenShift default (ie. SecurityContextConstraints needs to be restored before pod/SA) veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--restore-resource-priorities=%s", common.DefaultRestoreResourcePriorities.String())) - veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--client-burst=%v", getClientBurst(dpa))) - veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--client-qps=%v", getClientQPS(dpa))) + if dpa.Spec.Configuration.Velero != nil && dpa.Spec.Configuration.Velero.ClientBurst != nil { + veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--client-burst=%v", *dpa.Spec.Configuration.Velero.ClientBurst)) + } + if dpa.Spec.Configuration.Velero != nil && dpa.Spec.Configuration.Velero.ClientQPS != nil { + veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--client-qps=%v", *dpa.Spec.Configuration.Velero.ClientQPS)) + } setContainerDefaults(veleroContainer) // if server args is set, override the default server args if dpa.Spec.Configuration.Velero.Args != nil { @@ -573,22 +577,6 @@ func (r *DPAReconciler) customizeVeleroContainer(dpa *oadpv1alpha1.DataProtectio return nil } -func getClientBurst(dpa *oadpv1alpha1.DataProtectionApplication) int { - if dpa.Spec.Configuration.Velero != nil && dpa.Spec.Configuration.Velero.ClientBurst != nil { - return *dpa.Spec.Configuration.Velero.ClientBurst - } - // Velero default until 1.13 - return 30 -} - -func getClientQPS(dpa *oadpv1alpha1.DataProtectionApplication) float32 { - if dpa.Spec.Configuration.Velero != nil && dpa.Spec.Configuration.Velero.ClientQPS != nil { - return *dpa.Spec.Configuration.Velero.ClientQPS - } - // Velero default until 1.13 - return 20.0 -} - func getFsBackupTimeout(dpa *oadpv1alpha1.DataProtectionApplication) string { if dpa.Spec.Configuration.Restic != nil && len(dpa.Spec.Configuration.Restic.Timeout) > 0 { return dpa.Spec.Configuration.Restic.Timeout diff --git a/controllers/velero_test.go b/controllers/velero_test.go index 895ef15eb4..59df3113fb 100644 --- a/controllers/velero_test.go +++ b/controllers/velero_test.go @@ -40,8 +40,6 @@ const ( defaultFileSystemBackupTimeout = "--fs-backup-timeout=4h" defaultRestoreResourcePriorities = "--restore-resource-priorities=securitycontextconstraints,customresourcedefinitions,klusterletconfigs.config.open-cluster-management.io,managedcluster.cluster.open-cluster-management.io,namespaces,roles,rolebindings,clusterrolebindings,klusterletaddonconfig.agent.open-cluster-management.io,managedclusteraddon.addon.open-cluster-management.io,storageclasses,volumesnapshotclass.snapshot.storage.k8s.io,volumesnapshotcontents.snapshot.storage.k8s.io,volumesnapshots.snapshot.storage.k8s.io,datauploads.velero.io,persistentvolumes,persistentvolumeclaims,serviceaccounts,secrets,configmaps,limitranges,pods,replicasets.apps,clusterclasses.cluster.x-k8s.io,endpoints,services,-,clusterbootstraps.run.tanzu.vmware.com,clusters.cluster.x-k8s.io,clusterresourcesets.addons.cluster.x-k8s.io" defaultDisableInformerCache = "--disable-informer-cache=false" - defaultClientBurst = "--client-burst=30" - defaultClientQPS = "--client-qps=20" ) var ( @@ -379,8 +377,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -453,8 +449,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -541,8 +535,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "--features=EnableCSI", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: append(baseVolumeMounts, []corev1.VolumeMount{ @@ -649,8 +641,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -744,8 +734,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -1191,8 +1179,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -1372,8 +1358,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -1555,8 +1539,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -1738,8 +1720,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -1921,8 +1901,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2105,8 +2083,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2289,8 +2265,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2472,8 +2446,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2656,8 +2628,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2839,8 +2809,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--item-operation-sync-frequency=5m", @@ -2966,8 +2934,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), defaultDisableInformerCache, @@ -3091,8 +3057,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, "--log-level", logrus.InfoLevel.String(), "--resource-timeout=5m", @@ -3268,8 +3232,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3356,8 +3318,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3441,8 +3401,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3526,8 +3484,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3614,8 +3570,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3734,8 +3688,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3844,8 +3796,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: baseVolumeMounts, @@ -3916,8 +3866,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: append(baseVolumeMounts, []corev1.VolumeMount{ @@ -4002,8 +3950,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: []corev1.VolumeMount{ @@ -4101,8 +4047,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: []corev1.VolumeMount{ @@ -4222,8 +4166,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: []corev1.VolumeMount{ @@ -4328,8 +4270,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { "server", defaultFileSystemBackupTimeout, defaultRestoreResourcePriorities, - defaultClientBurst, - defaultClientQPS, defaultDisableInformerCache, }, VolumeMounts: []corev1.VolumeMount{ From 0798d25747f182fbe81e1536362b0c938bd83445 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 5 Jun 2024 14:40:33 -0300 Subject: [PATCH 5/7] fixup! fix: Default value of qps and burst Signed-off-by: Mateus Oliveira --- Makefile | 2 +- api/v1alpha1/oadp_types.go | 2 +- api/v1alpha1/zz_generated.deepcopy.go | 2 +- .../oadp.openshift.io_dataprotectionapplications.yaml | 2 +- .../bases/oadp.openshift.io_dataprotectionapplications.yaml | 2 +- controllers/velero_test.go | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e08920e3ae..79f416ad33 100644 --- a/Makefile +++ b/Makefile @@ -107,7 +107,7 @@ BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) # Image URL to use all building/pushing image targets IMG ?= quay.io/konveyor/oadp-operator:latest -CRD_OPTIONS ?= "crd:allowDangerousTypes=true" +CRD_OPTIONS ?= "crd" # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) diff --git a/api/v1alpha1/oadp_types.go b/api/v1alpha1/oadp_types.go index 9bfaadc8df..058555bb32 100644 --- a/api/v1alpha1/oadp_types.go +++ b/api/v1alpha1/oadp_types.go @@ -114,7 +114,7 @@ type VeleroConfig struct { ClientBurst *int `json:"client-burst,omitempty"` // Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) // +optional - ClientQPS *float32 `json:"client-qps,omitempty"` + ClientQPS *int `json:"client-qps,omitempty"` // Velero args are settings to customize velero server arguments. Overrides values in other fields. // +optional Args *server.Args `json:"args,omitempty"` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 7de6256c38..4eea30b28e 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -670,7 +670,7 @@ func (in *VeleroConfig) DeepCopyInto(out *VeleroConfig) { } if in.ClientQPS != nil { in, out := &in.ClientQPS, &out.ClientQPS - *out = new(float32) + *out = new(int) **out = **in } if in.Args != nil { diff --git a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml index caa78a1079..a0359dc5d8 100644 --- a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml +++ b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml @@ -803,7 +803,7 @@ spec: type: integer client-qps: description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) - type: number + type: integer customPlugins: description: customPlugins defines the custom plugin to be installed with Velero items: diff --git a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml index 59f097042d..853c265c11 100644 --- a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml +++ b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml @@ -803,7 +803,7 @@ spec: type: integer client-qps: description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) - type: number + type: integer customPlugins: description: customPlugins defines the custom plugin to be installed with Velero items: diff --git a/controllers/velero_test.go b/controllers/velero_test.go index 59df3113fb..0b3f61cd3d 100644 --- a/controllers/velero_test.go +++ b/controllers/velero_test.go @@ -4579,7 +4579,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { Configuration: &oadpv1alpha1.ApplicationConfig{ Velero: &oadpv1alpha1.VeleroConfig{ ClientBurst: pointer.Int(123), - ClientQPS: pointer.Float32(123), + ClientQPS: pointer.Int(123), }, NodeAgent: &oadpv1alpha1.NodeAgentConfig{ UploaderType: "kopia", @@ -4653,7 +4653,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { Configuration: &oadpv1alpha1.ApplicationConfig{ Velero: &oadpv1alpha1.VeleroConfig{ ClientBurst: pointer.Int(123), - ClientQPS: pointer.Float32(123), + ClientQPS: pointer.Int(123), Args: &server.Args{ ServerConfig: server.ServerConfig{ ClientBurst: pointer.Int(321), From aa998ac4852b6578a40597c07fe67c133cd04059 Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Tue, 30 Jul 2024 15:12:31 -0300 Subject: [PATCH 6/7] fixup! fix: Default value of qps and burst Signed-off-by: Mateus Oliveira --- controllers/velero_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/controllers/velero_test.go b/controllers/velero_test.go index 0b3f61cd3d..838aecdb26 100644 --- a/controllers/velero_test.go +++ b/controllers/velero_test.go @@ -4578,8 +4578,8 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ Velero: &oadpv1alpha1.VeleroConfig{ - ClientBurst: pointer.Int(123), - ClientQPS: pointer.Int(123), + ClientBurst: ptr.To(123), + ClientQPS: ptr.To(123), }, NodeAgent: &oadpv1alpha1.NodeAgentConfig{ UploaderType: "kopia", @@ -4599,7 +4599,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, Spec: appsv1.DeploymentSpec{ Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, - Replicas: pointer.Int32(1), + Replicas: ptr.To(int32(1)), Template: corev1.PodTemplateSpec{ ObjectMeta: veleroPodObjectMeta, Spec: corev1.PodSpec{ @@ -4652,12 +4652,12 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { Spec: oadpv1alpha1.DataProtectionApplicationSpec{ Configuration: &oadpv1alpha1.ApplicationConfig{ Velero: &oadpv1alpha1.VeleroConfig{ - ClientBurst: pointer.Int(123), - ClientQPS: pointer.Int(123), + ClientBurst: ptr.To(123), + ClientQPS: ptr.To(123), Args: &server.Args{ ServerConfig: server.ServerConfig{ - ClientBurst: pointer.Int(321), - ClientQPS: pointer.String("321"), + ClientBurst: ptr.To(321), + ClientQPS: ptr.To("321"), }, }, }, @@ -4679,7 +4679,7 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, Spec: appsv1.DeploymentSpec{ Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, - Replicas: pointer.Int32(1), + Replicas: ptr.To(int32(1)), Template: corev1.PodTemplateSpec{ ObjectMeta: veleroPodObjectMeta, Spec: corev1.PodSpec{ From 8a0732c3e38f6767b35c769d04861638ef668e9b Mon Sep 17 00:00:00 2001 From: Mateus Oliveira Date: Wed, 31 Jul 2024 14:52:05 -0300 Subject: [PATCH 7/7] fixup! fix: Default value of qps and burst Signed-off-by: Mateus Oliveira --- api/v1alpha1/oadp_types.go | 4 +- ...enshift.io_dataprotectionapplications.yaml | 4 +- ...enshift.io_dataprotectionapplications.yaml | 4 +- controllers/velero_test.go | 37 +++++++++---------- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/api/v1alpha1/oadp_types.go b/api/v1alpha1/oadp_types.go index 058555bb32..e629ef1c47 100644 --- a/api/v1alpha1/oadp_types.go +++ b/api/v1alpha1/oadp_types.go @@ -109,10 +109,10 @@ type VeleroConfig struct { // Default is 10m // +optional ResourceTimeout string `json:"resourceTimeout,omitempty"` - // Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) + // maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) // +optional ClientBurst *int `json:"client-burst,omitempty"` - // Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) + // maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) // +optional ClientQPS *int `json:"client-qps,omitempty"` // Velero args are settings to customize velero server arguments. Overrides values in other fields. diff --git a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml index a0359dc5d8..b61c9d4d7a 100644 --- a/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml +++ b/bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml @@ -799,10 +799,10 @@ spec: type: string type: object client-burst: - description: Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) + description: maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) type: integer client-qps: - description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) + description: maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) type: integer customPlugins: description: customPlugins defines the custom plugin to be installed with Velero diff --git a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml index 853c265c11..c86b4f5ab2 100644 --- a/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml +++ b/config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml @@ -799,10 +799,10 @@ spec: type: string type: object client-burst: - description: Maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) + description: maximum number of requests by the server to the Kubernetes API in a short period of time. (default 100) type: integer client-qps: - description: Maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) + description: maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100) type: integer customPlugins: description: customPlugins defines the custom plugin to be installed with Velero diff --git a/controllers/velero_test.go b/controllers/velero_test.go index 838aecdb26..9c06850c8e 100644 --- a/controllers/velero_test.go +++ b/controllers/velero_test.go @@ -4561,15 +4561,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, { name: "Override burst and qps", - veleroDeployment: &appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-velero-deployment", - Namespace: "test-ns", - }, - Spec: appsv1.DeploymentSpec{ - Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, - }, - }, dpa: &oadpv1alpha1.DataProtectionApplication{ ObjectMeta: metav1.ObjectMeta{ Name: "test-Velero-CR", @@ -4587,6 +4578,15 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, }, }, + veleroDeployment: &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-velero-deployment", + Namespace: "test-ns", + }, + Spec: appsv1.DeploymentSpec{ + Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, + }, + }, wantVeleroDeployment: &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: "test-velero-deployment", @@ -4635,15 +4635,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, { name: "Conflicting burst and qps", - veleroDeployment: &appsv1.Deployment{ - ObjectMeta: metav1.ObjectMeta{ - Name: "test-velero-deployment", - Namespace: "test-ns", - }, - Spec: appsv1.DeploymentSpec{ - Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, - }, - }, dpa: &oadpv1alpha1.DataProtectionApplication{ ObjectMeta: metav1.ObjectMeta{ Name: "test-Velero-CR", @@ -4667,6 +4658,15 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, }, }, + veleroDeployment: &appsv1.Deployment{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-velero-deployment", + Namespace: "test-ns", + }, + Spec: appsv1.DeploymentSpec{ + Selector: &metav1.LabelSelector{MatchLabels: veleroDeploymentMatchLabels}, + }, + }, wantVeleroDeployment: &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: "test-velero-deployment", @@ -4712,7 +4712,6 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) { }, }, }, - wantErr: true, // TODO should error to avoid user confusion? }, } for _, tt := range tests {