Skip to content

fix(platform): gate tls volume on tls.enabled instead of kas/all mode#171

Merged
jp-ayyappan merged 4 commits intomainfrom
fix/DSPX-2672-tls-volume-mode-condition
Apr 15, 2026
Merged

fix(platform): gate tls volume on tls.enabled instead of kas/all mode#171
jp-ayyappan merged 4 commits intomainfrom
fix/DSPX-2672-tls-volume-mode-condition

Conversation

@jp-ayyappan
Copy link
Copy Markdown
Contributor

@jp-ayyappan jp-ayyappan commented Mar 18, 2026

Summary

The tls volume in _volume.tpl was nested inside the if kas/all mode block with a misplaced empty if tls.enabled check that had no effect. This caused the tls volume to only render when mode contained kas or all, while the tls volumeMount was correctly gated on tls.enabled alone — producing an invalid pod spec when using mode: core with TLS enabled:

Deployment.apps is invalid: spec.template.spec.containers[0].volumeMounts[2].name: Not found: "tls"

Before:

{{- if or (contains "all" .Values.mode) (contains "kas" .Values.mode) }}
- name: kas-private-keys
  ...
  {{- if .Values.server.tls.enabled }}  ← empty block, no effect
  {{- end }}
- name: tls                             ← always rendered with kas/all
  ...
{{- end }}

After:

{{- if or (contains "all" .Values.mode) (contains "kas" .Values.mode) }}
- name: kas-private-keys
  ...
{{- end }}
{{- if .Values.server.tls.enabled }}    ← correctly gated on tls.enabled
- name: tls
  ...
{{- end }}

Test plan

  • Deploy with mode: core and server.tls.enabled: true — pod should start successfully with tls volume mounted
  • Deploy with mode: core and server.tls.enabled: false — no tls volume or mount
  • Deploy with mode: core,kas and server.tls.enabled: true — both kas-private-keys and tls volumes rendered

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed TLS volume configuration to ensure proper inclusion in deployments when TLS is enabled.
    • Corrected server authentication configuration to use default settings properly instead of hardcoded values.
  • Tests

    • Added test coverage validating TLS enablement/disablement scenarios in deployments and KAS mode configurations.

…l mode

The tls volume was nested inside the kas/all mode block with a misplaced
empty if tls.enabled check that had no effect. This caused the tls volume
to only render when mode contained kas or all, while the tls volumeMount
was correctly gated on tls.enabled alone — producing an invalid pod spec
when using mode: core with tls enabled.

Fix: separate kas-private-keys and tls into independent blocks, each
gated on their own condition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jp-ayyappan jp-ayyappan requested a review from a team as a code owner March 18, 2026 13:46
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical templating bug in the Helm chart's _volume.tpl that prevented the tls volume from being correctly included in the pod specification under specific deployment configurations. By adjusting the conditional logic, the tls volume is now properly rendered based on the tls.enabled flag, resolving issues where mode: core with TLS enabled would result in an invalid pod spec due to a missing volume. This ensures the chart functions as expected across various mode and TLS settings.

Highlights

  • Incorrect TLS Volume Gating: The tls volume definition in _volume.tpl was incorrectly nested within a kas/all mode block, causing it to only render when mode included kas or all.
  • Invalid Pod Spec Resolution: This misconfiguration led to an invalid pod specification when mode: core was used with tls.enabled: true, as the tls volume was not present while its volumeMount was expected.
  • Corrected Conditional Logic: The tls volume definition has been moved out of the kas/all mode block and is now correctly gated solely by tls.enabled, ensuring proper rendering across all deployment modes.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses a bug where the tls volume in the Helm chart was incorrectly tied to the kas or all mode. The change moves the tls volume definition to be conditional only on .Values.server.tls.enabled, which aligns its behavior with the corresponding volumeMount and fixes deployment failures in core mode with TLS enabled. The implementation is correct and improves the template's logic and readability.

Copy link
Copy Markdown
Member

@elizabethhealy elizabethhealy left a comment

Choose a reason for hiding this comment

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

actually could we add a unit tests to ensure we the tls volume and mount are created when we expect https://github.com/opentdf/charts/blob/main/tests/chart_platform_template_test.go

auth.enabled was hardcoded to true then .Values.server.auth was rendered
after it, creating a duplicate YAML key when users set server.auth.enabled:
false — causing strict yaml parsers to reject the config file entirely.

Use .Values.server.auth.enabled with a default of true, and render the
rest of the auth block using omit to exclude the enabled key.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@stoneb344
Copy link
Copy Markdown
Contributor

@elizabethhealy Unit tests added: #172

cc: @jp-ayyappan

…ing (#172)

## Summary

- Add unit test: `mode: core` with `tls.enabled: true` — tls volume and
mount should be present
- Add unit test: `mode: core` with `tls.enabled: false` — tls volume and
mount should be absent
- Add unit test: `mode: core,kas` with `tls.enabled: true` — both tls
and kas-private-keys volumes and mounts should be present

Closes FEDCD-469

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9d5a17a2-fe02-40bc-a484-01d3d2cc3636

📥 Commits

Reviewing files that changed from the base of the PR and between 518ee66 and d698df0.

📒 Files selected for processing (3)
  • charts/platform/templates/_volume.tpl
  • charts/platform/templates/config.yaml
  • tests/chart_platform_template_test.go

📝 Walkthrough

Walkthrough

This PR adjusts YAML template indentation for volume configuration in Helm templates, updates server authentication configuration rendering logic with proper default handling, and adds three new tests validating TLS volume and mount behavior in deployment manifests.

Changes

Cohort / File(s) Summary
Volume Configuration
charts/platform/templates/_volume.tpl
Fixed YAML indentation of tls secret volume within conditional blocks to ensure correct placement under the volumes list; whitespace trimming operators adjusted for proper template rendering.
Authentication Configuration
charts/platform/templates/config.yaml
Updated server.auth.enabled to derive from .Values.server.auth.enabled with default true fallback instead of hardcoding; remaining auth fields rendered by omitting the enabled key to prevent duplication.
Deployment Tests
tests/chart_platform_template_test.go
Added three new tests validating TLS volume/mount presence in core mode when enabled, absence when disabled, and coexistence with KAS private keys volume/mount in core+KAS mode.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Indentation now aligns with care,
Template volumes float in the right layer,
TLS dances with KAS in harmony,
Default values set gracefully,
Tests bloom to prove the path is clear!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: moving the TLS volume out of the kas/all mode conditional and gating it on tls.enabled instead.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix/DSPX-2672-tls-volume-mode-condition

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

@stoneb344
Copy link
Copy Markdown
Contributor

@elizabethhealy, do the unit tests look sufficient or are there other changes you'd like to see?

@jp-ayyappan jp-ayyappan enabled auto-merge (squash) April 15, 2026 19:55
@jp-ayyappan jp-ayyappan merged commit 19323aa into main Apr 15, 2026
15 checks passed
@jp-ayyappan jp-ayyappan deleted the fix/DSPX-2672-tls-volume-mode-condition branch April 15, 2026 19:58
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.

4 participants