Skip to content

[Misc] subscription: maxSubscriptions amended - #572

Merged
Pavan-SAP merged 1 commit into
mainfrom
maxSubs
Nov 13, 2026
Merged

Pavan-SAP merged 1 commit into
mainfrom
maxSubs

Conversation

@Pavan-SAP

@Pavan-SAP Pavan-SAP commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Use mutex locks to ensure maxSubscriptions is properly managed:
appLocks sync.Map to SubscriptionHandler and a lockApp(appIdHash) helper
that lazily creates and acquires a per-application mutex (different
apps never block each other).

Note:
Cross-replica caveat & follow-up (not implemented here). The mutex
coordinates requests within one pod only.
subscriptionServer.replicas is configurable (default 1);
with >1 replica, pods can still interleave List/Create and overshoot
the limit. Strict cross-replica enforcement would use a per-app
distributed lock via a coordination.k8s.io/v1 Lease
(capop-sublimit-): acquire by Get→Create-if-absent /
take-if-expired-or-ours via Update with resourceVersion (409-retry),
holderIdentity from a POD_NAME env var, leaseDurationSeconds tuned
above a single Create but short enough to bound stall on holder crash,
release by Update/Delete. This needs leases RBAC added to the
subscription-server Role in the cap-operator-lifecycle Helm chart
(cross-repo).
Recommended interim guidance: run the subscription server with a single
replica for strict enforcement.

@anirudhprasad-sap anirudhprasad-sap 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.

👍

Use mutex locks to ensure maxSubscriptions is properly managed:
appLocks sync.Map to SubscriptionHandler and a lockApp(appIdHash) helper
 that lazily creates and acquires a per-application mutex (different
 apps never block each other).

*Note:*
Cross-replica caveat & follow-up (not implemented here). The mutex
coordinates requests within one pod only.
subscriptionServer.replicas is configurable (default 1);
with >1 replica, pods can still interleave List/Create and overshoot
the limit. Strict cross-replica enforcement would use a per-app
distributed lock via a coordination.k8s.io/v1 Lease
(capop-sublimit-<appIdHash>): acquire by Get→Create-if-absent /
take-if-expired-or-ours via Update with resourceVersion (409-retry),
holderIdentity from a POD_NAME env var, leaseDurationSeconds tuned
above a single Create but short enough to bound stall on holder crash,
release by Update/Delete. This needs leases RBAC added to the
subscription-server Role in the cap-operator-lifecycle Helm chart
(cross-repo).
Recommended interim guidance: run the subscription server with a single
replica for strict enforcement.
@Pavan-SAP Pavan-SAP added build-pr-images Set this label on PRs to build docker images for changes and removed build-pr-images Set this label on PRs to build docker images for changes labels Nov 13, 2026
@Pavan-SAP
Pavan-SAP deployed to cap-op-internal November 13, 2026 09:51 — with GitHub Actions Active
@Pavan-SAP
Pavan-SAP deployed to cap-op-internal November 13, 2026 09:51 — with GitHub Actions Active
@Pavan-SAP
Pavan-SAP deployed to cap-op-internal November 13, 2026 09:51 — with GitHub Actions Active
@sonarqubecloud

Copy link
Copy Markdown

@anirudhprasad-sap anirudhprasad-sap 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.

👍

@Pavan-SAP
Pavan-SAP merged commit 179c1b8 into main Nov 13, 2026
13 checks passed
@Pavan-SAP
Pavan-SAP deleted the maxSubs branch November 13, 2026 10:17

This branch was successfully deployed

2 active deployments
build — ab44b2c8 Deployed Nov 13, 2026 by Pavan-SAP via Analyze with Sonar Cloud #1815
cap-op-internal — ab44b2c8 Deployed Nov 13, 2026 by Pavan-SAP via build-on-label (server) #238
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-pr-images Set this label on PRs to build docker images for changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants