Registry Mirror
Skip to content

Conversation

@fuldaxxx

@fuldaxxx fuldaxxx commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Description

  • MonitorConfig gets a KeepManagedFields option (default false). The option is part of FactoryIndex, so a monitor with it gets its own informer and never shares one with monitors of the same resource that do not set it.
  • For such a monitor the transform set with FactoryStore.WithTransform still runs, but metadata.managedFields is put back after it, both for watch events in the informer and for the initial list in transformObject. Everything else the transform drops stays dropped.
  • Without the option nothing changes: its zero value keeps the existing factory keys, so informers are shared as before. With the option set the monitor gets a separate informer even when no transform is configured.
  • Cost: one more LIST+WATCH and a second cache for each resource and selector set that a flagged monitor watches.
  • Tested with TestFactoryStore_KeepManagedFields: two monitors on one resource, with and without the option, give two factories, and only the flagged one sees managedFields in the initial list and in watch events. The test fails without the change. go test -race ./pkg/kube_events_manager/, go test ./pkg/... and golangci-lint pass.

Why do we need it, and what problem does it solve?

WithTransform (#962, backported in #967) lets an embedding application shrink the objects that informers cache. Deckhouse uses it to drop metadata.managedFields from every hook informer (Deckhouse v1.76.18). Some hooks filter on managedFields: the node-manager hook force_machine_deployment_replicas_ownership picks MachineDeployments by the field manager that owns spec.replicas. With the field stripped before the filter runs, the hook saw no owner and did nothing. During the Deckhouse update from 1.75 to 1.76.18, nelm then pruned spec.replicas, and node groups were scaled to zero and recreated.

The option lets such a monitor keep managedFields while every other monitor keeps the memory savings. It needs a separate informer because informers are shared per FactoryIndex: turning the transform off on a shared informer would hand full objects to every monitor of that resource.

Why do we need it in the patch release (if we do)?

Deckhouse 1.76 is built on the shell-operator v1.17 line, and the node-manager fix in Deckhouse release-1.76 needs this option. Clusters on Deckhouse 1.75 update straight to the latest 1.76 patch, so each of them with such MachineDeployments loses those node groups during the update until the fix is released.

Signed-off-by: Ruslan Gorbunov <ruslan.gorbunov@flant.com>
@fuldaxxx
fuldaxxx requested a review from ldmonster November 27, 2026 14:20
@fuldaxxx fuldaxxx self-assigned this Nov 30, 2026
@fuldaxxx fuldaxxx added the bug Something isn't working label Nov 30, 2026
@fuldaxxx fuldaxxx changed the title fix: preserve managed fields for selected monitors [shell-operator] fix: preserve managed fields for selected monitors Nov 30, 2026
@fuldaxxx
fuldaxxx marked this pull request as ready for review November 30, 2026 10:08
@fuldaxxx fuldaxxx closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant