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

docs: add mutex improvement proposal #10191

Closed
wants to merge 11 commits into from

Conversation

isubasinghe
Copy link
Member

@isubasinghe isubasinghe commented Dec 8, 2022

Related to #8684

Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
@stale

This comment was marked as resolved.

@stale stale bot added the problem/stale This has not had a response in some time label Dec 31, 2022
@sarabala1979
Copy link
Member

@isubasinghe Can you present in the contributor meeting? We can discuss

@stale stale bot removed the problem/stale This has not had a response in some time label Jan 7, 2023
@isubasinghe isubasinghe marked this pull request as ready for review January 11, 2023 21:41
@isubasinghe
Copy link
Member Author

update: Discussed with @sarabala1979 what the next steps are for this. Bala mentioned to try replace the getResourceKey with getHolderKey. I thought during the meeting this would work as well, looking into that again this will not work without changing some data in one of the structs.

@sarabala1979 could you also please clarify here why we can't go with the config map approach? I believe it was about push back regarding introducing another resource?

The next steps for this would be to go with modifying the format of the key in the MutexHolding struct. @sarabala1979 with your okay, I will proceed with this fix.

@stale

This comment was marked as resolved.

@stale stale bot added the problem/stale This has not had a response in some time label Mar 25, 2023
@caelan-io caelan-io removed the problem/stale This has not had a response in some time label Mar 27, 2023
@stale

This comment was marked as resolved.

@stale stale bot added the problem/stale This has not had a response in some time label May 21, 2023
@isubasinghe

This comment was marked as resolved.

@stale stale bot removed the problem/stale This has not had a response in some time label May 25, 2023
@isubasinghe isubasinghe requested a review from juliev0 May 25, 2023 12:31
@isubasinghe
Copy link
Member Author

isubasinghe commented May 25, 2023

Hey @juliev0 or @terrytangyuan could you please give me some feedback on this if you have any time available? Mutexes have been broken since they were implemented. I have a partial solution here: #10009.

But I need to know if I can go ahead with this approach before continuing to invest more time/money in it.

Thanks!

TL;DR -> store a couple more mutex related information in config maps

@terrytangyuan
Copy link
Member

I haven't got a chance to look into details yet but would this be a breaking change for current users who rely on mutexes?

@isubasinghe
Copy link
Member Author

@terrytangyuan it shouldn't change anything for users, it will introduce an additional config map where mutex related data is stored.


#### Store holding/pending information in a config map

We can store the holder keys inside a config map, on release, we refer to the holder keys inside this config map. There is an existing WIP PR for this, [here](https://github.com/argoproj/argo-workflows/pull/10009).
Copy link
Member

Choose a reason for hiding this comment

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

Do you think there is a security concern in multi-tenant env? If Controller updates the holder on Configmap, The controller should have cluster-level RBAC to update the config map across the namespace.


### Solutions

#### Store the holder key directly in the MutexStatus/SemaphoreStatus structs
Copy link
Member

Choose a reason for hiding this comment

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

How will these solutions form the holder keys? Will it use string format?
Can you provide the sample yaml how it will look?


* Changing a field could be major change and might break projects in the ecosystem that rely on this behavior. This has been the behavior of mutexes ever since they have been implemented, it is high risk to change this in my opinion.

#### Store holding/pending information in a config map
Copy link
Member

Choose a reason for hiding this comment

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

Can you add sample configmap content?

* The change in behavior is transparent to users.
* Existing PR should allow for us to be quite quick in pushing a fix.

##### Disadvantages of solution #2
Copy link
Member

Choose a reason for hiding this comment

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

how can we handle if holder information crosses the 1MB limit on configmap?

@stale

This comment was marked as resolved.

@stale stale bot added the problem/stale This has not had a response in some time label Jun 18, 2023
@JPZ13

This comment was marked as resolved.

@stale stale bot removed the problem/stale This has not had a response in some time label Jun 21, 2023
@stale

This comment was marked as resolved.

@stale stale bot added the problem/stale This has not had a response in some time label Aug 12, 2023
@Bwvolleyball
Copy link

This issue still feels relevant, right?

@stale stale bot removed the problem/stale This has not had a response in some time label Aug 24, 2023
Copy link
Member

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

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

some formatting changes below that make the rendered version a good bit easier to read

docs/proposals/mutex-improvements.md Outdated Show resolved Hide resolved
docs/proposals/mutex-improvements.md Outdated Show resolved Hide resolved
docs/proposals/mutex-improvements.md Outdated Show resolved Hide resolved
docs/proposals/mutex-improvements.md Outdated Show resolved Hide resolved
docs/proposals/mutex-improvements.md Outdated Show resolved Hide resolved
docs/proposals/mutex-improvements.md Outdated Show resolved Hide resolved
Comment on lines +223 to +227
MutexStatus
SemaphoreStatus
structs
mutexes
ConfigMap
Copy link
Member

Choose a reason for hiding this comment

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

this file is roughly alphabetical.

MutexStatus and SempahoreStatus could be written with backticks which would no longer be spell checked


##### Disadvantages of solution #1

* Changing a field could be major change and might break projects in the ecosystem that rely on this behavior. This has been the behavior of mutexes ever since they have been implemented, it is high risk to change this in my opinion.
Copy link
Member

Choose a reason for hiding this comment

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

Does this change a field on the CR itself? Or just the internal structs?

If it is just internal structs, a restart of the controller should get everything into the new format.

If it is on the CR, perhaps there could be a in-between option -- a struct that is encoded into a string?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it is just internal structs unfortunately, it gets serialised into json and protobufs hence why I assumed there might be some usage here from the outside world.

Look, honestly seems very unlikely though, think we can probably just change the struct. Chucking everything in a ConfigMap would keep things consistent between different versions.

I am open to just changing the struct. This is basically an RFC to get some idea of what to do.

Copy link
Member

@agilgur5 agilgur5 May 4, 2024

Choose a reason for hiding this comment

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

Now that I'm more familiar with the Controller, I believe this impacts the status.synchronization field on the CR. We technically can't change the CRD without a breaking version change (e.g. v1alpha1 -> v1alpha2 or similar).

We can add fields though, as we do quite often already. So perhaps we deprecate the existing fields and only use the new fields moving forward. In either manner, we would need to ensure backward-compat with older Workflows that used the old format.

I think that would mitigate the breaking change part and not have the drawbacks of additional ConfigMaps

isubasinghe and others added 6 commits September 13, 2023 08:29
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
Co-authored-by: Anton Gilgur <4970083+agilgur5@users.noreply.github.com>
Signed-off-by: Isitha Subasinghe <isitha@pipekit.io>
@isubasinghe
Copy link
Member Author

closed thanks to #13553

@isubasinghe isubasinghe closed this Oct 8, 2024
@agilgur5 agilgur5 added the solution/superseded This PR or issue has been superseded by another one (slightly different from a duplicate) label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mutex-semaphore solution/superseded This PR or issue has been superseded by another one (slightly different from a duplicate)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants