-
Notifications
You must be signed in to change notification settings - Fork 7
fix: add wekactl_as_default ff and fix ensure_weka_version #2794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -307,6 +307,8 @@ class FeaturesFlags: | |||||||||||||||||||||||||||||||||||||||||
| ssd_proxy_includes_dpdk_memory: Union[bool, int] = 9 | ||||||||||||||||||||||||||||||||||||||||||
| # flags 10, 11 are not used by the operator | ||||||||||||||||||||||||||||||||||||||||||
| weka_manages_non_ionode_affinity: Union[bool, int] = 12 | ||||||||||||||||||||||||||||||||||||||||||
| # flag 13 is not used by the operator | ||||||||||||||||||||||||||||||||||||||||||
| wekactl_as_default: Union[bool, int] = 14 | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| def __init__(self, b64_flags: Optional[str]) -> None: | ||||||||||||||||||||||||||||||||||||||||||
| active: Set[int] = set(parse_feature_bitmap(b64_flags or "")) | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -3093,6 +3095,17 @@ async def configure_persistency(): | |||||||||||||||||||||||||||||||||||||||||
| # --- defensive: kernel peer-group inheritance for subdirectory binds is subtle; | ||||||||||||||||||||||||||||||||||||||||||
| # --- make-private ensures /opt/weka cannot propagate here under any propagation mode. | ||||||||||||||||||||||||||||||||||||||||||
| mount --make-private /opt/weka-dist-save | ||||||||||||||||||||||||||||||||||||||||||
| # --- bin/ ships only in the image, so the bind below would mask it entirely. | ||||||||||||||||||||||||||||||||||||||||||
| # --- wekactl resolves the agent through /opt/weka/bin/agent, and bin/ also holds | ||||||||||||||||||||||||||||||||||||||||||
| # --- netns_vlan.sh and weka-bootstrap.sh as real files with no copy under dist/. | ||||||||||||||||||||||||||||||||||||||||||
| # --- guarded: images without bin/ must not fail the whole block under set -e. | ||||||||||||||||||||||||||||||||||||||||||
| BIN_EXISTED=0 | ||||||||||||||||||||||||||||||||||||||||||
| if [ -d /opt/weka/bin ]; then | ||||||||||||||||||||||||||||||||||||||||||
| BIN_EXISTED=1 | ||||||||||||||||||||||||||||||||||||||||||
| mkdir -p /opt/weka-bin-save | ||||||||||||||||||||||||||||||||||||||||||
| mount -o bind /opt/weka/bin /opt/weka-bin-save | ||||||||||||||||||||||||||||||||||||||||||
| mount --make-private /opt/weka-bin-save | ||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||
| # --- WEKA_PERSISTENCE_DIR - is HostPath (persistent volume) | ||||||||||||||||||||||||||||||||||||||||||
| mkdir -p {WEKA_PERSISTENCE_DIR}/dist/drivers | ||||||||||||||||||||||||||||||||||||||||||
| mount -o bind {WEKA_PERSISTENCE_DIR} /opt/weka | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -3101,6 +3114,12 @@ async def configure_persistency(): | |||||||||||||||||||||||||||||||||||||||||
| mount -o bind /opt/weka-dist-save /opt/weka/dist | ||||||||||||||||||||||||||||||||||||||||||
| # --- /opt/weka/dist now holds its own reference; release the staging mount | ||||||||||||||||||||||||||||||||||||||||||
| umount /opt/weka-dist-save | ||||||||||||||||||||||||||||||||||||||||||
| # --- restore image bin the same way | ||||||||||||||||||||||||||||||||||||||||||
| if [ "$BIN_EXISTED" = "1" ]; then | ||||||||||||||||||||||||||||||||||||||||||
| mkdir -p /opt/weka/bin | ||||||||||||||||||||||||||||||||||||||||||
| mount -o bind /opt/weka-bin-save /opt/weka/bin | ||||||||||||||||||||||||||||||||||||||||||
| umount /opt/weka-bin-save | ||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||
| # --- make drivers dir persistent | ||||||||||||||||||||||||||||||||||||||||||
| mount -o bind {WEKA_PERSISTENCE_DIR}/dist/drivers /opt/weka/dist/drivers | ||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -3169,7 +3188,14 @@ async def configure_persistency(): | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| async def ensure_weka_version(force_set=False): | ||||||||||||||||||||||||||||||||||||||||||
| if force_set: | ||||||||||||||||||||||||||||||||||||||||||
| ff = await get_feature_flags() | ||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New hard dependency on
Failure scenario: in a mode/image where Worth either confirming the release dir is guaranteed present at this point for |
||||||||||||||||||||||||||||||||||||||||||
| if ff.wekactl_as_default: | ||||||||||||||||||||||||||||||||||||||||||
| # the wekactl-backed CLI renders the version table with a '✔' column instead of | ||||||||||||||||||||||||||||||||||||||||||
| # a '*' marker and emits objects (not strings) in -J, which silently breaks the | ||||||||||||||||||||||||||||||||||||||||||
| # legacy marker grep and $(weka version) substitution | ||||||||||||||||||||||||||||||||||||||||||
| set_cmd = "weka version set $(weka version -J | jq -r '.[0].version')" | ||||||||||||||||||||||||||||||||||||||||||
| cmd = set_cmd if force_set else f"weka version -J | jq -e 'any(.[]; .current)' >/dev/null || {set_cmd}" | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3196
to
+3197
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Concrete path into it:
Suggested change
Separately, |
||||||||||||||||||||||||||||||||||||||||||
| elif force_set: | ||||||||||||||||||||||||||||||||||||||||||
| cmd = "weka version set $(weka version -J | jq -r '.[0]')" | ||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||
| cmd = "weka version | grep '*' || weka version set $(weka version)" | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3192
to
3201
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Readability nit (non-blocking): the mixed ternary +
Suggested change
Note this also fixes a latent inconsistency in the legacy path that the current diff leaves in place: the legacy Happy to leave the legacy branch untouched if you'd rather keep the blast radius to the flagged path — just flagging it. |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard looks right — this resolves the crash-loop exposure I flagged last round. Verified:
run_commandshells out viacreate_subprocess_shell(/bin/sh), and[ "$BIN_EXISTED" = "1" ]/BIN_EXISTED=0are POSIX;$BIN_EXISTEDhas no braces so it survives thededent(f"""…""")intact, same as the existing$BOOT_DIR/$ENVOY_DIR.One thing the guard does not cover, and it's the half of my earlier comment that's still open:
[ -d ]dereferences symlinks. If/opt/weka/binis a symlink-to-directory in the image,BIN_EXISTED=1and the sequence silently converts it into a real directory mountpoint:/opt/weka(symlink included) with the host persistence dir;mkdir -p /opt/weka/binthen creates a real directory on the HostPath;Callers that
readlinkit see a directory, and any later unlink/replace — which is exactly what a version switch does — failsEBUSYand surfaces asFailed to set weka versionfrom line 3204, pointing at the wrong hunk entirely.ls -ld /opt/weka/binin the weka image settles it. If it's a real directory, this is a non-issue and nothing needs changing. If it's a symlink, the guard wants[ -d /opt/weka/bin ] && [ ! -L /opt/weka/bin ]plus explicit symlink recreation on the restore side rather than a directory bind.Fix this →