Skip to content

feat(chaos): integrate operator-chaos shift-left validation for L1-L3 maturity - #525

Merged
openshift-merge-bot[bot] merged 2 commits into
opendatahub-io:mainfrom
chambridge:feature/rhoaieng-63106-integrate-operator-chaos
May 26, 2026
Merged

openshift-merge-bot[bot] merged 2 commits into
opendatahub-io:mainfrom
chambridge:feature/rhoaieng-63106-integrate-operator-chaos

Conversation

@chambridge

@chambridge chambridge commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Integrate operator-chaos SDK into model-registry-operator to enable shift-left chaos validation across L1 through L3 maturity levels:

  • L1 Breaking Change Detection: CI workflow validates knowledge model and experiment definitions against operator schema changes
  • L2 Experiment/Knowledge Validation: knowledge model describing operator components, managed resources, webhooks, finalizers, and steady-state checks; 9 chaos experiment definitions covering pod-kill, network-partition, webhook-disrupt, config-drift, rbac-revoke, finalizer-block, catalog-pod-kill, and catalog-config-drift scenarios
  • L3 Chaos Test Execution: ChaosClient SDK tests for ModelRegistry and ModelCatalog reconcilers with 10 Ginkgo specs exercising fault injection, recovery validation, and steady-state assertions

Adds CI workflow (chaos-validate.yml), Makefile targets (test-chaos, chaos-validate, operator-chaos install), and operator-chaos Go dependency.

How Has This Been Tested?

This essentially adds new tests and CI to run the chaos testing functionality

Merge criteria:

  • The commits and have meaningful messages; the author will squash them after approval or will ask to merge with squash.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Summary by CodeRabbit

  • New Features

    • Added a suite of chaos experiments to exercise resilience of the model-registry and model-catalog components.
    • Added a knowledge configuration describing expected components, resources, and steady-state checks.
  • Tests

    • Added a comprehensive chaos resilience test suite validating controller behavior and recovery under injected faults.
  • Chores

    • Added CI workflow and Makefile targets to validate chaos manifests and run chaos-focused tests.

… maturity

Integrate operator-chaos SDK into model-registry-operator to enable
shift-left chaos validation across L1 through L3 maturity levels:

- L1 Breaking Change Detection: CI workflow validates knowledge model
  and experiment definitions against operator schema changes
- L2 Experiment/Knowledge Validation: knowledge model describing
  operator components, managed resources, webhooks, finalizers, and
  steady-state checks; 9 chaos experiment definitions covering pod-kill,
  network-partition, webhook-disrupt, config-drift, rbac-revoke,
  finalizer-block, catalog-pod-kill, and catalog-config-drift scenarios
- L3 Chaos Test Execution: ChaosClient SDK tests for ModelRegistry and
  ModelCatalog reconcilers with 10 Ginkgo specs exercising fault
  injection, recovery validation, and steady-state assertions

Adds CI workflow (chaos-validate.yml), Makefile targets (test-chaos,
chaos-validate, operator-chaos install), and operator-chaos Go
dependency.

RHOAIENG-63106

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Chris Hambridge <chambrid@redhat.com>
@openshift-ci
openshift-ci Bot requested review from fege and rareddy May 21, 2026 15:08
@coderabbitai

coderabbitai Bot commented May 21, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This pull request adds a Chaos Validation GitHub Actions workflow, Makefile targets and an operator-chaos installer, a chaos knowledge model, nine ChaosExperiment manifests covering pod kills, config drift, network partition, webhook disruption, RBAC revoke, and finalizer blocking, a go.mod dependency on operator-chaos, and a 450-line Ginkgo test suite that wires chaos-enabled reconcilers for ModelRegistry and ModelCatalog and asserts ChaosError propagation and recovery.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers L1-L3 maturity levels, lists specific artifacts added (workflow, Makefile targets, tests, chaos experiments), and mentions testing approach. However, the merge criteria checklist remains entirely unchecked and no testing instructions beyond vague "adds new tests and CI" are provided. Check all merge criteria checkboxes that apply; add explicit testing instructions (e.g., how to run test-chaos locally, CI workflow validation steps, expected test outcomes).
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: integrating operator-chaos for shift-left validation across L1-L3 maturity levels, which aligns with the primary objective of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/chaos-validate.yml:
- Around line 17-18: The checkout action usages (actions/checkout@v6) currently
persist credentials to the local git config; update each checkout step to set
persist-credentials: false to prevent storing the workflow token in the
workspace and reduce token exposure (apply to the checkout steps shown and the
other occurrence around lines 44-49). Locate the steps that call
actions/checkout@v6 (the checkout action blocks) and add the input
persist-credentials: false to each step so credentials are not written to local
git config.
- Around line 14-16: The validate job currently doesn't set job-level
GITHUB_TOKEN permissions; add an explicit permissions block under the validate
job to scope GITHUB_TOKEN to only the least-privilege scopes required by its
steps (e.g., permissions: contents: read, actions: read, or other minimal scopes
your validation steps need) so that the job named validate uses an explicit,
minimal permission set rather than inheriting broad workflow-level permissions.
- Around line 17-20: Replace the mutable action tags by pinning
actions/checkout@v6 and actions/setup-go@v6 to their respective full commit SHAs
in the workflow (update the occurrences of actions/checkout and
actions/setup-go), add job-level permissions for jobs.validate with the minimal
scope (e.g., permissions: contents: read) and set persist-credentials: false on
both checkout steps to avoid leaving credentials available to subsequent steps;
make these changes where the workflow references actions/checkout and
actions/setup-go and in the jobs.validate block.

In `@internal/controller/modelregistry_chaos_test.go`:
- Around line 155-167: AfterEach currently ignores errors from
k8sClient.Get/Delete and os.Unsetenv which can leak resources; update the
AfterEach cleanup to surface failures instead of swallowing them by asserting or
failing the test on errors (e.g. use Gomega's Expect/Fail or require-like
checks). Specifically, in the AfterEach block referencing namespace, found
(&v1beta1.ModelRegistry{}), typeNamespaceName, k8sClient.Get and
k8sClient.Delete, and the os.Unsetenv calls for config.RestImage,
config.PostgresImage, config.KubeRBACProxyImage, check each error return and
handle it (log and Fail the spec or Expect(err).NotTo(HaveOccurred())) so
cleanup errors are visible and cause the test to fail immediately.
- Around line 101-109: The createRegistry function uses static namespace names
causing cross-test collisions; update createRegistry to generate a unique
namespace string (e.g., append a timestamp/UUID/random suffix) and use that
value for namespace.ObjectMeta.Name, namespace.ObjectMeta.Namespace and
typeNamespaceName (types.NamespacedName) so each test run gets a distinct
namespace and avoids AlreadyExists flakes.

In `@Makefile`:
- Line 278: The recipe currently checks/installs to $(LOCALBIN)/operator-chaos
but the intended target variable is $(OPERATOR_CHAOS); update the install rule
to check the actual OPERATOR_CHAOS path (test -s $(OPERATOR_CHAOS)) and install
the binary into the directory of $(OPERATOR_CHAOS) by setting GOBIN to the
dirname of $(OPERATOR_CHAOS) before calling go install
github.com/opendatahub-io/operator-chaos/cmd/operator-chaos@$(OPERATOR_CHAOS_VERSION),
so overrides of OPERATOR_CHAOS are honored; adjust any references in the same
recipe to use $(OPERATOR_CHAOS) instead of $(LOCALBIN)/operator-chaos.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: c2aad5ed-5ebf-4709-a546-ae5287618927

📥 Commits

Reviewing files that changed from the base of the PR and between a982cf8 and c77120c.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (14)
  • .github/workflows/chaos-validate.yml
  • Makefile
  • chaos/experiments/catalog-config-drift.yaml
  • chaos/experiments/catalog-pod-kill.yaml
  • chaos/experiments/config-drift.yaml
  • chaos/experiments/finalizer-block.yaml
  • chaos/experiments/mutating-webhook-disrupt.yaml
  • chaos/experiments/network-partition.yaml
  • chaos/experiments/pod-kill.yaml
  • chaos/experiments/rbac-revoke.yaml
  • chaos/experiments/webhook-disrupt.yaml
  • chaos/knowledge/model-registry.yaml
  • go.mod
  • internal/controller/modelregistry_chaos_test.go

