Skip to content
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

feat: allow cross-namespace locking for semaphore and mutex #11096

Merged

Conversation

woehrl01
Copy link
Contributor

@woehrl01 woehrl01 commented May 17, 2023

This Pull Request introduces the functionality to specify a namespace for the semaphore configmap references, allowing for locking on shared resources across namespaces.

Motivation

Enhancing the semaphore configuration with a namespace property enables better resource management in environments with shared resources across multiple namespaces.

Modifications

Introduced a namespace property to the semaphore configuration. This property is designed to specify the namespace in which the semaphore configmap resides.

Design choices:

  • The namespace is not directly added to the ConfigMapKeyRef in an attempt to avoid violating the official definition and to prevent potential misunderstandings. This design decision was made to keep the definition of ConfigMapKeyRef as standard and clear as possible.

Verification

Added a unit test

@woehrl01 woehrl01 force-pushed the feat_crossnamespace_semaphore branch from b17f284 to 5d79538 Compare May 17, 2023 12:43
@woehrl01 woehrl01 changed the title feat: allow crossnamespace locking via sempahores feat: allow crossnamespace locking via semaphores May 17, 2023
@woehrl01 woehrl01 force-pushed the feat_crossnamespace_semaphore branch from 5d79538 to 13feff6 Compare May 18, 2023 19:46
@woehrl01 woehrl01 marked this pull request as ready for review May 18, 2023 20:25
@woehrl01 woehrl01 force-pushed the feat_crossnamespace_semaphore branch 2 times, most recently from a82df3e to ab7b89a Compare May 19, 2023 06:47
@woehrl01
Copy link
Contributor Author

@terrytangyuan @jessesuen @alexec highly appreciate your feedback on this. Is there anything missing, to have this merged? Thanks!

@terrytangyuan
Copy link
Member

cc @sarabala1979 @isubasinghe

@woehrl01 woehrl01 changed the title feat: allow crossnamespace locking via semaphores feat: allow cross-namespace locking via semaphores May 26, 2023
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.

Looks good to me. I think this PR should also implement this support for mutexes though.
It would be somewhat odd if semaphores supported this while mutexes didn't.

@isubasinghe
Copy link
Member

The tests pass for me locally, might just be flaky tests, give it a re-run

@woehrl01 woehrl01 force-pushed the feat_crossnamespace_semaphore branch from ab7b89a to abb4f0b Compare May 28, 2023 09:05
@woehrl01 woehrl01 changed the title feat: allow cross-namespace locking via semaphores feat: allow cross-namespace locking for semaphore and mutex May 28, 2023
@woehrl01
Copy link
Contributor Author

Thanks for your feedback @isubasinghe I just added the namespace for mutex, too.

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.

No worries @woehrl01, I am just undecided if "Namespace is the namespace of the configmap ..." is okay for the mutex.
I mean technically the mutex is backed by a configmap so it is technically correct.

I'm going to approve and leave that to the discretion of yourself and @terrytangyuan

@woehrl01
Copy link
Contributor Author

Yes, you're right, I rephrase the comment. Thank you!

@woehrl01 woehrl01 force-pushed the feat_crossnamespace_semaphore branch from abb4f0b to 4e526ea Compare May 30, 2023 08:05
@@ -2468,6 +2468,7 @@ than the MaxAge, it will be ignored. | |
| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| name | string| `string` | | | name of the mutex | |
| namespace | string| `string` | | `"namespace of workflow)"`| | |
Copy link
Member

Choose a reason for hiding this comment

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

fix default here

@@ -4229,6 +4230,7 @@ Note that this field cannot be set when spec.os.name is windows.
| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| configMapKeyRef | [ConfigMapKeySelector](#config-map-key-selector)| `ConfigMapKeySelector` | | | | |
| namespace | string| `string` | | `"namespace of workflow)"`| | |
Copy link
Member

@isubasinghe isubasinghe May 30, 2023

Choose a reason for hiding this comment

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

also here, there is a right paren and its inside `` and "".
Should just be:
namespace of workflow

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.

typo in docs, I made two comments

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.

Apoligies: meant to request changes not comment, see previous comment.

Signed-off-by: Lukas Wöhrl <lukas.woehrl@plentymarkets.com>
@woehrl01 woehrl01 force-pushed the feat_crossnamespace_semaphore branch from 4e526ea to a2038a7 Compare May 30, 2023 09:53
@woehrl01
Copy link
Contributor Author

Just renamed the default again and put it in brackets to be more visible of a "variable" argument. Unfortunately, I can't remove the quotes, they are added automatically. Alternative would be to put the default into the description, but I'm not a fan of that either.

@isubasinghe
Copy link
Member

Thanks for the changes @woehrl01

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.

LGTM

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

This would be great enhancement. Thanks!

@terrytangyuan terrytangyuan merged commit c9ebf42 into argoproj:master May 31, 2023
@woehrl01 woehrl01 deleted the feat_crossnamespace_semaphore branch May 31, 2023 21:34
JPZ13 pushed a commit to pipekit/argo-workflows that referenced this pull request Jul 4, 2023
jeremyhager pushed a commit to jeremyhager/argo-workflows that referenced this pull request Jul 7, 2023
…#11096)

Signed-off-by: Jeremy Hager <47301461+jeremyhager@users.noreply.github.com>
woehrl01 added a commit to woehrl01/argo-workflows that referenced this pull request Jul 20, 2023
…#11096)

Signed-off-by: Lukas Wöhrl <lukas.woehrl@plentymarkets.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants