Skip to content

refactor: extract dereference/validate pipeline from reconcile_hbase#757

Open
adwk67 wants to merge 5 commits into
mainfrom
refactor/reconcile-dereference-validate
Open

refactor: extract dereference/validate pipeline from reconcile_hbase#757
adwk67 wants to merge 5 commits into
mainfrom
refactor/reconcile-dereference-validate

Conversation

@adwk67
Copy link
Copy Markdown
Member

@adwk67 adwk67 commented May 13, 2026

Summary

  • Derive Ord/PartialOrd on HbaseRole so it can be used as a BTreeMap key
  • Derive Clone/Debug on AnyServiceConfig so it can be stored in validated structs
  • Extract external resource resolution (product image, ZooKeeper connection, OPA config) into controller::dereference module with its own Snafu error enum
  • Extract product-config validation and config merging into validate_cluster(), producing a ValidatedHbaseCluster struct that proves all validation succeeded before any Kubernetes resources are created
  • ValidatedHbaseCluster owns the resolved product image and per-role/per-rolegroup merged configs; existing build functions are unchanged and receive parameters from the validated structs

Reviewer notes

  • dereference() and validate_cluster() contain no new logic — they are pure extractions of code that was previously inline in reconcile_hbase()
  • The ValidatedHbaseCluster struct intentionally has fewer fields than a full ownership model would (no name/namespace/uid/metadata validated types). This is a "construct but decompose" fail-fast gate: built early in reconcile to prove validation passes, then its fields feed the existing unchanged build functions
  • The controller/ directory is introduced as a home for pipeline stages — currently dereference and validate, with further stages to follow in later PRs
  • The Dereference and Validate wrapper variants in the controller's Error enum replace 8 individual error variants that moved into the new modules' own error enums (3 to dereference: ResolveProductImage, RetrieveZookeeperConnectionInformation, InvalidOpaConfig; 5 to validate: RoleProperties, GenerateProductConfig, InvalidProductConfig, UnidentifiedHbaseRole, FailedToResolveConfig)
  • Mirrors the pattern established in the airflow-operator (refactor: extract dereference/validate pipeline from reconcile_airflow airflow-operator#795) and hive-operator (refactor: extract dereference/validate pipeline from reconcile_hive hive-operator#707)

Test plan

  • All 16 existing unit tests pass
  • Clean compile with no warnings (cargo clippy --all-targets)
  • No behavioural changes — pure refactoring

🤖 Generated with Claude Code

Move external-reference resolution (product image, ZooKeeper, OPA) into
controller/dereference.rs and product-config validation with config
merging into controller/validate.rs. The reconciler now calls
dereference → validate as an explicit pipeline, matching the pattern
established in the airflow and hive operators.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ct config validation

The label-safe composite version string (e.g. "2.6.4-stackable24.7.0") is
not suitable for semver matching against fromVersion/asOfVersion constraints
in properties.yaml. Use the raw product_version consistently with all other
operators.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adwk67 adwk67 marked this pull request as ready for review May 13, 2026 10:12
@adwk67
Copy link
Copy Markdown
Member Author

adwk67 commented May 13, 2026

adwk67 and others added 3 commits May 13, 2026 16:59
Image resolution is a pure computation, not an I/O dereference, so it
belongs in validate_cluster alongside the other config validation. This
aligns with the pattern used by the trino and airflow operators.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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