Skip to content

Add SSA condition helpers: ConditionsFromStatus and SetApplyConfigurationStatusCondition#326

Closed
fwiesel wants to merge 1 commit into
mainfrom
shared-conditions-helpers
Closed

Add SSA condition helpers: ConditionsFromStatus and SetApplyConfigurationStatusCondition#326
fwiesel wants to merge 1 commit into
mainfrom
shared-conditions-helpers

Conversation

@fwiesel

@fwiesel fwiesel commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Introduces two helpers in internal/utils/conditions.go needed by controllers that manage status via Server-Side Apply:

  • ConditionsFromStatus: converts []metav1.Condition to the apply-config slice, preserving ObservedGeneration on each entry (the taint controller's skip-check gates on it).
  • SetApplyConfigurationStatusCondition: upserts a condition entry; guards against nil/empty Type to prevent panics; propagates ObservedGeneration when updating an existing entry.

Full unit-test coverage in conditions_test.go.

Prerequisite for: ssa and rework-onboarding.

Introduces two helpers used by controllers that apply status via SSA:

- ConditionsFromStatus: converts []metav1.Condition to the apply-config
  slice form, preserving ObservedGeneration on each entry so that the
  taint controller's skip-check (which gates on ObservedGeneration) does
  not silently regress.

- SetApplyConfigurationStatusCondition: upserts a condition entry.
  Guards against nil/empty Type to prevent a panic when a caller omits
  the Type field. Propagates ObservedGeneration when updating an
  existing entry, not just on insert.

Both helpers have full unit-test coverage in conditions_test.go.
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0858e0f7-3d50-46a6-866c-af0749c0cfab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shared-conditions-helpers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/utils 80.95% (+7.62%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/utils/conditions.go 83.33% (+83.33%) 48 (+48) 40 (+40) 8 (+8) 🌟

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/utils/conditions_test.go

@fwiesel

fwiesel commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

The helpers have been folded into the ssa branch directly (#302). The branch is no longer needed.

@fwiesel fwiesel closed this Jul 8, 2026
@fwiesel fwiesel deleted the shared-conditions-helpers branch July 8, 2026 14:29
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