Skip to content

Conversation

@djanjic
Copy link
Member

@djanjic djanjic commented Aug 25, 2025

Fixes #14783

Motivation

This adds support for creating a database semaphore configuration using the CLI.

Modifications

Verification

  • manual testing
  • e2e tests
  • unit tests

Documentation

  • Documentation is automatically generated for new CLI commands

@djanjic djanjic self-assigned this Aug 25, 2025
@djanjic djanjic marked this pull request as ready for review September 23, 2025 11:36
Use: "create",
Short: "create a db sync limit",
Args: cobra.ExactArgs(1),
Example: `argo sync db create my-key --size-limit 10`,
Copy link
Member

Choose a reason for hiding this comment

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

While I understand why there is no --key flag here, I kind of don't like the inconsistency.

Copy link
Member

Choose a reason for hiding this comment

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

Makes me wonder if the cli should look more like one of these:

argo sync create my-key --type db

argo sync create my-key --configmap cmapname

argo sync create my-key --type configmap --name cmapname

Copy link
Member

Choose a reason for hiding this comment

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

I agree with this, consistency between the two commands would be preferable.

Copy link
Member

Choose a reason for hiding this comment

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

my preferred solution would also be:

argo sync create --type [configmap|db] --limit [--configmap ]

Copy link
Member Author

@djanjic djanjic Oct 7, 2025

Choose a reason for hiding this comment

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

This is now updated. Both cm and db part.

Use: "create",
Short: "create a db sync limit",
Args: cobra.ExactArgs(1),
Example: `argo sync db create my-key --size-limit 10`,
Copy link
Member

Choose a reason for hiding this comment

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

I agree with this, consistency between the two commands would be preferable.


```
-h, --help help for create
--size-limit int32 Size limit of the sync limit
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 this could be simplified to either --size or --limit here and in the other places

Copy link
Member Author

Choose a reason for hiding this comment

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

updated


func (s *dbSyncProvider) createSyncLimit(ctx context.Context, req *syncpkg.CreateSyncLimitRequest) (*syncpkg.SyncLimitResponse, error) {
allowed, err := auth.CanI(ctx, "create", workflow.WorkflowPlural, req.Namespace, "")
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

just wondering, why do you think it is necessary to check permissions for DB sync limits but not for ConfigMap sync?

Copy link
Member

Choose a reason for hiding this comment

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

This was my suggestion. ConfigMap access is controlled by Kubernetes standard RBAC. There is no such equivalent for the database access, so the idea was to make it use an in cluster object to see if the request was "reasonable".

@djanjic - this behaviour should be documented, and this whole class of db access should be controllable (e.g. the admin can disable it if they don't want it).

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

if err == nil {
_, has := cm.Data[req.Key]
if has {
return nil, fmt.Errorf("sync limit cannot be created as it already exists")
Copy link
Member

Choose a reason for hiding this comment

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

this should return a status.Error(codes.AlreadyExists) error

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@djanjic djanjic requested review from Joibel and eduardodbr October 8, 2025 11:41
@djanjic djanjic requested a review from isubasinghe October 8, 2025 11:41
@Joibel Joibel merged commit 4d830d3 into argoproj:main Oct 10, 2025
37 checks passed
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 database semaphore config using CLI

4 participants