Skip to content

refactor: extract dereference/validate pipeline from reconcile#889

Open
maltesander wants to merge 12 commits into
mainfrom
refactor/reconcile-dereference-validate
Open

refactor: extract dereference/validate pipeline from reconcile#889
maltesander wants to merge 12 commits into
mainfrom
refactor/reconcile-dereference-validate

Conversation

@maltesander
Copy link
Copy Markdown
Member

Description

  • refactor dereference and validation steps from controller reconcile() to new "controller" module.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Helm chart can be installed and deployed operator works
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible
  • Links to generated (nightly) docs added
  • Release note snippet added

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

maltesander and others added 6 commits May 12, 2026 15:57
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the unused `namespace` field from `ValidatedInputs` and its
corresponding `MissingTrinoNamespace` error variant, along with the
`let _ = &validated.namespace` workaround in `reconcile_trino`.
Expose `validated_product_config` as `pub(super)` so `test_env_overrides`
can call it directly instead of inlining the 30-line equivalent.

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

@adwk67 adwk67 left a comment

Choose a reason for hiding this comment

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

There are some inconsistencies with naming, parameter order/type etc.: some should be changed here and some in the other PRs.

}

/// Validates the cluster spec and the dereferenced inputs.
pub fn validate(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in Airflow and Hive this is called validate_cluster, so i think we should be consistent.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In opensearch it is validate?

type Result<T, E = Error> = std::result::Result<T, E>;

/// Synchronous inputs the rest of `reconcile_trino` needs after dereferencing.
pub struct ValidatedInputs {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is cluster-name specific in Airflow and Hive i.e. ValidatedAirflowCluster etc. I'M probably in favour of keeping it generic as it is here.


/// Synchronous inputs the rest of `reconcile_trino` needs after dereferencing.
pub struct ValidatedInputs {
pub resolved_product_image: ResolvedProductImage,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just call this variable image to be consistent with the other PRs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

operator_environment: &OperatorEnvironmentOptions,
dereferenced: &DereferencedObjects,
) -> Result<ValidatedInputs> {
let resolved_product_image = trino
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll change the Airflow/Hive/Hbase PRs as we have it (wrongly) in dereference and not validate

},
};

#[derive(Snafu, Debug, EnumDiscriminants)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need EnumDiscriminants here? Airflow et al don't have it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

trino: &v1alpha1::TrinoCluster,
product_config: &ProductConfigManager,
operator_environment: &OperatorEnvironmentOptions,
dereferenced: &DereferencedObjects,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This order is inconsistent with the others, where we have e.g.

    airflow: &v1alpha2::AirflowCluster,
    dereferenced: &DereferencedObjects,
    product_config_manager: &ProductConfigManager,

(operator_environment: &OperatorEnvironmentOptions will be added to the others when image resolution is moved to validate).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

pub struct ValidatedInputs {
pub resolved_product_image: ResolvedProductImage,
pub trino_authentication_config: TrinoAuthenticationConfig,
pub validated_role_config: ValidatedRoleConfigByPropertyKind,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The other PRs have e.g.

    pub role_groups: BTreeMap<AirflowRole, BTreeMap<String, ValidatedRoleGroupConfig>>,
    pub role_configs: BTreeMap<AirflowRole, ValidatedRoleConfig>,

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.

2 participants