Skip to content

feat(tracker): add resource tracker framework and Deployment tracker … - #403

Draft
ljluestc wants to merge 1 commit into
werf:mainfrom
ljluestc:feat/285-rework-deployment-tracker
Draft

ljluestc wants to merge 1 commit into
werf:mainfrom
ljluestc:feat/285-rework-deployment-tracker

Conversation

@ljluestc

Copy link
Copy Markdown

…on it

Every tracker in pkg/tracker repeats the same informer boilerplate and state machine, and mixes status reporting with presentation (status indicators), which makes them hard to maintain and new trackers costly to add.

This is the first step of the rework:

  • pkg/tracker/resource: a framework for resource trackers. Watch subscribes to typed objects of any resource through the shared dynamic informers, filtered by name, namespace and label selector, and reports a Synced event once the initial objects are delivered. NextState is the lifecycle state machine shared by all trackers.
  • pkg/tracker/resource/deployment: a Deployment tracker built on the framework. It reports presentation-free events through a single ordered channel. Pods are watched once the ReplicaSets have synced instead of after a fixed 1.5s sleep, so they are reliably told new from old.
  • LegacyTracker adapts the new tracker to the channels of the old Deployment tracker; status indicators are built in the adapter. The old tracker's channels are extracted into deployment.Feed so that dyntracker can drive either tracker. The new tracker is opt-in with KUBEDOG_EXPERIMENTAL_DEPLOYMENT_TRACKER=1.

Refs #285

…on it

Every tracker in pkg/tracker repeats the same informer boilerplate and
state machine, and mixes status reporting with presentation (status
indicators), which makes them hard to maintain and new trackers costly
to add.

This is the first step of the rework:

* pkg/tracker/resource: a framework for resource trackers. Watch
  subscribes to typed objects of any resource through the shared
  dynamic informers, filtered by name, namespace and label selector,
  and reports a Synced event once the initial objects are delivered.
  NextState is the lifecycle state machine shared by all trackers.
* pkg/tracker/resource/deployment: a Deployment tracker built on the
  framework. It reports presentation-free events through a single
  ordered channel. Pods are watched once the ReplicaSets have synced
  instead of after a fixed 1.5s sleep, so they are reliably told
  new from old.
* LegacyTracker adapts the new tracker to the channels of the old
  Deployment tracker; status indicators are built in the adapter. The
  old tracker's channels are extracted into deployment.Feed so that
  dyntracker can drive either tracker. The new tracker is opt-in with
  KUBEDOG_EXPERIMENTAL_DEPLOYMENT_TRACKER=1.

Refs werf#285
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