Skip to content

Fixed the operator to ignore workflows and workflow instances marked with mismatching synapse.io/operator labels #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/operator/Synapse.Operator/Services/WorkflowController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected virtual async Task<bool> TryClaimAsync(Workflow workflow, Cancellation
{
ArgumentNullException.ThrowIfNull(workflow);
if (this.Operator == null) throw new Exception("The controller must be started before attempting any operation");
if (workflow.Metadata.Labels != null && workflow.Metadata.Labels.TryGetValue(SynapseDefaults.Resources.Labels.Operator, out var operatorQualifiedName) && operatorQualifiedName == this.Operator.Resource.GetQualifiedName()) return true;
if (workflow.Metadata.Labels != null && workflow.Metadata.Labels.TryGetValue(SynapseDefaults.Resources.Labels.Operator, out var operatorQualifiedName)) return operatorQualifiedName == this.Operator.Resource.GetQualifiedName();
try
{
var originalResource = workflow.Clone();
Expand All @@ -120,7 +120,7 @@ protected virtual async Task<bool> TryClaimAsync(Workflow workflow, Cancellation
protected virtual async Task<bool> TryReleaseAsync(Workflow workflow, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(workflow);
if (workflow.Metadata.Labels != null && workflow.Metadata.Labels.TryGetValue(SynapseDefaults.Resources.Labels.Operator, out var operatorQualifiedName) && operatorQualifiedName == this.Operator.Resource.GetQualifiedName()) return true;
if (workflow.Metadata.Labels != null && workflow.Metadata.Labels.TryGetValue(SynapseDefaults.Resources.Labels.Operator, out var operatorQualifiedName)) return operatorQualifiedName == this.Operator.Resource.GetQualifiedName();
try
{
var originalResource = workflow.Clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected virtual async Task<WorkflowInstanceHandler> CreateWorkflowInstanceHand
protected virtual async Task<bool> TryClaimAsync(WorkflowInstance resource, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(resource);
if (resource.Metadata.Labels != null && resource.Metadata.Labels.TryGetValue(SynapseDefaults.Resources.Labels.Operator, out var operatorQualifiedName) && operatorQualifiedName == this.Operator.Resource.GetQualifiedName()) return true;
if (resource.Metadata.Labels != null && resource.Metadata.Labels.TryGetValue(SynapseDefaults.Resources.Labels.Operator, out var operatorQualifiedName)) return operatorQualifiedName == this.Operator.Resource.GetQualifiedName();
try
{
var originalResource = resource.Clone();
Expand All @@ -112,7 +112,7 @@ protected virtual async Task<bool> TryClaimAsync(WorkflowInstance resource, Canc
protected virtual async Task<bool> TryReleaseAsync(WorkflowInstance resource, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(resource);
if (resource.Metadata.Labels != null && resource.Metadata.Labels.TryGetValue(SynapseDefaults.Resources.Labels.Operator, out var operatorQualifiedName) && operatorQualifiedName == this.Operator.Resource.GetQualifiedName()) return true;
if (resource.Metadata.Labels != null && resource.Metadata.Labels.TryGetValue(SynapseDefaults.Resources.Labels.Operator, out var operatorQualifiedName)) return operatorQualifiedName == this.Operator.Resource.GetQualifiedName();
try
{
var originalResource = resource.Clone();
Expand Down