diff --git a/CHANGELOG.md b/CHANGELOG.md index bd7ed533b..905643022 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ spec: ### Configurable backup job retry limit [#1579](https://github.com/devfile/devworkspace-operator/issues/1579) -Administrators can now configure the maximum number of retries for backup jobs in the DevWorkspaceOperatorConfig via the `backoffLimit` field. The default value is 3. +Administrators can now configure the maximum number of retries for backup jobs in the DevWorkspaceOperatorConfig via the `backoffLimit` field. The default value is 1. ```yaml apiVersion: controller.devfile.io/v1alpha1 diff --git a/apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go b/apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go index d93dad00d..60a2df5d4 100644 --- a/apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go +++ b/apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go @@ -112,9 +112,9 @@ type BackupCronJobConfig struct { // +kubebuilder:validation:Optional Schedule string `json:"schedule,omitempty"` // BackoffLimit specifies the number of retries before marking a backup job as failed. - // Defaults to 3 if not specified. + // Defaults to 1 if not specified. // +kubebuilder:validation:Minimum=0 - // +kubebuilder:default:=3 + // +kubebuilder:default:=1 // +kubebuilder:validation:Optional BackoffLimit *int32 `json:"backoffLimit,omitempty"` } diff --git a/controllers/backupcronjob/backupcronjob_controller_test.go b/controllers/backupcronjob/backupcronjob_controller_test.go index 41c2e42f0..134bdb17e 100644 --- a/controllers/backupcronjob/backupcronjob_controller_test.go +++ b/controllers/backupcronjob/backupcronjob_controller_test.go @@ -382,7 +382,7 @@ var _ = Describe("BackupCronJobReconciler", func() { It("creates a Job with configured backoffLimit", func() { enabled := true schedule := "* * * * *" - backoffLimit := int32(1) + backoffLimit := int32(2) dwoc := &controllerv1alpha1.DevWorkspaceOperatorConfig{ ObjectMeta: metav1.ObjectMeta{Name: nameNamespace.Name, Namespace: nameNamespace.Namespace}, Config: &controllerv1alpha1.OperatorConfiguration{ @@ -413,7 +413,7 @@ var _ = Describe("BackupCronJobReconciler", func() { Expect(fakeClient.List(ctx, jobList, &client.ListOptions{Namespace: dw.Namespace})).To(Succeed()) Expect(jobList.Items).To(HaveLen(1)) Expect(jobList.Items[0].Spec.BackoffLimit).ToNot(BeNil()) - Expect(*jobList.Items[0].Spec.BackoffLimit).To(Equal(int32(1))) + Expect(*jobList.Items[0].Spec.BackoffLimit).To(Equal(int32(2))) }) It("does not create a Job when the DevWorkspace was stopped beyond time range", func() { diff --git a/deploy/bundle/manifests/controller.devfile.io_devworkspaceoperatorconfigs.yaml b/deploy/bundle/manifests/controller.devfile.io_devworkspaceoperatorconfigs.yaml index cf9a12203..79a1844f0 100644 --- a/deploy/bundle/manifests/controller.devfile.io_devworkspaceoperatorconfigs.yaml +++ b/deploy/bundle/manifests/controller.devfile.io_devworkspaceoperatorconfigs.yaml @@ -185,10 +185,10 @@ spec: description: BackupCronJobConfig defines configuration options for a cron job that automatically backs up workspace PVCs. properties: backoffLimit: - default: 3 + default: 1 description: |- BackoffLimit specifies the number of retries before marking a backup job as failed. - Defaults to 3 if not specified. + Defaults to 1 if not specified. format: int32 minimum: 0 type: integer diff --git a/deploy/deployment/kubernetes/combined.yaml b/deploy/deployment/kubernetes/combined.yaml index 160f51e0a..e19401db5 100644 --- a/deploy/deployment/kubernetes/combined.yaml +++ b/deploy/deployment/kubernetes/combined.yaml @@ -187,10 +187,10 @@ spec: for a cron job that automatically backs up workspace PVCs. properties: backoffLimit: - default: 3 + default: 1 description: |- BackoffLimit specifies the number of retries before marking a backup job as failed. - Defaults to 3 if not specified. + Defaults to 1 if not specified. format: int32 minimum: 0 type: integer diff --git a/deploy/deployment/kubernetes/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml b/deploy/deployment/kubernetes/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml index dbefb0949..3319d3bdf 100644 --- a/deploy/deployment/kubernetes/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml +++ b/deploy/deployment/kubernetes/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml @@ -187,10 +187,10 @@ spec: for a cron job that automatically backs up workspace PVCs. properties: backoffLimit: - default: 3 + default: 1 description: |- BackoffLimit specifies the number of retries before marking a backup job as failed. - Defaults to 3 if not specified. + Defaults to 1 if not specified. format: int32 minimum: 0 type: integer diff --git a/deploy/deployment/openshift/combined.yaml b/deploy/deployment/openshift/combined.yaml index fb41fbfd9..448227d7f 100644 --- a/deploy/deployment/openshift/combined.yaml +++ b/deploy/deployment/openshift/combined.yaml @@ -187,10 +187,10 @@ spec: for a cron job that automatically backs up workspace PVCs. properties: backoffLimit: - default: 3 + default: 1 description: |- BackoffLimit specifies the number of retries before marking a backup job as failed. - Defaults to 3 if not specified. + Defaults to 1 if not specified. format: int32 minimum: 0 type: integer diff --git a/deploy/deployment/openshift/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml b/deploy/deployment/openshift/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml index dbefb0949..3319d3bdf 100644 --- a/deploy/deployment/openshift/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml +++ b/deploy/deployment/openshift/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml @@ -187,10 +187,10 @@ spec: for a cron job that automatically backs up workspace PVCs. properties: backoffLimit: - default: 3 + default: 1 description: |- BackoffLimit specifies the number of retries before marking a backup job as failed. - Defaults to 3 if not specified. + Defaults to 1 if not specified. format: int32 minimum: 0 type: integer diff --git a/deploy/templates/crd/bases/controller.devfile.io_devworkspaceoperatorconfigs.yaml b/deploy/templates/crd/bases/controller.devfile.io_devworkspaceoperatorconfigs.yaml index bff10a64d..78b1a9275 100644 --- a/deploy/templates/crd/bases/controller.devfile.io_devworkspaceoperatorconfigs.yaml +++ b/deploy/templates/crd/bases/controller.devfile.io_devworkspaceoperatorconfigs.yaml @@ -185,10 +185,10 @@ spec: for a cron job that automatically backs up workspace PVCs. properties: backoffLimit: - default: 3 + default: 1 description: |- BackoffLimit specifies the number of retries before marking a backup job as failed. - Defaults to 3 if not specified. + Defaults to 1 if not specified. format: int32 minimum: 0 type: integer diff --git a/pkg/config/defaults.go b/pkg/config/defaults.go index 267e3e281..f28fbb171 100644 --- a/pkg/config/defaults.go +++ b/pkg/config/defaults.go @@ -97,7 +97,7 @@ var defaultConfig = &v1alpha1.OperatorConfiguration{ BackupCronJob: &v1alpha1.BackupCronJobConfig{ Enable: pointer.Bool(false), Schedule: "0 0 1 * *", - BackoffLimit: pointer.Int32(3), + BackoffLimit: pointer.Int32(1), }, // Do not declare a default value for this field. // Setting a default leads to an endless reconcile loop when UserNamespacesSupport is disabled,