Skip to content

Commit c2abe2c

Browse files
committed
Remove deprecated finalizers
Signed-off-by: Jason Parraga <sovietaced@gmail.com>
1 parent 7dc9b56 commit c2abe2c

4 files changed

Lines changed: 5 additions & 20 deletions

File tree

flyteplugins/go/tasks/plugins/array/k8s/subtask.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ const (
3232
ErrReplaceCmdTemplate stdErrors.ErrorCode = "CMD_TEMPLATE_FAILED"
3333
FlyteK8sArrayIndexVarName string = "FLYTE_K8S_ARRAY_INDEX"
3434
finalizer string = "flyte.org/finalizer-array"
35-
// Old non-domain-qualified finalizer for backwards compatibility
36-
// This should eventually be removed
37-
oldFinalizer string = "flyte/array"
38-
JobIndexVarName string = "BATCH_JOB_ARRAY_INDEX_VAR_NAME"
35+
JobIndexVarName string = "BATCH_JOB_ARRAY_INDEX_VAR_NAME"
3936
)
4037

4138
var (
@@ -150,8 +147,7 @@ func clearFinalizer(ctx context.Context, o client.Object, kubeClient pluginsCore
150147
// Checking for the old finalizer too for backwards compatibility. This should eventually be removed
151148
// Go does short-circuiting so we have to make sure both are removed
152149
finalizerRemoved := controllerutil.RemoveFinalizer(o, finalizer)
153-
oldFinalizerRemoved := controllerutil.RemoveFinalizer(o, oldFinalizer)
154-
if finalizerRemoved || oldFinalizerRemoved {
150+
if finalizerRemoved {
155151
err := kubeClient.GetClient().Update(ctx, o)
156152
if err != nil && !isK8sObjectNotExists(err) {
157153
logger.Warningf(ctx, "Failed to clear finalizer for Resource with name: %v/%v. Error: %v", o.GetNamespace(), o.GetName(), err)

flytepropeller/pkg/controller/controller.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ import (
6262

6363
const (
6464
// Finalizer is the global and domain-qualified Flyte finalizer
65-
Finalizer = "flyte.org/finalizer"
66-
// OldFinalizer is the old non-domain-qualified finalizer, kept for backwards compatibility
67-
// This should eventually be removed
68-
OldFinalizer = "flyte-finalizer"
65+
Finalizer = "flyte.org/finalizer"
6966
resourceLevelMonitorCycleDuration = 5 * time.Second
7067
missing = "missing"
7168
podDefaultNamespace = "flyte"

flytepropeller/pkg/controller/handler.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func (p *Propeller) Handle(ctx context.Context, namespace, name string) error {
213213
if w.GetExecutionStatus().IsTerminated() {
214214
// Checking for the old finalizer for backwards compatibility
215215
// This should be eventually removed
216-
if HasCompletedLabel(w) && !controllerutil.ContainsFinalizer(w, Finalizer) && !controllerutil.ContainsFinalizer(w, OldFinalizer) {
216+
if HasCompletedLabel(w) && !controllerutil.ContainsFinalizer(w, Finalizer) {
217217
logger.Debugf(ctx, "Workflow is terminated.")
218218
// This workflow had previously completed, let us ignore it
219219
return nil
@@ -329,8 +329,6 @@ func (p *Propeller) streak(ctx context.Context, w *v1alpha1.FlyteWorkflow, wfClo
329329
// We add a completed label so that we can avoid polling for this workflow
330330
SetCompletedLabel(mutatedWf, time.Now())
331331
_ = controllerutil.RemoveFinalizer(mutatedWf, Finalizer)
332-
// Backwards compatibility. This should eventually be removed
333-
_ = controllerutil.RemoveFinalizer(mutatedWf, OldFinalizer)
334332
}
335333
}
336334

@@ -389,8 +387,6 @@ func (p *Propeller) streak(ctx context.Context, w *v1alpha1.FlyteWorkflow, wfClo
389387
// catch potential indefinite update loop
390388
if mutatedWf.GetExecutionStatus().IsTerminated() {
391389
_ = controllerutil.RemoveFinalizer(mutableW, Finalizer)
392-
// Backwards compatibility. This should eventually be removed
393-
_ = controllerutil.RemoveFinalizer(mutableW, OldFinalizer)
394390
SetDefinitionVersionIfEmpty(mutableW, v1alpha1.LatestWorkflowDefinitionVersion)
395391
SetCompletedLabel(mutableW, time.Now())
396392
msg := fmt.Sprintf("Workflow size has breached threshold. Finalized with status: %v", mutatedWf.GetExecutionStatus().GetPhase())

flytepropeller/pkg/controller/nodes/task/k8s/plugin_manager.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ import (
4646

4747
const (
4848
finalizer = "flyte.org/finalizer-k8s"
49-
// Old non-domain-qualified finalizer for backwards compatibility
50-
// This should eventually be removed
51-
oldFinalizer = "flyte/flytek8s"
5249
)
5350

5451
const pluginStateVersion = 1
@@ -493,8 +490,7 @@ func (e *PluginManager) clearFinalizer(ctx context.Context, o client.Object) err
493490
// Checking for the old finalizer too for backwards compatibility. This should eventually be removed
494491
// Go does short-circuiting and we have to make sure both are removed
495492
finalizerRemoved := controllerutil.RemoveFinalizer(o, finalizer)
496-
oldFinalizerRemoved := controllerutil.RemoveFinalizer(o, oldFinalizer)
497-
if finalizerRemoved || oldFinalizerRemoved {
493+
if finalizerRemoved {
498494
// Patch finalizers to reduce conflicts caused by a stale informer cache vs full Update().
499495
err := e.kubeClient.GetClient().Patch(ctx, o, client.MergeFrom(original))
500496
if err != nil && !isK8sObjectNotExists(err) {

0 commit comments

Comments
 (0)