Skip to content

fix: decide a deployment's own concurrency limit by recorded ID - #432

Open
gaker wants to merge 1 commit into
mainfrom
deployment-limits/ownership
Open

gaker wants to merge 1 commit into
mainfrom
deployment-limits/ownership

Conversation

@gaker

@gaker gaker commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #431

The problem. The operator treated an attached limit named deployment:<id> as the deployment's own concurrency limit. Prefect gives that name to the limit it creates for concurrency_limit, but a user can create a shared limit with the same name. Deleting the PrefectDeployment then deleted that shared limit, because Prefect deletes the limit attached to a deployment it deletes. Removing it from the spec left it attached.

The fix. After a sync that sets concurrencyLimit, the operator records the ID of the limit Prefect created in status.concurrencyLimitId. It clears or rewrites only that limit, and detaches any other limit before deleting the deployment.

A status saved by an earlier operator version has no ID. For those resources, a limit named after the deployment counts as its own if the last sync set concurrencyLimit in status.appliedFields. Prefect limit names are unique, so a shared limit can't have that name while the own limit exists.

The operator records the ID right after the Prefect update, before the schedule sync. A failed sync saves the status too, so the next sync still has the ID.

Rollout caveats

  • no-op: the CRD adds one optional status field. Existing resources record it on their next sync.
Session context

Codex raised this in review of #428. This is the bottom of a three-PR stack: #433 deletes a detached own limit by this ID, and #434 extends the name rule to deployments the operator adopts. Each new test fails with the name-based check restored.

🤖 Generated with Claude Code

The operator treated an attached limit named deployment:<id> as the
deployment's own limit. A shared limit with that name was then deleted
when the PrefectDeployment was deleted, because Prefect deletes the
limit attached to a deployment it deletes.

The operator now records the ID of the limit Prefect creates for
spec.deployment.concurrencyLimit in status.concurrencyLimitId. It clears
or rewrites only that limit and detaches any other. A status saved
before this field existed has no ID. For those, a limit named after the
deployment counts as its own if the last sync set concurrencyLimit.

Related to #431.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gaker
gaker added this pull request to stack #435 December 2, 2026 03:24
@gaker
gaker marked this pull request as ready for review December 2, 2026 03:30
@gaker
gaker requested review from a team as code owners December 2, 2026 03:30

This branch has not been deployed

No deployments
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.

Don't decide concurrency limit ownership from the limit's name

2 participants