Skip to content

refactor: extract dereference/validate pipeline from reconcile#1034

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

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

Conversation

@maltesander
Copy link
Copy Markdown
Member

Description

  • added dereference and validate steps for zk and znode controller

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

@adwk67 adwk67 moved this to Development: In Review in Stackable Engineering May 20, 2026
@adwk67 adwk67 self-requested a review May 20, 2026 16:12
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.

Tests are all good. One comment from my initial look.

};
let validate::ValidatedInputs {
zookeeper_security, ..
} = validate::validate(&znode, &dereferenced, &ctx.operator_environment)
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 will try and resolve the image (unnecessarily, at this point) so if the image is not found the clean up will exit "uncleanly" :)


let zk = find_zk_of_znode(client, znode).await;
// dereference (client required)
let dereferenced_objects = dereference::dereference(client, znode).await;
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.

Suggested change
let dereferenced_objects = dereference::dereference(client, znode).await;
// Capturing the Result here (rather than the inner value) is intentional as ZkDoesNotExist will be handled explicitly below
let dereferenced_objects = dereference::dereference(client, znode).await;

YAMLEOF
)
actual=$(kubectl -n $NAMESPACE get cm test-zk -o yaml | yq -o=json '.data')
if [ "$expected" != "$actual" ]; then
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 really think it would be good to emit diffs for the comparisons in this assert, as it makes it a lot easier to see when and where drift takes place. In the HDFS PR I used snapshot files, but this can become fiddly if the linter demands a trailing return which is not in the "actual" yaml (but makes sense when the config files become large). In this case the config maps are all fairly small so we could do it without snapshot files, by writing out namespace-specific files and calling diff on them (we can't do this inline as sh is the hard-coded shell that kuttl uses and that causes problems for e.g. non-Nixos environments).

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