Skip to content

Conversation

@djanjic
Copy link
Member

@djanjic djanjic commented Aug 1, 2025

Fixes #14671

Motivation

This adds support for creating configmap sync configuration using CLI.

Modifications

  • added new endpoints to accomodate this change
  • added CLI support for creating configmap sync config.
  • added tests

Verification

  • manual testing
  • e2e tests
  • unit tests

Documentation

  • Documentation is automatically generated for new CLI commands

@djanjic djanjic marked this pull request as ready for review August 7, 2025 15:41
Copy link
Member

@eduardodbr eduardodbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small questions but otherwise looks good

}

func (s *syncServer) DeleteSyncLimit(ctx context.Context, req *syncpkg.DeleteSyncLimitRequest) (*syncpkg.DeleteSyncLimitResponse, error) {
fmt.Printf("Deleting sync limit for ConfigMap %s in namespace %s with key %s\n", req.Name, req.Namespace, req.Key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this print or replace it proper logging

Use: "get",
Short: "Get a configmap sync limit",
Args: cobra.ExactArgs(1),
Example: `argo sync get configmap my-cm --key my-key`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Example: `argo sync get configmap my-cm --key my-key`,
Example: `argo sync configmap get my-cm --key my-key`,

the command and the method are switched

Key: req.Key,
SizeLimit: req.SizeLimit,
}, false)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Create doing an Update violates some API principles, is this common in the current codebase?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree with this, we should fail on any error really.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should create a cm with a defined key/value for the semaphore. If cm already exists, we are just trying to add another field to that configmap, which could have multiple semaphores for different workflows. At least, that's the idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly agree with @djanjic, it's not completely pure:

I think this should:

  • If the CM does not exist, create it (we probably all agree on this)
  • If the CM does exist, but the key does not, create the key within in (by performing a CM update call).
  • If the CM does exist and the key also does, fail.

return nil, sutils.ToStatusError(err, codes.Internal)
}

delete(cm.Data, req.Key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the deleted key is the only key in the Configmap, should the CM also be deleted? otherwise the CM will be created with no data

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine to leave it around

### Examples

```
argo sync get configmap my-cm --key my-key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
argo sync get configmap my-cm --key my-key
argo sync configmap get my-cm --key my-key

@djanjic djanjic self-assigned this Aug 25, 2025
Copy link
Member

@isubasinghe isubasinghe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't attempt an update, apart from this issue, it looks good.

Key: req.Key,
SizeLimit: req.SizeLimit,
}, false)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree with this, we should fail on any error really.

return nil, sutils.ToStatusError(err, codes.Internal)
}

delete(cm.Data, req.Key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine to leave it around

@Joibel Joibel merged commit ece9e90 into argoproj:main Sep 22, 2025
37 checks passed
yamadayutaka pushed a commit to yamadayutaka/argo-workflows that referenced this pull request Sep 25, 2025
ItielOlenick pushed a commit to ItielOlenick/argo-workflows that referenced this pull request Oct 26, 2025
guanguxiansheng pushed a commit to guanguxiansheng/argo-workflows that referenced this pull request Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for creating a configmap semaphore config using CLI

4 participants