Skip to content

feat(operator): pod management - #359

Open
bmcquilkin-sentry wants to merge 1 commit into
mainfrom
pod-management-v2
Open

feat(operator): pod management#359
bmcquilkin-sentry wants to merge 1 commit into
mainfrom
pod-management-v2

Conversation

@bmcquilkin-sentry

Copy link
Copy Markdown
Contributor

No description provided.

@bmcquilkin-sentry
bmcquilkin-sentry requested a review from a team as a code owner July 29, 2026 23:27
Comment thread sentry_streams_k8s/sentry_streams_k8s/operator/reconcile.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bafc46f. Configure here.

workload_namespace=_workload_namespace(),
prune_stale_configmaps,
core=core,
workload_namespace=workload_namespace,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cleanup orphans stuck pods

Medium Severity

delete_owned_pods skips pods that already have a deletionTimestamp and never force-deletes or waits for termination. Pipeline pods have no owner references, so once cleanup finishes and the finalizer is removed, stuck terminating pods are orphaned with nothing left to reclaim them.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bafc46f. Configure here.

else:
raise kopf.PermanentError(f"Cannot apply unsupported manifest kind {kind}.")
pod_set_results[workload_set] = set_result
generations_by_set[workload_set] = generations

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Partial reconcile then permanent stop

Medium Severity

Workload-set validation runs inside the per-set reconcile loop after earlier sets may already have been mutated. A later PermanentError (for example canary base name over MAX_BASE_NAME_LENGTH) skips status updates and returns no retry timeout, so the daemon waits indefinitely with partial cluster changes and stale status.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bafc46f. Configure here.

@bmcquilkin-sentry
bmcquilkin-sentry force-pushed the bmcquilkin/operator/pod-resources branch from a5d6943 to 4b42ad7 Compare July 31, 2026 18:11
Base automatically changed from bmcquilkin/operator/pod-resources to bmcquilkin/operator/daemon-reconcile July 31, 2026 18:17
@bmcquilkin-sentry
bmcquilkin-sentry changed the base branch from bmcquilkin/operator/daemon-reconcile to main July 31, 2026 18:18
Comment on lines +169 to +170
return {}
return {int(ordinal): generation for ordinal, generation in data.items()}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The _parse_generations function does not ensure that generation values are integers, which can lead to a TypeError during reconciliation if the CR status contains non-integer data.
Severity: MEDIUM

Suggested Fix

In the _parse_generations function, explicitly cast the generation value to an integer within the dictionary comprehension to enforce the dict[int, int] return type. The line should be changed to return {int(ordinal): int(generation) for ordinal, generation in data.items()}.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: sentry_streams_k8s/sentry_streams_k8s/operator/reconcile.py#L169-L170

Potential issue: The function `_parse_generations` is annotated to return a `dict[int,
int]`, but it only converts the dictionary keys to integers, not the values. The
generation values are used as-is from the input data, which is read from the Kubernetes
Custom Resource status. If the status contains non-integer generation values (due to
manual edits, data corruption, or changes between operator versions), this function will
return a dictionary with non-integer values. This incorrect data type is then passed to
`_allocate_generation`, where a call to `max()` will raise a `TypeError` when comparing
a non-integer with an integer, causing the reconciliation process to fail.

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.

1 participant