Skip to content

refactor: extract dereference/validate pipeline from reconcile_airflow#795

Merged
adwk67 merged 10 commits into
mainfrom
feature/validated-config-types-3
May 13, 2026
Merged

refactor: extract dereference/validate pipeline from reconcile_airflow#795
adwk67 merged 10 commits into
mainfrom
feature/validated-config-types-3

Conversation

@adwk67
Copy link
Copy Markdown
Member

@adwk67 adwk67 commented May 12, 2026

Summary

  • Derive Ord/PartialOrd on AirflowRole so it can be used as a BTreeMap key
  • Extract external resource resolution (product image, auth, authz, internal secrets) into controller::dereference module with its own Snafu error enum
  • Extract product-config validation and config merging into validate_cluster(), producing a ValidatedAirflowCluster struct that proves all validation succeeded before any Kubernetes resources are created
  • ValidatedAirflowCluster 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_airflow()
  • The ValidatedAirflowCluster struct intentionally has fewer fields than a full ownership model would (no name/namespace/uid/metadata validated types, no precomputed_pod_data). 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 just dereference, with validate and further stages to follow in later PRs
  • The Dereference wrapper variant in the controller's Error enum replaces 4 individual error variants (ResolveProductImage, InvalidAuthenticationConfig, InvalidAuthorizationConfig, InvalidInternalSecret) that moved into the new module's own error enum

Test plan

  • All 27 existing unit tests pass
  • Clean compile with no warnings
  • No behavioural changes — pure refactoring

🤖 Generated with Claude Code

adwk67 and others added 2 commits May 12, 2026 14:21
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move external resource resolution (product image, auth, authz, internal
secrets) into controller::dereference module with its own error enum.
Extract config validation and merging into validate_cluster(), which
produces a ValidatedAirflowCluster proving all product-config validation
succeeded before any Kubernetes resources are created.

The validated struct owns the resolved product image and per-role/
per-rolegroup merged configs. Existing build functions are unchanged
and receive their parameters from the validated structs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adwk67 adwk67 self-assigned this May 12, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adwk67
Copy link
Copy Markdown
Member Author

adwk67 commented May 13, 2026

Rename ProductConfigTransform to GenerateProductConfig and fix
the display string casing to match the convention used across
all three dereference/validate extraction PRs.

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
@siegfriedweber siegfriedweber self-requested a review May 13, 2026 10:20
@siegfriedweber siegfriedweber moved this to Development: In Review in Stackable Engineering May 13, 2026
Comment thread rust/operator-binary/src/controller/dereference.rs Outdated
Comment thread rust/operator-binary/src/controller/dereference.rs Outdated
Comment thread rust/operator-binary/src/controller/mod.rs
adwk67 and others added 4 commits May 13, 2026 16:47
Image resolution is a pure computation, not an I/O dereference, so it
belongs in validate_cluster alongside the other config validation. This
also aligns with the pattern used by the trino operator.

The dereference error variants were renamed to drop the `Invalid` prefix
(e.g. InvalidAuthenticationConfig → AuthenticationConfig) because
removing ResolveProductImage left all remaining variants sharing the
same prefix, triggering clippy::enum_variant_names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Secret creation is a side effect that should not happen before the
cluster spec has been validated. Moved it to the reconciler, after
validate_cluster succeeds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@siegfriedweber siegfriedweber left a comment

Choose a reason for hiding this comment

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

LGTM

@adwk67 adwk67 added this pull request to the merge queue May 13, 2026
Merged via the queue into main with commit a917f36 May 13, 2026
12 checks passed
@adwk67 adwk67 deleted the feature/validated-config-types-3 branch May 13, 2026 15:48
@adwk67 adwk67 moved this from Development: In Review to Development: Done in Stackable Engineering May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: Done

Development

Successfully merging this pull request may close these issues.

2 participants