Skip to content

ARTEMIS-6046 Kubernetes LockManager implementation#6409

Open
clebertsuconic wants to merge 1 commit into
apache:mainfrom
clebertsuconic:kube-lock
Open

ARTEMIS-6046 Kubernetes LockManager implementation#6409
clebertsuconic wants to merge 1 commit into
apache:mainfrom
clebertsuconic:kube-lock

Conversation

@clebertsuconic

@clebertsuconic clebertsuconic commented May 1, 2026

Copy link
Copy Markdown
Contributor
This commit introduces a Kubernetes-based distributed lock implementation using a generic HTTP REST client abstracted from KubernetesLoginModule.

Key changes:
- Extracted reusable Kubernetes HTTP client to artemis-commons
- Implemented KubernetesLockManager using Kubernetes Lease API
- Implemented KubeMutableLong using Kubernetes ConfigMap for distributed counters
- Moved PemSupport and extracted KeyStoreSupport to artemis-commons to avoid circular dependencies
- Added AbstractDistributedLockManager base class with parameter validation
- Added tests using LockCoordinatorTest against real Kubernetes (via Minikube) and FakeMinikube MockServer
- Added user manual documentation with RBAC configuration examples
- Added smoke test configurations for Kubernetes-based dual-mirror setup

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@clebertsuconic clebertsuconic marked this pull request as draft May 1, 2026 23:34
@clebertsuconic clebertsuconic force-pushed the kube-lock branch 2 times, most recently from c557799 to 361bcf9 Compare May 2, 2026 00:10
@clebertsuconic clebertsuconic marked this pull request as ready for review May 2, 2026 00:10
@clebertsuconic clebertsuconic force-pushed the kube-lock branch 4 times, most recently from 2345717 to de9eeb9 Compare May 4, 2026 20:58

@gtully gtully left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is great, but I think we need to reduce the dependencies, with cve's popping up all over the place, we need to be reducing our surface area dependencies as much as possible.

Peek at the http client in the oidcloginmodule for inspiration, or the token review calls in the kubelogin module.
see: 98b24f02ae#diff-c0c7084d3381d18956a831a896c9124b9636a297630fa138513d3fc720560f45

@clebertsuconic

Copy link
Copy Markdown
Contributor Author

I will try. There are date operations here that are not easy to manage.

@gemmellr

gemmellr commented May 6, 2026

Copy link
Copy Markdown
Member

Mostly havent looked at this, but would follow Gary's comment on the deps/shading-thereof, seem horrid, as likely could be maintaining the shading going forward (and the 12 seconds it takes isnt ideal either). With all the deps (at least some of which seem like dupes) I'd guess its not tiny either, so if its large I'm not necessarily seeing it as obvious we should add it to the distribution.

I cant comment on the actual lines, as GitHub is having an outage preventing new code comments on PRs lol, but...

The bom changes are broken. The entries are in the relocations/old-modules section of the bom, and as brand new modules these ones would not be expected to have any relocations (indeed you didnt add any, so the GAVs listed there wont ever exist and are just junk entries, which can break things inspecting them). As the only changes to the bom that also means that there are no bom entries for the actual module GAVs either, which means you must have have put the version fields in place elsewhere in the build instead of relying on the bom-managed entries (doing which would point out that the bom is currently broken).

@clebertsuconic

Copy link
Copy Markdown
Contributor Author

@gemmellr I will see if I can connect directly to REST bits..

The kubernetes client has a few dependencies. and that's I am bringing.

I could also "fork" the code for what I need.. since all the kubernetes client does on this is to execute rest calls. The difficult part here is the dates operation and initial certificate validation.

Let me see what I can do and i will come back here.

@clebertsuconic clebertsuconic marked this pull request as draft May 7, 2026 00:37
@clebertsuconic clebertsuconic force-pushed the kube-lock branch 6 times, most recently from 0390a9d to e0fc2b2 Compare June 6, 2026 16:58
@clebertsuconic clebertsuconic force-pushed the kube-lock branch 8 times, most recently from d67a963 to dc8faa6 Compare June 18, 2026 01:10
@clebertsuconic clebertsuconic marked this pull request as ready for review June 18, 2026 01:15
@clebertsuconic

Copy link
Copy Markdown
Contributor Author

@gtully / @gemmellr I have reworked this by not requiring Kubenetes-client.jar. I have refactored the log-in module and extracted a generic Kubernetes Rest client I'm reusing the Lock Manager. I also implemented a fake server lock and the tests can also work against a real server.

@clebertsuconic clebertsuconic force-pushed the kube-lock branch 6 times, most recently from 51f4d4c to 78eaf1b Compare June 18, 2026 03:10
@clebertsuconic clebertsuconic force-pushed the kube-lock branch 3 times, most recently from 741d125 to b7997cb Compare June 18, 2026 15:19
}

public static JsonObject createLease(String namespace, String id, String holderIdentity, String acquireTime, String renewTime, int leaseDurationSeconds) throws Exception {
String renewLeaseJson = buildLease(id, namespace, null, holderIdentity, acquireTime, renewTime, leaseDurationSeconds);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

rename variable as newLeas (not renewLease)

@clebertsuconic clebertsuconic force-pushed the kube-lock branch 9 times, most recently from efcecb1 to af861a8 Compare June 18, 2026 17:54
This commit introduces a Kubernetes-based distributed lock implementation using a generic HTTP REST client abstracted from KubernetesLoginModule.

Key changes:
- Extracted reusable Kubernetes HTTP client to artemis-commons
- Implemented KubernetesLockManager using Kubernetes Lease API
- Implemented KubeMutableLong using Kubernetes ConfigMap for distributed counters
- Moved PemSupport and extracted KeyStoreSupport to artemis-commons to avoid circular dependencies
- Added AbstractDistributedLockManager base class with parameter validation
- Added tests using LockCoordinatorTest against real Kubernetes (via Minikube) and FakeMinikube MockServer
- Added user manual documentation with RBAC configuration examples
- Added smoke test configurations for Kubernetes-based dual-mirror setup

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.

3 participants