refactor: extract dereference/validate pipeline from reconcile#1034
refactor: extract dereference/validate pipeline from reconcile#1034maltesander wants to merge 9 commits into
Conversation
adwk67
left a comment
There was a problem hiding this comment.
Tests are all good. One comment from my initial look.
| }; | ||
| let validate::ValidatedInputs { | ||
| zookeeper_security, .. | ||
| } = validate::validate(&znode, &dereferenced, &ctx.operator_environment) |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
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).
Description
Definition of Done Checklist
Author
Reviewer
Acceptance
type/deprecationlabel & add to the deprecation scheduletype/experimentallabel & add to the experimental features tracker