diff --git a/pkg/controller/workflowstore/resource_version_caching.go b/pkg/controller/workflowstore/resource_version_caching.go index 141dc0bb6..eccb28055 100644 --- a/pkg/controller/workflowstore/resource_version_caching.go +++ b/pkg/controller/workflowstore/resource_version_caching.go @@ -9,6 +9,8 @@ import ( "github.com/flyteorg/flytepropeller/pkg/apis/flyteworkflow/v1alpha1" "github.com/flyteorg/flytestdlib/promutils" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // TODO - optimization maybe? we can move this to predicate check, before we add it to the queue? @@ -94,6 +96,14 @@ func (r *resourceVersionCaching) UpdateStatus(ctx context.Context, workflow *v1a func (r *resourceVersionCaching) Update(ctx context.Context, workflow *v1alpha1.FlyteWorkflow, priorityClass PriorityClass) ( newWF *v1alpha1.FlyteWorkflow, err error) { + // If the workflow has any managed fields setting the array to one empty ManagedField clears them in the CRD. + // FlyteWorkflow CRDs are only managed by a single FlytePropeller instance and therefore the managed fields paradigm + // does not add useful functionality. Clearing them reduces CRD size, improving etcd I/O performance. + if len(workflow.ObjectMeta.ManagedFields) > 0 { + workflow.ObjectMeta.ManagedFields = workflow.ObjectMeta.ManagedFields[:1] + workflow.ObjectMeta.ManagedFields[0] = metav1.ManagedFieldsEntry{} + } + newWF, err = r.w.Update(ctx, workflow, priorityClass) if err != nil { return nil, err