Skip to content

Conversation

@PatTheSilent
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Sep 26, 2025

Walkthrough

Adds a new core.v1.volume helper for ephemeral volumes and extends deployment/statefulSet volume merging to include ephemeral volumes when provided.

Changes

Cohort / File(s) Change Summary
Volume helper: core.v1.volume
kubernetes/k.libsonnet
Introduces public function fromEphemeral(name, ephemeral={}) composing existing volume helpers: sets name, applies volumeClaimTemplate resource requests, accessModes (default ['ReadWriteOnce']), and storageClassName (default 'gp3').
Workload volume merging
kubernetes/kubernetes.libsonnet
Updates volume mixins for deployments and statefulSets to append an ephemeral volume entry when std.objectHas(m, 'ephemeral'); existing configMap/emptyDir/secret/claim handling unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request lacks any author-provided description, so there is no content to relate to the summarized changes or provide context for reviewers. Please add a brief description summarizing the addition of the fromEphemeral helper and the inclusion of ephemeral volumes in deployment and statefulSet configurations.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title concisely summarizes the primary change of adding support for ephemeral volumes and directly reflects the content of the changeset without extraneous detail or noise.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ephemeral-support

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 677e9e5 and 2bc3eed.

📒 Files selected for processing (2)
  • kubernetes/k.libsonnet (1 hunks)
  • kubernetes/kubernetes.libsonnet (2 hunks)
🔇 Additional comments (2)
kubernetes/kubernetes.libsonnet (2)

245-248: Ephemeral volume wiring in deployments looks solid

The new branch cleanly mirrors the existing patterns and keeps the mixin dedupe logic intact. 👍


369-372: Nice parity for StatefulSets

Thanks for keeping the StatefulSet path in sync with the deployment helper—makes downstream configs consistent.

Comment on lines +7 to +9
super.ephemeral.volumeClaimTemplate.spec.resources.withRequests(ephemeral.resources.requests) +
super.ephemeral.volumeClaimTemplate.spec.withAccessModes(if std.objectHas(ephemeral, 'accessModes') then ephemeral.accessModes else ['ReadWriteOnce']) +
super.ephemeral.volumeClaimTemplate.spec.withStorageClassName(if std.objectHas(ephemeral, 'storageClassName') then ephemeral.storageClassName else 'gp3'),
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Guard ephemeral.resources.requests before dereferencing

ephemeral defaults to {}, so core.v1.volume.fromEphemeral('cache') (or any call that only overrides access modes / storage class) will throw Field does not exist: resources at evaluation time. Add a guard—or emit a clear assertion error—before touching ephemeral.resources.requests, so the helper is usable with the documented default.

Apply this diff:

-          super.ephemeral.volumeClaimTemplate.spec.resources.withRequests(ephemeral.resources.requests) +
+          (
+            if std.objectHas(ephemeral, 'resources') && std.objectHas(ephemeral.resources, 'requests')
+            then super.ephemeral.volumeClaimTemplate.spec.resources.withRequests(ephemeral.resources.requests)
+            else error 'core.v1.volume.fromEphemeral requires ephemeral.resources.requests'
+          ) +
📝 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
super.ephemeral.volumeClaimTemplate.spec.resources.withRequests(ephemeral.resources.requests) +
super.ephemeral.volumeClaimTemplate.spec.withAccessModes(if std.objectHas(ephemeral, 'accessModes') then ephemeral.accessModes else ['ReadWriteOnce']) +
super.ephemeral.volumeClaimTemplate.spec.withStorageClassName(if std.objectHas(ephemeral, 'storageClassName') then ephemeral.storageClassName else 'gp3'),
(
if std.objectHas(ephemeral, 'resources') && std.objectHas(ephemeral.resources, 'requests')
then super.ephemeral.volumeClaimTemplate.spec.resources.withRequests(ephemeral.resources.requests)
else error 'core.v1.volume.fromEphemeral requires ephemeral.resources.requests'
) +
super.ephemeral.volumeClaimTemplate.spec.withAccessModes(
if std.objectHas(ephemeral, 'accessModes')
then ephemeral.accessModes
else ['ReadWriteOnce']
) +
super.ephemeral.volumeClaimTemplate.spec.withStorageClassName(
if std.objectHas(ephemeral, 'storageClassName')
then ephemeral.storageClassName
else 'gp3'
),
🤖 Prompt for AI Agents
In kubernetes/k.libsonnet around lines 7 to 9, the code dereferences
ephemeral.resources.requests although ephemeral may be {} causing a "Field does
not exist: resources" error; guard that access by checking for the presence of
resources (and requests) before using it—e.g. replace the direct
ephemeral.resources.requests with a conditional that uses
ephemeral.resources.requests only if std.objectHas(ephemeral, "resources") and
std.objectHas(ephemeral.resources, "requests"), otherwise supply an empty
requests object (or assert with a clear error message); keep the surrounding
.withRequests call unchanged but pass the guarded value.

@PatTheSilent PatTheSilent merged commit b1f8c16 into master Sep 26, 2025
4 checks passed
@PatTheSilent PatTheSilent deleted the ephemeral-support branch September 26, 2025 12:21
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.

3 participants