Skip to content

redis-last-fixes: engine-specific functional fixes, dragonfly binding, R0011 internal egress - #185

Merged
entlein merged 3 commits into
mainfrom
redis-last-fixes
Aug 4, 2026
Merged

entlein merged 3 commits into
mainfrom
redis-last-fixes

Conversation

@ConstanzeTU

Copy link
Copy Markdown
Contributor

Redis distro retest — last fixes

Retest of the redis packaging distros surfaced three regressions/bugs, fixed here.

1. Engine-specific functional failures

The per-distro functional suites ran commands not implemented by every engine:

  • keydb 6.x (Redis-6-based) has no FUNCTION (Redis 7.0 server-side functions) → function-list/function-stats errored. Dropped from functional/keydb.yaml.
  • dragonfly v1.39 implements a Redis subset → MEMORY DOCTOR, FUNCTION LIST/STATS, OBJECT ENCODING, CONFIG SET appendonly errored. Dropped from functional/dragonfly.yaml.

redis-oss (8.x) and valkey (9.x) genuinely support these, so they keep them. After the fix all four suites run clean: redis-oss 86, valkey 86, keydb 84, dragonfly 80 — 0 errors.

2. Dragonfly SBoB binding broken

The dragonfly operator only stamps podMetadata onto newly created pods, so bind_dragonfly's live patch never relabelled the running instance — node-agent never enforced the profile (attack contrast collapsed to 5 rules, no R0001). deploy-distros.sh now recreates the instance pod after patching, so it is born with the label. Verified: 0 functional FP + 10-rule attack contrast (incl. R0001).

3. R0011 skipped internal traffic

R0011 (Unexpected Egress Network Traffic) gated on !net.is_private_ip(event.dstAddr), so cluster-internal connections were never checked against the profile's egress allowlist — the allowlist contrast was undemonstrable for internal peers. Dropped the filter so any egress destination not in the allowlist alerts, private IPs included.

entlein added 2 commits August 4, 2026 09:53
…nding

functional/keydb.yaml: keydb 6.x is Redis-6-based and does not implement FUNCTION
(Redis 7.0 server-side functions) — drop function-list/function-stats (they errored).

functional/dragonfly.yaml: dragonfly v1.39 implements a Redis subset — drop the six
tests for commands it does not support (MEMORY DOCTOR, FUNCTION LIST/STATS, OBJECT
ENCODING, CONFIG SET appendonly). redis-oss/valkey keep them (genuinely supported).

deploy-distros.sh bind_dragonfly: the operator only stamps podMetadata onto newly
created pods, so the live patch never relabelled the running instance and node-agent
never enforced the profile (attack contrast dropped to 5 rules, no R0001). Recreate
the instance pod after patching so it is born with the label.
R0011 (Unexpected Egress Network Traffic) gated on !net.is_private_ip(event.dstAddr),
so in-cluster connections were never evaluated against the profile egress allowlist.
Cluster-internal peers (a client reaching a service) could not trip the rule, which
makes the allowlist contrast undemonstrable for internal traffic. Drop the filter so
any egress destination not in the allowlist alerts, private IPs included.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The deployment script now recreates and verifies the Dragonfly pod after profile changes. Dragonfly and KeyDB suites remove unsupported command tests. Kubescape rule R0011 now evaluates private destinations against the configured egress profile.

Changes

Redis distro compatibility

Layer / File(s) Summary
Dragonfly pod recreation and readiness
example/redis/distros/deploy-distros.sh
The script deletes the existing Dragonfly pod after applying the profile label and waits for the replacement pod to become ready.
Dragonfly and KeyDB test coverage
example/redis/distros/functional/dragonfly.yaml, example/redis/distros/functional/keydb.yaml
The suites document unsupported commands and remove incompatible tests while retaining supported coverage.

Kubescape egress evaluation

