Repository navigation
fix: skip resources with unparsable trap annotations instead of failing - #66
Merged
mariotrace merged 2 commits intoSep 4, 2026
Merged
Conversation
mariotrace
requested changes
Sep 1, 2026
| // Resources whose annotation cannot be parsed are skipped, because we list all pods and deployments | ||
| // in the cluster here, and anyone who can annotate a single resource would otherwise stop the | ||
| // reconciliation of every DeceptionPolicy, including the clean-up that removes their finalizers. | ||
| func GetAnnotatedResources(r client.Reader, ctx context.Context, crdName string) ([]client.Object, error) { |
Member
There was a problem hiding this comment.
Good targeted fix, thanks! Could you make the comment less verbose possibly, please, e.g.
// GetAnnotatedResources returns a list of resources that have been annotated with a specific DeceptionPolicy.
// Resources whose annotation cannot be parsed are skipped.
Reason is that the upstream errors in the reconciliation loop are the problem of the caller, not something that we should document here (and that eventually gets outdated easily).
Contributor
Author
There was a problem hiding this comment.
shortened to your version, thanks!
knQzx
force-pushed
the
fix/skip-unparsable-annotations
branch
from
September 3, 2026 22:03
4edb5f6 to
e10a7c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetAnnotatedResourceslists every pod and deployment in the cluster and gives up on the first one whosekoney/changesannotation does not parse:nothing filters, quarantines or skips the bad object, so a single unrelated resource takes the whole listing down
a pod with
koney/changes: "-", set by anyone who can create a pod in any namespace, by a GitOps template or by a hand edit, then has cluster-wide effect:no traps are deployed or updated anymore - every reconcile of every
DeceptionPolicyrunscleanupRemovedTrapsfirst and returns early on the errorpolicies cannot be deleted -
cleanupDeceptionPolicyfails the same way, the finalizer is never removed and the object stays inTerminatingforeverthe annotation is koney bookkeeping rather than a user-facing API, and closed issue #12 already treats annotation-parsing brittleness as a bug, so failing closed on someone else's broken value looks unintended
this logs and skips resources whose annotation cannot be read, which also lets the clean-up path finish and release the finalizer. added tests for a valid resource, a broken one next to a valid one, and a lone broken one