Skip to content

Add a new annotation to temporarily bypass synk.#782

Merged
ensonic merged 1 commit into
mainfrom
ensonic/synk
Jul 6, 2026
Merged

Add a new annotation to temporarily bypass synk.#782
ensonic merged 1 commit into
mainfrom
ensonic/synk

Conversation

@ensonic

@ensonic ensonic commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This allows for a kubectl edit based workflow to make temporary changes, e.g. enable memory profiling.

@ensonic ensonic requested review from csieber and therjak July 6, 2026 11:53
Comment thread src/go/pkg/synk/synk.go
}

if current.GetAnnotations()[AnnotationIgnore] == "true" {
setOwnerRef(current, set)

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.

where does setOwnerRef get called without the annotation? I only see a comment in line 800. shouldn't is get updated not matter the annotation?

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.

Added a comment to clarify. We're already calling setOwnerRef in applyAll. But here we're reverting to the current version.

Would it be easier to read if we return some extra flag and do the change one level up?

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.

it would be ugly as well but it would prevent inconsistent behavior. I see 3 places calling 'applyOne' but only for one I directly see the setOwnerRef call. (another passes nil as owner, so that one hopefully just does nothing and not remove an owner). but the first one in applyAll is unclear.

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.

The call chain is Apply -> applyAll -> applyOne

  • applyAll calls setOwnerRef to point it to the new one
  • applyOne calls setOwnerRef to revert that in thes code path

Options:

  1. submit as it is
  2. move setOwnerRef() call from applyAll to applyOne
  3. return something from applyOne and move the special case setOwnerRef call to applyAll

I think given the comment 1) is okay. 2) might also be okay. 3) is ugly.

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.

I'd leave the asymmetry for now, but I've handled all cases. I'll see if I can refactor the code next. If you prefer, I can do (2) .

This allows for a `kubectl edit` based workflow to make temporary changes, e.g.
enable memory profiling.
@ensonic ensonic enabled auto-merge (squash) July 6, 2026 17:10
@ensonic ensonic merged commit 8dfb948 into main Jul 6, 2026
7 checks passed
@ensonic ensonic deleted the ensonic/synk branch July 6, 2026 17:15
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