Skip to content

Add postgres service account#1545

Merged
EItanya merged 3 commits intomainfrom
iplay88keys/add-postgres-sa
Mar 26, 2026
Merged

Add postgres service account#1545
EItanya merged 3 commits intomainfrom
iplay88keys/add-postgres-sa

Conversation

@iplay88keys
Copy link
Copy Markdown
Contributor

Description

The bundled PostgreSQL deployment was missing a ServiceAccount. Unlike the controller and UI components, which each have a dedicated ServiceAccount and reference it via serviceAccountName in their pod specs, the PostgreSQL pod was running without one, falling back to the default service account in the namespace.

Running pods against the default service account is a security best practice violation. It conflates identity across unrelated workloads and makes it harder to scope RBAC or audit pod-level API access. Each component should have a dedicated, least-privilege identity.

Signed-off-by: Jeremy Alvis <jeremy.alvis@solo.io>
@iplay88keys iplay88keys marked this pull request as ready for review March 25, 2026 15:19
Copilot AI review requested due to automatic review settings March 25, 2026 15:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the security posture of the bundled PostgreSQL deployment in the kagent Helm chart by giving it a dedicated ServiceAccount (instead of implicitly using the namespace default SA), aligning it with the controller/UI pattern.

Changes:

  • Set serviceAccountName on the bundled PostgreSQL Deployment pod spec.
  • Add a new postgresql-serviceaccount.yaml template rendered only when bundled Postgres is enabled.
  • Extend Helm unit tests to cover both the serviceAccountName wiring and conditional ServiceAccount creation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
helm/kagent/tests/postgresql_test.yaml Adds assertions for PostgreSQL serviceAccountName and validates ServiceAccount template rendering behavior.
helm/kagent/templates/postgresql.yaml Assigns the bundled PostgreSQL pod to a dedicated ServiceAccount.
helm/kagent/templates/postgresql-serviceaccount.yaml Introduces the dedicated ServiceAccount resource for bundled PostgreSQL when enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@EItanya EItanya left a comment

Choose a reason for hiding this comment

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

Why not colocate this with postgres.yaml?

@iplay88keys
Copy link
Copy Markdown
Contributor Author

Why not colocate this with postgres.yaml?

No particular reason. That works for me.

@EItanya EItanya merged commit 4cf6b4e into main Mar 26, 2026
22 checks passed
@EItanya EItanya deleted the iplay88keys/add-postgres-sa branch March 26, 2026 08:40
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