Skip to content

refactor: extract dereference/validate pipeline from reconcile#687

Open
maltesander wants to merge 31 commits into
mainfrom
feat/dereference-validate-steps
Open

refactor: extract dereference/validate pipeline from reconcile#687
maltesander wants to merge 31 commits into
mainfrom
feat/dereference-validate-steps

Conversation

@maltesander
Copy link
Copy Markdown
Member

@maltesander maltesander commented May 21, 2026

Description

  • added dereference and validate steps for:
    • spark application
    • spark connect
    • spark history server
  • added test snapshots for smoke (app + history) and connect tests.

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 24 commits May 20, 2026 12:49
Empty modules with snafu Error stubs. Wires up `mod` declarations so
later commits can fill them in without further plumbing changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Defines DereferencedSparkApplication and an async dereference() function
that consolidates template merging, S3 connection resolution, the early
S3 TLS sanity check, and log directory resolution. Not yet wired into
reconcile().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tion

Defines ValidatedSparkApplication and a sync validate() function that
resolves the product image (moved from reconcile()) and runs
validated_role_config. Not yet wired into reconcile().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
reconcile() now delegates template merging, S3 resolution, TLS sanity
checking, log directory resolution, image resolution, and product-config
validation to the new submodules. The function body shrinks by ~70 lines
and the controller's Error enum loses six variants now living in the
submodules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Aligns history with connect (which already uses controller.rs) ahead of
splitting it into a controller/ submodule folder.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lidation

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ution

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drift-detect the 3 ConfigMaps, ServiceAccount, and RoleBinding that
persist after SparkApplication/spark-pi-s3-1 reaches phase: Succeeded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Snapshot the full `.data` of spark-connect-server and spark-connect-executor
ConfigMaps. Uses `.yaml.j2` because spark-defaults.conf and template.yaml differ
between s3-use-tls dimensions (https vs http, extraJavaOptions, initContainers,
minio-tls-ca volume). The spark.kubernetes.namespace line is substituted at
runtime via sed/__NAMESPACE__ to survive randomised kuttl namespaces.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@adwk67 adwk67 self-requested a review June 1, 2026 09:41
@adwk67 adwk67 moved this to Development: In Review in Stackable Engineering Jun 1, 2026
type Result<T, E = Error> = std::result::Result<T, E>;

pub struct ValidatedSparkConnectServer {
pub dereferenced: DereferencedSparkConnectServer,
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 departs from what we have done elsewhere (where the individual fields are included in the validated struct): also applies to the other two validate.rs files.

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.

client: &Client,
scs: &v1alpha1::SparkConnectServer,
) -> Result<DereferencedSparkConnectServer> {
let resolved_s3 = s3::ResolvedS3::resolve(client, scs)
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 looks like fetching + validation in one step. But looking at the code it does not seem trivial to split this up.

Copy link
Copy Markdown
Member

@adwk67 adwk67 Jun 1, 2026

Choose a reason for hiding this comment

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

The TLS check has been moved ito the validate step in 91bb6d5. Otherwise we can leave this as it is (until e.g. after product config has been removed) as "resolve" in this context is actually a fetch that happens to also flatten a simple enum.

@adwk67
Copy link
Copy Markdown
Member

adwk67 commented Jun 1, 2026

Smoke tests:

--- PASS: kuttl (1645.54s)
    --- PASS: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/smoke_openshift-false_spark-4.0.1_s3-use-tls-false (514.35s)
        --- PASS: kuttl/harness/smoke_openshift-false_spark-3.5.7_s3-use-tls-false (531.07s)
        --- PASS: kuttl/harness/smoke_openshift-false_spark-3.5.8_s3-use-tls-true (470.61s)
        --- PASS: kuttl/harness/smoke_openshift-false_spark-3.5.8_s3-use-tls-false (582.43s)
        --- PASS: kuttl/harness/smoke_openshift-false_spark-4.1.1_s3-use-tls-false (314.73s)
        --- PASS: kuttl/harness/smoke_openshift-false_spark-3.5.7_s3-use-tls-true (183.37s)
        --- PASS: kuttl/harness/smoke_openshift-false_spark-4.1.1_s3-use-tls-true (403.87s)
        --- PASS: kuttl/harness/smoke_openshift-false_spark-4.0.1_s3-use-tls-true (145.75s)
PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: In Review

Development

Successfully merging this pull request may close these issues.

2 participants