Comment thread .github/workflows/chaos-validate.yml
Comment thread .github/workflows/chaos-validate.yml
Comment thread .github/workflows/chaos-validate.yml
Comment thread internal/controller/modelregistry_chaos_test.go
Comment thread internal/controller/modelregistry_chaos_test.go
Comment thread Makefile
@chambridge
chambridge requested a review from a team May 21, 2026 15:40
target:
operator: model-registry
component: model-catalog
resource: ConfigMap/model-catalog-sources-default

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.

This was renamed to default-catalog-sources (there are a few instances of the old name in this PR).

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.

fixed.

Comment thread chaos/knowledge/model-registry.yaml Outdated

components:
- name: model-registry-operator
controller: DataScienceCluster

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.

Should this be ModelRegistryReconciller?

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.

fixed

…and experiments

Rename ConfigMap from model-catalog-sources-default to
default-catalog-sources in catalog-config-drift experiment (target
resource and injection parameter) and model-registry knowledge base.
Fix controller name from DataScienceCluster to ModelRegistryReconciler
in model-registry knowledge base.

Addresses PR review feedback.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Chris Hambridge <chambrid@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
chaos/experiments/catalog-config-drift.yaml (1)

9-18: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Validate ConfigMap restoration explicitly.

This experiment can pass without proving the drift was reconciled. It only waits for Deployment/model-catalog to be Available, while the hypothesis says ConfigMap/default-catalog-sources should be restored. Since the injected key is also removed by TTL cleanup after 120s, a broken reconciler can still look "recovered" before recoveryTimeout expires. Add an assertion against the mutated ConfigMap state itself and keep deployment availability as a secondary health signal.

As per coding guidelines, prioritize "Bug-prone patterns and error handling gaps".

Also applies to: 20-33

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@chaos/experiments/catalog-config-drift.yaml` around lines 9 - 18, Add an
explicit steadyState check that verifies the mutated ConfigMap itself was
restored: for resource ConfigMap/default-catalog-sources add a check (e.g.,
conditionEquals/resourceField/jsonPath) that the injected key is absent or that
the expected data key/value is present, then keep the existing conditionTrue
check for Deployment model-catalog as a secondary signal; also ensure the
experiment's recoveryTimeout is greater than the ConfigMap TTL (e.g., >120s) so
the check cannot pass due to TTL cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@chaos/experiments/catalog-config-drift.yaml`:
- Around line 9-18: Add an explicit steadyState check that verifies the mutated
ConfigMap itself was restored: for resource ConfigMap/default-catalog-sources
add a check (e.g., conditionEquals/resourceField/jsonPath) that the injected key
is absent or that the expected data key/value is present, then keep the existing
conditionTrue check for Deployment model-catalog as a secondary signal; also
ensure the experiment's recoveryTimeout is greater than the ConfigMap TTL (e.g.,
>120s) so the check cannot pass due to TTL cleanup.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: ca43c740-5b84-4b2d-9cad-baca8ff4d0c6

📥 Commits

Reviewing files that changed from the base of the PR and between c77120c and 228c2d1.

📒 Files selected for processing (2)
  • chaos/experiments/catalog-config-drift.yaml
  • chaos/knowledge/model-registry.yaml
✅ Files skipped from review due to trivial changes (1)
  • chaos/knowledge/model-registry.yaml

@pboyd pboyd left a comment

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.

/lgtm
/approve

@openshift-ci

openshift-ci Bot commented May 26, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chambridge, pboyd

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit ed88fe1 into opendatahub-io:main May 26, 2026
5 checks passed
@chambridge
chambridge deleted the feature/rhoaieng-63106-integrate-operator-chaos branch May 26, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants