ASM-17946: fix cache pod security context and null volumes rendering#375
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds pod and container securityContext for the cache Deployment, consolidates volumeMounts/volumes conditionals to render when persistence OR TLS OR extra volumes are present, bumps akeyless-gateway chart version to 2.0.8, and adds CLAUDE.md plus a .gitignore entry. ChangesCache Security Context and Configuration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
charts/akeyless-gateway/templates/akeyless-cache/cache.yaml (1)
147-173:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winValidate
extraVolumesMountshas matchingextraVolumes.Line 147 can render
volumeMountsfromextraVolumesMountswhile Line 160 may still omitvolumesifextraVolumesis empty. That yields mounts referencing non-existent volumes.Suggested guard
+ {{- if and .Values.globalConfig.clusterCache.extraVolumesMounts (not .Values.globalConfig.clusterCache.extraVolumes) }} + {{- fail "globalConfig.clusterCache.extraVolumesMounts requires globalConfig.clusterCache.extraVolumes" }} + {{- end }} {{- if or .Values.globalConfig.clusterCache.persistence.enabled (eq "true" (include "akeyless-gateway.clusterCache.enableTls" . )) .Values.globalConfig.clusterCache.extraVolumesMounts }} volumeMounts:🤖 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 `@charts/akeyless-gateway/templates/akeyless-cache/cache.yaml` around lines 147 - 173, The template can render .Values.globalConfig.clusterCache.extraVolumesMounts into volumeMounts while not rendering corresponding .Values.globalConfig.clusterCache.extraVolumes into volumes, creating mounts that reference missing volumes; update the conditional logic so the volumes: block is rendered whenever extraVolumesMounts is present (e.g. extend the existing or condition that controls the volumes block to include .Values.globalConfig.clusterCache.extraVolumesMounts) or alternatively wrap the extraVolumesMounts rendering inside a guard that only emits mounts when .Values.globalConfig.clusterCache.extraVolumes is non-empty; refer to the symbols .Values.globalConfig.clusterCache.extraVolumesMounts and .Values.globalConfig.clusterCache.extraVolumes and the volume/volumeMounts template sections to locate where to apply the guard.
🤖 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.
Outside diff comments:
In `@charts/akeyless-gateway/templates/akeyless-cache/cache.yaml`:
- Around line 147-173: The template can render
.Values.globalConfig.clusterCache.extraVolumesMounts into volumeMounts while not
rendering corresponding .Values.globalConfig.clusterCache.extraVolumes into
volumes, creating mounts that reference missing volumes; update the conditional
logic so the volumes: block is rendered whenever extraVolumesMounts is present
(e.g. extend the existing or condition that controls the volumes block to
include .Values.globalConfig.clusterCache.extraVolumesMounts) or alternatively
wrap the extraVolumesMounts rendering inside a guard that only emits mounts when
.Values.globalConfig.clusterCache.extraVolumes is non-empty; refer to the
symbols .Values.globalConfig.clusterCache.extraVolumesMounts and
.Values.globalConfig.clusterCache.extraVolumes and the volume/volumeMounts
template sections to locate where to apply the guard.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: db0286f1-64a3-4bd1-a7f2-21ca6d0173f1
📒 Files selected for processing (3)
charts/akeyless-gateway/Chart.yamlcharts/akeyless-gateway/templates/akeyless-cache/cache.yamlcharts/akeyless-gateway/values.yaml
…s bugs - Add dedicated pod-level securityContext (fsGroup: 999) to cache pod so Redis can write to PVC-mounted /data; 999 is the redis user in the official Redis Alpine image - Decouple cache container securityContext from gateway.deployment.containerSecurityContext into its own globalConfig.clusterCache.containerSecurityContext value - Guard volumeMounts and volumes blocks with or-conditionals to prevent rendering as null when persistence and TLS are both disabled Fixes ASM-17946 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@charts/akeyless-gateway/values.yaml`:
- Around line 128-133: The fsGroup in the securityContext is set incorrectly to
the redis user's UID (999); change securityContext.fsGroup to 1000 to match the
redis group GID used by the official redis:8.2.5-alpine image, and update the
surrounding inline comment to state that 1000 is the GID of the redis group (not
the user UID) so the PVC will be chown'ed correctly and writable when
persistence.enabled=true.
🪄 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: CHILL
Plan: Pro
Run ID: a9414407-dd31-4307-937d-d66520ea5fc8
📒 Files selected for processing (5)
.gitignoreCLAUDE.mdcharts/akeyless-gateway/Chart.yamlcharts/akeyless-gateway/templates/akeyless-cache/cache.yamlcharts/akeyless-gateway/values.yaml
✅ Files skipped from review due to trivial changes (2)
- .gitignore
- charts/akeyless-gateway/Chart.yaml
fsGroup controls volume group ownership; the redis group GID in the official Redis Alpine image is 1000, not 999 (which is the user UID). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
What
Three bugs fixed in
charts/akeyless-gateway/templates/akeyless-cache/cache.yaml:1. Cache pod missing
fsGroup→ Redis permission denied on/dataAdded a dedicated pod-level
securityContextfor the cache pod, driven by the newglobalConfig.clusterCache.securityContextvalue (defaults tofsGroup: 1000). Without this, Redis (GID 1000) cannot write to a PVC-mounted/datadirectory, causing a crash loop.2. Cache container security context inherited from gateway
The Redis container was using
gateway.deployment.containerSecurityContext— the gateway's own setting. Replaced with a new independentglobalConfig.clusterCache.containerSecurityContextvalue. This also prevents a conflict with ASM-17923 (readOnlyRootFilesystem on the gateway): setting that on the gateway will no longer silently propagate to Redis.3. Empty
volumes/volumeMountsblocks rendered asnullWhen persistence is disabled, TLS is off, and no extra volumes are set, both blocks were emitted with no content (
volumes: null), producing an invalid pod spec. Wrapped both blocks in{{- if or ... }}guards.Values added
Chart version
1.20.1→1.20.2Summary by CodeRabbit
Chores
Documentation