Layer / File(s) Summary
R0011 destination allowlist matching
kubescape/default-rules.yaml
Rule R0011 evaluates private destination traffic against the configured egress profile.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: entlein

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the engine-specific fixes, Dragonfly binding change, and R0011 egress change.
Description check ✅ Passed The description directly explains all three changes and their intended verification results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch redis-last-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@example/redis/distros/deploy-distros.sh`:
- Around line 86-87: Update the pod replacement flow in the deployment script
after deleting dragonfly-0 to explicitly wait or poll until the StatefulSet
recreates the pod, then run the existing kubectl wait for its ready condition.
Preserve the current namespace, pod name, ignore-not-found deletion, and timeout
behavior.

In `@example/redis/distros/functional/dragonfly.yaml`:
- Around line 106-108: Update the Dragonfly suite metadata description near the
top of the YAML to remove claims of BGREWRITEAOF and CONFIG SET appendonly
coverage, and describe the persistence coverage as only BGSAVE and LASTSAVE.
Keep the description aligned with the omitted tests documented in the suite.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3c1adcc1-fccd-48b8-95d8-ff4509e274ac

📥 Commits

Reviewing files that changed from the base of the PR and between 80f22c0 and 88dd89d.

📒 Files selected for processing (4)
  • example/redis/distros/deploy-distros.sh
  • example/redis/distros/functional/dragonfly.yaml
  • example/redis/distros/functional/keydb.yaml
  • kubescape/default-rules.yaml

Comment on lines +86 to +87
kubectl -n dragonfly delete pod dragonfly-0 --ignore-not-found
kubectl -n dragonfly wait --for=condition=ready pod/dragonfly-0 --timeout=120s

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== file excerpt =="
sed -n '1,170p' example/redis/distros/deploy-distros.sh

echo
echo "== nearby occurrences of kubectl wait/delete =="
rg -n "kubectl .*delete|kubectl .*wait|dragonfly-0" example/redis/distros/deploy-distros.sh || true

echo
echo "== changed diff around file if available =="
git diff -- example/redis/distros/deploy-distros.sh | sed -n '1,180p'

Repository: k8sstormcenter/bob

Length of output: 5095


🌐 Web query:

kubectl wait --for=create Pod documentation

💡 Result:

The kubectl wait command supports waiting for a resource to be created using the --for=create flag [1][2]. When you execute kubectl wait --for=create [resource_type]/[resource_name], the command will pause and poll the Kubernetes API until the specified resource exists [1][3]. If the resource is already present, the command proceeds immediately to check any other conditions specified [1][3]. Key points regarding this functionality: - Combined Conditions: You can combine creation and status checks in a single command. For example, to wait for a pod to be created and then reach a Ready state, you can use: kubectl wait --for=create pod/my-pod --for=condition=Ready pod/my-pod [1][3] - Sequential Evaluation: If --for=create is included alongside other conditions, the creation check is performed first [1][4][5]. - Behavior: This is an efficient way to handle scenarios where a resource is created asynchronously (e.g., by a deployment, job, or external process) and you need your script or process to pause until the resource is available to be acted upon [1][3]. Please note that in modern versions of Kubernetes (as of 2026), kubectl wait generally attempts to handle resource existence gracefully, but explicitly using --for=create is the documented method for ensuring the tool waits for the resource to be registered in the API server before evaluating further conditions [1][6].

Citations:


🌐 Web query:

kubectl kubectl wait condition Ready when object does not exist NotFound

💡 Result:

When using the kubectl wait command, if the target resource does not exist, the command will exit immediately with a non-zero exit status and an error, typically "Error from server (NotFound)" or "no matching resources found" [1][2][3]. It does not natively block or poll until the resource is created [1][3]. To address this behavior, you can use the following approaches: 1. Recommended: Use a wrapper script or a loop. Before calling kubectl wait, implement a loop to poll for the existence of the resource (e.g., using kubectl get). Once the resource is confirmed to exist, run kubectl wait to poll for the desired condition [1][3]. 2. Use --for=create (When supported). In some contexts, you may be able to use the --for=create flag in conjunction with other conditions to explicitly wait for the resource to be created before checking for readiness [4]. Example command: kubectl wait --for=create pod/my-pod --timeout=30s kubectl wait --for=condition=Ready pod/my-pod --timeout=120s 3. Alternative: Use kubectl rollout status. If you are waiting for a Deployment, StatefulSet, or DaemonSet, kubectl rollout status is often more robust than kubectl wait for handling resources that may not yet exist or are in the process of rolling out [3]. Example command: kubectl rollout status deployment/my-deployment --timeout=120s Historically, this behavior has been a known limitation in kubectl wait, where it was intentionally designed to fail if the resource was missing rather than block indefinitely [2][5]. While there have been ongoing community discussions and proposals to add native support for waiting for resource creation (e.g., --wait-for-creation flags), the most reliable, production-tested method remains explicit polling or using resource-specific rollout commands [6][7][8].

Citations:


Wait for the replacement pod before checking readiness.

kubectl wait --for=condition=ready does not block until the pod is created; if dragonfly-0 is deleted before the StatefulSet recreates it, the wait can fail with NotFound. Add an explicit creation wait or poll the pod for existence before checking the ready condition.

Suggested ordering
  kubectl -n dragonfly delete pod dragonfly-0 --ignore-not-found
+ kubectl -n dragonfly wait --for=create pod/dragonfly-0 --timeout=120s
  kubectl -n dragonfly wait --for=condition=ready pod/dragonfly-0 --timeout=120s
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
kubectl -n dragonfly delete pod dragonfly-0 --ignore-not-found
kubectl -n dragonfly wait --for=condition=ready pod/dragonfly-0 --timeout=120s
kubectl -n dragonfly delete pod dragonfly-0 --ignore-not-found
kubectl -n dragonfly wait --for=create pod/dragonfly-0 --timeout=120s
kubectl -n dragonfly wait --for=condition=ready pod/dragonfly-0 --timeout=120s
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@example/redis/distros/deploy-distros.sh` around lines 86 - 87, Update the pod
replacement flow in the deployment script after deleting dragonfly-0 to
explicitly wait or poll until the StatefulSet recreates the pod, then run the
existing kubectl wait for its ready condition. Preserve the current namespace,
pod name, ignore-not-found deletion, and timeout behavior.

Comment on lines +106 to +108
# dragonfly (v1.39) implements a Redis SUBSET: FUNCTION (Redis 7 server-side
# functions), OBJECT, MEMORY DOCTOR and CONFIG SET appendonly are unsupported,
# so those tests are omitted here (they remain in the redis-oss/valkey suites).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the Dragonfly suite description to match the tests.

The metadata description at Lines 5-12 still claims full behavior coverage, including BGREWRITEAOF and CONFIG SET appendonly yes. The Dragonfly suite now omits those paths and retains only BGSAVE and LASTSAVE in the persistence section. This text can mislead users about the learned profile coverage.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@example/redis/distros/functional/dragonfly.yaml` around lines 106 - 108,
Update the Dragonfly suite metadata description near the top of the YAML to
remove claims of BGREWRITEAOF and CONFIG SET appendonly coverage, and describe
the persistence coverage as only BGSAVE and LASTSAVE. Keep the description
aligned with the omitted tests documented in the suite.

Signed-off-by: Duck <70207455+entlein@users.noreply.github.com>
@entlein
entlein merged commit b8c0c81 into main Aug 4, 2026
2 checks passed
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