Skip to content

Commit

Permalink
Removed Replace concurrency policy
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Jun 3, 2024
1 parent f74592b commit 36d1b40
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 20 deletions.
1 change: 0 additions & 1 deletion deploy/crds/planetscale.com_vitessbackupschedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ spec:
enum:
- Allow
- Forbid
- Replace
example: Forbid
type: string
failedJobsHistoryLimit:
Expand Down
1 change: 0 additions & 1 deletion deploy/crds/planetscale.com_vitessclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ spec:
enum:
- Allow
- Forbid
- Replace
example: Forbid
type: string
failedJobsHistoryLimit:
Expand Down
5 changes: 1 addition & 4 deletions pkg/apis/planetscale/v2/vitessbackupschedule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

// ConcurrencyPolicy describes how the concurrency of new jobs created by VitessBackupSchedule
// is handled, the default is set to AllowConcurrent.
// +kubebuilder:validation:Enum=Allow;Forbid;Replace
// +kubebuilder:validation:Enum=Allow;Forbid
type ConcurrencyPolicy string

const (
Expand All @@ -32,9 +32,6 @@ const (

// ForbidConcurrent forbids concurrent runs, skipping next run if previous hasn't finished yet.
ForbidConcurrent ConcurrencyPolicy = "Forbid"

// ReplaceConcurrent cancels currently running job and replaces it with a new one.
ReplaceConcurrent ConcurrencyPolicy = "Replace"
)

// BackupStrategyName describes the vtctldclient command that will be used to take a backup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,6 @@ func (r *ReconcileVitessBackupsSchedule) Reconcile(ctx context.Context, req ctrl
return scheduledResult, nil
}

// Check concurrency policy to know if we should replace existing jobs
if vbsc.Spec.ConcurrencyPolicy == planetscalev2.ReplaceConcurrent {
for _, activeJob := range jobs.active {
if err = r.client.Delete(ctx, activeJob, client.PropagationPolicy(metav1.DeletePropagationBackground)); client.IgnoreNotFound(err) != nil {
log.WithError(err).Errorf("unable to delete active job: %s", activeJob.Name)
return ctrl.Result{}, err
}
}
}

// Now that the different policies are checked, we can create and apply our new job.
job, err := r.createJob(ctx, &vbsc, missedRun)
if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions test/endtoend/operator/operator-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ spec:
enum:
- Allow
- Forbid
- Replace
example: Forbid
type: string
failedJobsHistoryLimit:
Expand Down Expand Up @@ -1657,7 +1656,6 @@ spec:
enum:
- Allow
- Forbid
- Replace
example: Forbid
type: string
failedJobsHistoryLimit:
Expand Down
2 changes: 0 additions & 2 deletions test/endtoend/operator/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ spec:
enum:
- Allow
- Forbid
- Replace
example: Forbid
type: string
failedJobsHistoryLimit:
Expand Down Expand Up @@ -1657,7 +1656,6 @@ spec:
enum:
- Allow
- Forbid
- Replace
example: Forbid
type: string
failedJobsHistoryLimit:
Expand Down

0 comments on commit 36d1b40

Please sign in to comment.