Skip to content

chore: enrich InstanceSet instance status - #10758

Draft
leon-ape wants to merge 4 commits into
mainfrom
support/richer-its-instance-status
Draft

chore: enrich InstanceSet instance status#10758
leon-ape wants to merge 4 commits into
mainfrom
support/richer-its-instance-status

Conversation

@leon-ape

@leon-ape leon-ape commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • extend InstanceSet.status.instanceStatus with authoritative template, desired-state, and current-state fields
  • use the consistent API types InstanceDesiredState and InstanceCurrentState
  • retain PodName as the stable instance identity and unique list key
  • merge status entries by stable PodName for both ITS and ITS2, retaining Active/Offline identities while bounding Released cleanup
  • have the Instance controller maintain Instance.status.currentState; ITS2 reads and watches Instance objects only
  • keep legacy ITS observing its directly managed Pods while publishing the same InstanceStatus semantics
  • add InstanceStatusObservedGeneration, advanced atomically with a successfully built complete instance view
  • preserve legacy runtime consumers through ActiveRunningInstanceStatuses, while excluding Offline/Released entries
  • treat temporary partial flat-ordinal reallocations as non-publishable but non-blocking, allowing revision/alignment to converge
  • regenerate deepcopy, Instance/InstanceSet CRDs, Helm CRDs, and API reference docs

Why

The previous producers rebuilt the list from currently visible runtime objects. That lost allocated identities when instances were absent or intentionally offline, could not reliably preserve template assignments with flat ordinals, and could not distinguish whether the richer instance view had been published for an existing generation.

For ITS2, Pod lifecycle is owned by the Instance controller. The InstanceSet controller therefore consumes the current state reported by Instance and does not load or watch Pods directly.

Legacy InstanceStatus entries have an empty CurrentState. The strict effective state remains Unknown, while runtime consumers use a compatibility view that accepts legacy Active entries and explicit Active+Present entries only.

Flat ordinal reassignment may temporarily return a partial allocation while old names are being released. The controller preserves the last complete instance view and its observed generation during that phase, but continues revision and alignment so the allocation can converge.

Validation

  • make generate
  • make manifests
  • make doc
  • go test ./apis/workloads/v1 ./pkg/controller/instance ./pkg/controller/instancesetstatus ./pkg/controller/instanceset ./pkg/controller/instanceset2
  • go test -p=1 ./pkg/controller/component ./controllers/parameters/reconfigure ./controllers/apps/component
  • focused KUBEBUILDER_ASSETS=... go test ./controllers/workloads -run TestAPIs -ginkgo.focus='InstanceSet Controller'
  • focused go vet

@apecloud-bot

Copy link
Copy Markdown
Collaborator

Auto Cherry-pick Instructions

Usage:
  - /nopick: Not auto cherry-pick when PR merged.
  - /pick: release-x.x [release-x.x]: Auto cherry-pick to the specified branch when PR merged.

Example:
  - /nopick
  - /pick release-1.1

CLA Recheck Instructions

Usage:
  - /recheck-cla: Trigger a re-check of CLA status for this pull request.
Example:
  - /recheck-cla

@github-actions github-actions Bot added the size/XXL Denotes a PR that changes 1000+ lines. label Aug 10, 2026
@leon-ape leon-ape added the nopick Not auto cherry-pick when PR merged label Aug 10, 2026
@leon-ape leon-ape changed the title [codex] enrich InstanceSet instance status chore: enrich InstanceSet instance status Aug 10, 2026
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.82192% with 258 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.86%. Comparing base (9ee2a73) to head (2899d47).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
apis/workloads/v1/instanceset_types.go 0.00% 72 Missing ⚠️
pkg/controller/instancesetstatus/allocation.go 43.96% 51 Missing and 14 partials ⚠️
pkg/controller/instancesetstatus/merge.go 72.04% 31 Missing and 14 partials ⚠️
pkg/controller/instanceset2/reconciler_status.go 64.77% 24 Missing and 7 partials ⚠️
pkg/controller/instanceset/reconciler_status.go 69.04% 19 Missing and 7 partials ⚠️
pkg/testutil/k8s/instance_set_util.go 0.00% 6 Missing ⚠️
...kg/testutil/apps/cluster_instance_set_test_util.go 0.00% 5 Missing ⚠️
...ontroller/instancetemplate/name_builder_default.go 0.00% 2 Missing and 1 partial ⚠️
...g/controller/instancetemplate/name_builder_flat.go 0.00% 2 Missing and 1 partial ⚠️
pkg/controller/instanceset/update_plan.go 0.00% 0 Missing and 1 partial ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10758      +/-   ##
==========================================
+ Coverage   64.56%   64.86%   +0.30%     
==========================================
  Files         521      507      -14     
  Lines       63343    63662     +319     
==========================================
+ Hits        40897    41294     +397     
+ Misses      18804    18656     -148     
- Partials     3642     3712      +70     
Flag Coverage Δ
unittests 64.86% <55.82%> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nopick Not auto cherry-pick when PR merged size/XXL Denotes a PR that changes 1000+ lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants