From 45f9a8ec02ee21a197a28b9049fcb96622a00209 Mon Sep 17 00:00:00 2001 From: David Kwon Date: Thu, 19 Mar 2026 16:31:11 -0400 Subject: [PATCH] Update backup job's default backoff limit to 1 (#1605) Signed-off-by: dkwon17 --- CHANGELOG.md | 2 +- apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go | 4 ++-- controllers/backupcronjob/backupcronjob_controller_test.go | 4 ++-- .../controller.devfile.io_devworkspaceoperatorconfigs.yaml | 4 ++-- deploy/deployment/kubernetes/combined.yaml | 4 ++-- ...onfigs.controller.devfile.io.CustomResourceDefinition.yaml | 4 ++-- deploy/deployment/openshift/combined.yaml | 4 ++-- ...onfigs.controller.devfile.io.CustomResourceDefinition.yaml | 4 ++-- .../controller.devfile.io_devworkspaceoperatorconfigs.yaml | 4 ++-- pkg/config/defaults.go | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) 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 c0503c021..b45a3c808 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 7f7dd6bee..29f3bf421 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 bb8f392bb..d9adc48f4 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 11d41b10e..acebbb833 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 d000f907e..8cf231374 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 11d41b10e..acebbb833 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 2a7ea36e6..3aab5afe8 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,