Skip to content

Conversation

@jsbroks
Copy link
Member

@jsbroks jsbroks commented Sep 30, 2025

Summary by CodeRabbit

  • New Features
    • Adds optional PgBouncer sidecar to the event-queue pod, with auto-generated pgbouncer.ini and configurable values (image, resources, port, core settings).
    • Introduces a new workspace-engine chart with defaults, service account and StatefulSet templates for deploying the workspace engine.
    • Bumps ctrlplane chart version and adds workspace-engine as an optional chart dependency.

@coderabbitai
Copy link

coderabbitai bot commented Sep 30, 2025

Walkthrough

Adds a PgBouncer sidecar to the event-queue chart (helper template, ConfigMap, deployment changes, and values) and introduces a new workspace-engine subchart with helpers, ServiceAccount, StatefulSet template, values, Chart.yaml, and .helmignore. Also bumps ctrlplane chart version and adds workspace-engine dependency.

Changes

Cohort / File(s) Summary
PgBouncer Helm helper
charts/ctrlplane/charts/event-queue/templates/_helpers.tpl
Adds define "pgbouncer.ini" template that renders [databases], [pgbouncer], and [users] sections (uses values.databases, values.pgbouncer, values.users and optional include).
Event-queue Deployment
charts/ctrlplane/charts/event-queue/templates/deployment.yaml
Adds four env vars to main container and inserts a new pgbouncer sidecar container (image, pullPolicy, internal port, config volumeMount, resources).
PgBouncer ConfigMap
charts/ctrlplane/charts/event-queue/templates/pgbouncer.yaml
New ConfigMap manifest that sets data.pgbouncer.ini using the pgbouncer.ini helper and includes labels/name templates.
Event-queue values
charts/ctrlplane/charts/event-queue/values.yaml
Adds top-level pgbouncer values: image (repository/tag/pullPolicy), resources (requests/limits), internalPort, and config (listen_addr/listen_port/unix_socket_dir).
Chart metadata / dependency
charts/ctrlplane/Chart.yaml
Bumps chart version to 0.4.5 and adds workspace-engine dependency with condition workspace-engine.install and repository file://charts/workspace-engine.
Workspace-engine chart metadata
charts/ctrlplane/charts/workspace-engine/Chart.yaml
Adds new Chart.yaml for workspace-engine (apiVersion: v2, version 0.1.0, appVersion "1.0.0").
Workspace-engine helpers
charts/ctrlplane/charts/workspace-engine/templates/_helpers.tpl
New helper templates: workspace-engine.name, workspace-engine.fullname, workspace-engine.chart, workspace-engine.labels, workspace-engine.selectorLabels, workspace-engine.serviceAccountName.
Workspace-engine ServiceAccount
charts/ctrlplane/charts/workspace-engine/templates/serviceaccount.yaml
Adds conditional ServiceAccount template using helper names/labels and optional annotations/labels from values.
Workspace-engine StatefulSet
charts/ctrlplane/charts/workspace-engine/templates/statefulset.yaml
Adds StatefulSet template for workspace-engine with replicas, container (image, port 8081), many env vars (from values/secrets), resources, tolerations, and optional extras.
Workspace-engine values
charts/ctrlplane/charts/workspace-engine/values.yaml
New values file with defaults for metadata, replicas, image, env, tolerations, serviceAccount, resources, extraEnv, extraEnvFrom.
Workspace-engine .helmignore
charts/ctrlplane/charts/workspace-engine/.helmignore
Adds packaging ignore patterns (.DS_Store, VCS dirs, backups, IDE dirs, etc.).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor App as Event-Queue App
  participant PB as PgBouncer Sidecar
  participant DB as PostgreSQL

  App->>PB: Connect to localhost:{{ .Values.pgbouncer.config.listen_port | default "6432" }}
  PB->>DB: Open/Reuse pooled connection(s)
  DB-->>PB: Query responses
  PB-->>App: Forward results

  note right of PB: PB config loaded from ConfigMap `pgbouncer.ini`
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • chore: init event queue #20 — Prior changes modifying the same event-queue templates (helpers, deployment, values); likely extended here to add PgBouncer artifacts.

Suggested reviewers

  • zacharyblasczyk

Poem

Hop hop, configs stitched just right,
A bouncer springs to guard the night.
Pods sip pools and queries sing,
This rabbit cheers the changes bring. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive The title “init” is a generic placeholder that does not describe any of the substantive changes introduced by this pull request, such as adding a pgbouncer sidecar to the event-queue chart and scaffolding the new workspace-engine chart. Because it fails to convey the primary purpose of these enhancements, it does not meet the clarity and specificity guidelines for pull request titles. Consider revising the title to summarize the main changes, for example “Add pgbouncer sidecar to event-queue and scaffold workspace-engine Helm chart,” so that the title clearly reflects the primary goals of the pull request.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 pgbouncer

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: 4

🧹 Nitpick comments (1)
charts/ctrlplane/charts/event-queue/templates/deployment.yaml (1)

117-117: Remove extra blank line.

Static analysis detected an extra blank line here.

Apply this diff:

-

+
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8e1bc98 and 7518662.

📒 Files selected for processing (4)
  • charts/ctrlplane/charts/event-queue/templates/_helpers.tpl (1 hunks)
  • charts/ctrlplane/charts/event-queue/templates/deployment.yaml (1 hunks)
  • charts/ctrlplane/charts/event-queue/templates/pgbouncer.yaml (1 hunks)
  • charts/ctrlplane/charts/event-queue/values.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
charts/ctrlplane/charts/event-queue/templates/pgbouncer.yaml

[error] 7-7: syntax error: expected the node content, but found '-'

(syntax)

charts/ctrlplane/charts/event-queue/templates/deployment.yaml

[warning] 117-117: too many blank lines (1 > 0)

(empty-lines)

🔇 Additional comments (1)
charts/ctrlplane/charts/event-queue/values.yaml (1)

11-27: Verify database connection configuration.

The pgbouncer configuration is missing the [databases] section that defines which PostgreSQL databases PgBouncer should connect to. Without this, the event-queue application won't be able to connect through PgBouncer.

You'll need to add a databases configuration. For example, if your application connects to a database via the POSTGRES_URL environment variable, you should add something like:

databases:
  "*": "host=your-postgres-host port=5432 dbname=your-db"

Additionally, ensure the event-queue container's POSTGRES_URL environment variable (line 69-73 in deployment.yaml) is updated to point to localhost:6432 instead of the direct PostgreSQL connection, so it routes through PgBouncer.

Comment on lines +64 to +95
{{ define "pgbouncer.ini" }}

{{/* [databases] section */}}
{{- if $.Values.databases }}
{{ printf "[databases]" }}
{{- range $key, $value := .Values.databases }}
{{ $key }} ={{ range $k, $v := $value }} {{ $k }}={{ $v }}{{ end }}
{{- end }}
{{- end }}

{{/* [pgbouncer] section */}}
{{- if $.Values.pgbouncer }}
{{ printf "[pgbouncer]" }}
{{- range $k, $v := $.Values.pgbouncer }}
{{ $k }} = {{ $v }}
{{- end }}
{{- end }}

{{/* [users] section */}}
{{- if $.Values.users }}
{{ printf "[users]" }}
{{- range $k, $v := $.Values.users }}
{{ $k }} = {{ $v }}
{{- end }}
{{- end }}

{{/* include is a special configuration within [pgbouncer] section */}}
{{- if $.Values.include }}
{{ printf "%s %s" "%include" $.Values.include }}
{{- end }}

{{ end }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Major: Incorrect value paths in pgbouncer.ini template.

The template has several issues:

  1. Line 77-78: The template iterates over $.Values.pgbouncer, but according to values.yaml, this contains nested structures (image, resources, internalPort, config). It should iterate over $.Values.pgbouncer.config instead.

  2. Line 70: The nested range loop for database parameters lacks proper spacing, producing malformed connection strings like host=localhostport=5432 instead of host=localhost port=5432.

  3. Line 91-93: The %include directive is placed outside the [pgbouncer] section, but it should be inside that section per PgBouncer configuration syntax.

Apply this diff to fix the template:

 {{ define "pgbouncer.ini" }}

 {{/* [databases] section */}}
 {{- if $.Values.databases }}
   {{ printf "[databases]" }}
   {{- range $key, $value := .Values.databases }}
-    {{ $key }} ={{ range $k, $v := $value }} {{ $k }}={{ $v }}{{ end }}
+    {{ $key }} = {{ range $k, $v := $value }}{{ $k }}={{ $v }} {{ end }}
   {{- end }}
 {{- end }}

 {{/* [pgbouncer] section */}}
-{{- if $.Values.pgbouncer }}
+{{- if $.Values.pgbouncer.config }}
   {{ printf "[pgbouncer]" }}
-  {{- range $k, $v := $.Values.pgbouncer }}
+  {{- range $k, $v := $.Values.pgbouncer.config }}
     {{ $k }} = {{ $v }}
   {{- end }}
-{{- end }}
-
-{{/* [users] section */}}
-{{- if $.Values.users }}
-  {{ printf "[users]" }}
-  {{- range $k, $v := $.Values.users }}
-    {{ $k }} = {{ $v }}
-  {{- end }}
-{{- end }}
-
-{{/* include is a special configuration within [pgbouncer] section */}}
-{{- if $.Values.include }}
+  {{/* include is a special configuration within [pgbouncer] section */}}
+  {{- if $.Values.include }}
   {{ printf "%s %s" "%include" $.Values.include }}
+  {{- end }}
 {{- end }}

+{{/* [users] section */}}
+{{- if $.Values.users }}
+  {{ printf "[users]" }}
+  {{- range $k, $v := $.Values.users }}
+    {{ $k }} = {{ $v }}
+  {{- end }}
+{{- end }}
+
 {{ end }}
📝 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
{{ define "pgbouncer.ini" }}
{{/* [databases] section */}}
{{- if $.Values.databases }}
{{ printf "[databases]" }}
{{- range $key, $value := .Values.databases }}
{{ $key }} ={{ range $k, $v := $value }} {{ $k }}={{ $v }}{{ end }}
{{- end }}
{{- end }}
{{/* [pgbouncer] section */}}
{{- if $.Values.pgbouncer }}
{{ printf "[pgbouncer]" }}
{{- range $k, $v := $.Values.pgbouncer }}
{{ $k }} = {{ $v }}
{{- end }}
{{- end }}
{{/* [users] section */}}
{{- if $.Values.users }}
{{ printf "[users]" }}
{{- range $k, $v := $.Values.users }}
{{ $k }} = {{ $v }}
{{- end }}
{{- end }}
{{/* include is a special configuration within [pgbouncer] section */}}
{{- if $.Values.include }}
{{ printf "%s %s" "%include" $.Values.include }}
{{- end }}
{{ end }}
{{ define "pgbouncer.ini" }}
{{/* [databases] section */}}
{{- if $.Values.databases }}
{{ printf "[databases]" }}
{{- range $key, $value := .Values.databases }}
{{ $key }} = {{ range $k, $v := $value }}{{ $k }}={{ $v }} {{ end }}
{{- end }}
{{- end }}
{{/* [pgbouncer] section */}}
{{- if $.Values.pgbouncer.config }}
{{ printf "[pgbouncer]" }}
{{- range $k, $v := .Values.pgbouncer.config }}
{{ $k }} = {{ $v }}
{{- end }}
{{/* include is a special configuration within [pgbouncer] section */}}
{{- if $.Values.include }}
{{ printf "%s %s" "%include" $.Values.include }}
{{- end }}
{{- end }}
{{/* [users] section */}}
{{- if $.Values.users }}
{{ printf "[users]" }}
{{- range $k, $v := .Values.users }}
{{ $k }} = {{ $v }}
{{- end }}
{{- end }}
{{ end }}
🤖 Prompt for AI Agents
In charts/ctrlplane/charts/event-queue/templates/_helpers.tpl around lines 64 to
95, the pgbouncer.ini helper currently iterates the wrong path, emits
concatenated DB params without spaces, and places the %include outside the
[pgbouncer] section; update the template to iterate over
$.Values.pgbouncer.config (not $.Values.pgbouncer) for the [pgbouncer] section,
change the nested database-params range to print each key/value with a trailing
space between pairs (e.g., emit " {{ $k }}={{ $v }} " for each param) so
connection strings have spaces, and move the "%include" line into the
[pgbouncer] section so the include directive is inside that section.

Comment on lines +104 to +116
{{- toYaml .Values.resources | nindent 12 }}
- name: pgbouncer
image: "{{ .Values.pgbouncer.image.repository }}:{{ .Values.pgbouncer.image.tag }}"
imagePullPolicy: "{{ .Values.pgbouncer.image.pullPolicy }}"
ports:
- name: pgbouncer
containerPort: {{ .Values.pgbouncer.internalPort }}
volumeMounts:
- name: config
mountPath: /etc/pgbouncer
readOnly: true
resources:
{{- toYaml .Values.pgbouncer.resources | nindent 12 }}
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

Critical: Missing volumes section in deployment spec.

The pgbouncer container mounts a volume named "config" at /etc/pgbouncer, but there's no volumes section defined in the pod spec to provide this volume. This will cause the pod to fail with a mount error.

Add a volumes section to the pod spec that references the pgbouncer ConfigMap. Insert this after the containers section (around line 117):

+      volumes:
+        - name: config
+          configMap:
+            name: {{ template "pgbouncer.configFile" . }}
📝 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
{{- toYaml .Values.resources | nindent 12 }}
- name: pgbouncer
image: "{{ .Values.pgbouncer.image.repository }}:{{ .Values.pgbouncer.image.tag }}"
imagePullPolicy: "{{ .Values.pgbouncer.image.pullPolicy }}"
ports:
- name: pgbouncer
containerPort: {{ .Values.pgbouncer.internalPort }}
volumeMounts:
- name: config
mountPath: /etc/pgbouncer
readOnly: true
resources:
{{- toYaml .Values.pgbouncer.resources | nindent 12 }}
{{- toYaml .Values.resources | nindent 12 }}
- name: pgbouncer
image: "{{ .Values.pgbouncer.image.repository }}:{{ .Values.pgbouncer.image.tag }}"
imagePullPolicy: "{{ .Values.pgbouncer.image.pullPolicy }}"
ports:
- name: pgbouncer
containerPort: {{ .Values.pgbouncer.internalPort }}
volumeMounts:
- name: config
mountPath: /etc/pgbouncer
readOnly: true
resources:
{{- toYaml .Values.pgbouncer.resources | nindent 12 }}
volumes:
- name: config
configMap:
name: {{ template "pgbouncer.configFile" . }}
🤖 Prompt for AI Agents
In charts/ctrlplane/charts/event-queue/templates/deployment.yaml around lines
104–116 the pgbouncer container mounts a volume named "config" but there is no
corresponding pod.spec.volumes entry; add a volumes section immediately after
the containers block (around line 117) that defines the "config" volume and
sources it from the pgbouncer ConfigMap (use the chart value for the ConfigMap
name if available, e.g. .Values.pgbouncer.configMapName or otherwise the
conventional pgbouncer configmap name) so the /etc/pgbouncer mount is backed by
that ConfigMap.

Comment on lines +4 to +7
name: {{ template "pgbouncer.configFile" . }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "pgbouncer.labels" . | nindent 4 }}
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

Critical: Missing helper template definitions.

This ConfigMap references two helper templates that are not defined in _helpers.tpl:

  • pgbouncer.configFile (line 4)
  • pgbouncer.labels (line 7)

These missing templates will cause the chart to fail during rendering.

Add these helper template definitions to charts/ctrlplane/charts/event-queue/templates/_helpers.tpl:

{{/*
PgBouncer config file name
*/}}
{{- define "pgbouncer.configFile" -}}
{{- printf "%s-pgbouncer-config" (include "event-queue.fullname" .) }}
{{- end }}

{{/*
PgBouncer labels
*/}}
{{- define "pgbouncer.labels" -}}
{{ include "event-queue.labels" . }}
app.kubernetes.io/component: pgbouncer
{{- end }}
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 7-7: syntax error: expected the node content, but found '-'

(syntax)

🤖 Prompt for AI Agents
In charts/ctrlplane/charts/event-queue/templates/pgbouncer.yaml around lines 4
to 7, the ConfigMap references helper templates "pgbouncer.configFile" and
"pgbouncer.labels" which are not defined; add definitions for these helpers into
charts/ctrlplane/charts/event-queue/templates/_helpers.tpl: define
"pgbouncer.configFile" to return a config file name based on the release
fullname (e.g., "%s-pgbouncer-config" using include "event-queue.fullname"), and
define "pgbouncer.labels" to include the existing "event-queue.labels" and
append app.kubernetes.io/component: pgbouncer so rendering succeeds.

limits:
cpu: 500m
memory: 512Mi
internalPort: 6379
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix incorrect internalPort value.

The internalPort is set to 6379 (Redis default port), but it should be 6432 to match the listen_port in the config section (line 26). This inconsistency will cause the container port to not match the actual PgBouncer listening port.

Apply this diff:

-  internalPort: 6379
+  internalPort: 6432
📝 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
internalPort: 6379
internalPort: 6432
🤖 Prompt for AI Agents
In charts/ctrlplane/charts/event-queue/values.yaml around line 23 the
internalPort is incorrectly set to 6379; update that value to 6432 so the
container port matches the PgBouncer listen_port defined in the config (line
26). Make the single-line change replacing 6379 with 6432 to keep ports
consistent.

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: 3

♻️ Duplicate comments (1)
charts/ctrlplane/charts/event-queue/templates/deployment.yaml (1)

122-127: Critical: Missing volumes section in deployment spec.

As noted in a previous review, the pgbouncer container mounts a volume named "config" at /etc/pgbouncer, but there's no volumes section defined in the pod spec to provide this volume. This will cause the pod to fail with a mount error.

The volumes section should be added after the containers block, referencing the pgbouncer ConfigMap.

🧹 Nitpick comments (3)
charts/ctrlplane/charts/workspace-engine/Chart.yaml (1)

1-6: Consider improving chart metadata.

The chart metadata is valid but could be enhanced:

  1. The description is generic ("A Helm chart for Kubernetes"). Consider describing what workspace-engine specifically does.
  2. The appVersion: "1.0.0" appears to be a placeholder. Ensure it matches the actual application version deployed by this chart.

Example improvement:

-description: A Helm chart for Kubernetes
+description: Helm chart for Ctrlplane workspace engine component
 type: application
 version: 0.1.0
-appVersion: "1.0.0"
+appVersion: "1.16.0"
charts/ctrlplane/charts/workspace-engine/templates/statefulset.yaml (1)

1-1: Remove unused variable.

The $imageCfg dict is defined but never used in this template. The image reference on line 41 uses .Values.image.repository and .Values.image.tag directly.

-{{- $imageCfg := dict "global" $.Values.global.image "local" $.Values.image -}}
 apiVersion: apps/v1
charts/ctrlplane/charts/event-queue/templates/deployment.yaml (1)

128-128: Remove extra blank line.

YAMLlint flags an extra blank line here. Remove it for cleaner formatting.

           resources:
             {{- toYaml .Values.pgbouncer.resources | nindent 12 }}
-
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7518662 and 8f43d10.

📒 Files selected for processing (8)
  • charts/ctrlplane/Chart.yaml (2 hunks)
  • charts/ctrlplane/charts/event-queue/templates/deployment.yaml (1 hunks)
  • charts/ctrlplane/charts/workspace-engine/.helmignore (1 hunks)
  • charts/ctrlplane/charts/workspace-engine/Chart.yaml (1 hunks)
  • charts/ctrlplane/charts/workspace-engine/templates/_helpers.tpl (1 hunks)
  • charts/ctrlplane/charts/workspace-engine/templates/serviceaccount.yaml (1 hunks)
  • charts/ctrlplane/charts/workspace-engine/templates/statefulset.yaml (1 hunks)
  • charts/ctrlplane/charts/workspace-engine/values.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • charts/ctrlplane/charts/workspace-engine/values.yaml
  • charts/ctrlplane/charts/workspace-engine/.helmignore
🧰 Additional context used
🪛 GitHub Actions: Lint and Test Charts
charts/ctrlplane/Chart.yaml

[error] 1-1: Failed linting charts: failed building dependencies for chart 'ctrlplane'.

charts/ctrlplane/charts/workspace-engine/templates/serviceaccount.yaml

[error] 1-1: Failed linting charts: failed building dependencies for chart 'ctrlplane' (path: charts/ctrlplane).

charts/ctrlplane/charts/workspace-engine/templates/statefulset.yaml

[error] 1-1: Failed linting charts: failed building dependencies for chart 'ctrlplane' (path: charts/ctrlplane).

charts/ctrlplane/charts/workspace-engine/templates/_helpers.tpl

[error] 1-1: Failed linting charts: failed building dependencies for chart 'ctrlplane' (path: charts/ctrlplane).

charts/ctrlplane/charts/workspace-engine/Chart.yaml

[error] 1-1: Failed linting charts: failed building dependencies for chart 'ctrlplane' (path: charts/ctrlplane).

charts/ctrlplane/charts/event-queue/templates/deployment.yaml

[error] 1-1: Failed linting charts: failed building dependencies for chart 'ctrlplane' (path: charts/ctrlplane).

🪛 YAMLlint (1.37.1)
charts/ctrlplane/charts/workspace-engine/templates/serviceaccount.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


[warning] 10-10: too many spaces after hyphen

(hyphens)


[warning] 14-14: too many spaces after hyphen

(hyphens)

charts/ctrlplane/charts/workspace-engine/templates/statefulset.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


[warning] 9-9: too many spaces after hyphen

(hyphens)


[warning] 13-13: too many spaces after hyphen

(hyphens)


[warning] 28-28: too many spaces after hyphen

(hyphens)

charts/ctrlplane/charts/event-queue/templates/deployment.yaml

[warning] 128-128: too many blank lines (1 > 0)

(empty-lines)

🔇 Additional comments (4)
charts/ctrlplane/Chart.yaml (2)

5-5: LGTM! Chart version bumped appropriately.

The version increment from 0.4.4 to 0.4.5 follows semantic versioning for a minor feature addition.


42-45: Run Helm lint in an environment with Helm installed

  • charts/ctrlplane/charts/workspace-engine contains a valid Chart.yaml (apiVersion: v2, version: 0.1.0), values.yaml, and templates/_helpers.tpl.
  • Helm CLI wasn’t available in the verification sandbox, so lint errors remain unknown.
  • Please execute:
    1. helm lint charts/ctrlplane/charts/workspace-engine
    2. helm dependency build charts/ctrlplane && helm lint charts/ctrlplane
      to identify and fix the underlying chart validation issues.
charts/ctrlplane/charts/workspace-engine/templates/serviceaccount.yaml (1)

1-16: LGTM! ServiceAccount template is well-structured.

The template correctly:

  • Conditionally creates the ServiceAccount based on values
  • Uses workspace-engine helpers for consistent naming and labeling
  • Supports custom labels and annotations
  • Explicitly sets the namespace

The YAMLlint warnings are false positives for Helm template syntax.

charts/ctrlplane/charts/workspace-engine/templates/_helpers.tpl (1)

1-63: LGTM! Helper templates follow Helm best practices.

The helper templates are well-structured and follow standard Helm conventions:

  • Proper name truncation and suffix trimming
  • Correct fullname deduplication logic
  • Standard label generation with version and managed-by fields
  • Conditional service account name resolution

These helpers integrate correctly with the ServiceAccount and StatefulSet templates.

Comment on lines +99 to +108
- name: WORKSPACE_ENGINE_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: WORKSPACE_ENGINE_STATEFUL_SET_NAME
value: {{ .Chart.Name }}-engine
- name: WORKSPACE_ENGINE_HEADLESS_SERVICE
value: {{ .Release.Name }}-engine
- name: WORKSPACE_ENGINE_PORT
value: "8081"
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

🧩 Analysis chain

Verify WORKSPACE_ENGINE_STATEFUL_SET_NAME value.

The WORKSPACE_ENGINE_STATEFUL_SET_NAME uses {{ .Chart.Name }}-engine, which evaluates to event-queue-engine. However, based on the workspace-engine StatefulSet template (line 5 in statefulset.yaml), the actual name is {{ .Release.Name }}-engine.

Ensure this value correctly references the workspace-engine StatefulSet. If workspace-engine is deployed as a subchart under the same release, the name should be {{ .Release.Name }}-engine, not {{ .Chart.Name }}-engine.


🏁 Script executed:

#!/bin/bash
# Check the StatefulSet naming pattern in workspace-engine

echo "=== workspace-engine StatefulSet name template ==="
rg -n "name:.*-engine" charts/ctrlplane/charts/workspace-engine/templates/statefulset.yaml

echo -e "\n=== event-queue WORKSPACE_ENGINE_STATEFUL_SET_NAME ==="
rg -n "WORKSPACE_ENGINE_STATEFUL_SET_NAME" charts/ctrlplane/charts/event-queue/templates/deployment.yaml -A 1

Length of output: 288


Use .Release.Name for WORKSPACE_ENGINE_STATEFUL_SET_NAME
Change the value from {{ .Chart.Name }}-engine to {{ .Release.Name }}-engine so it matches the workspace-engine StatefulSet naming.

- value: {{ .Chart.Name }}-engine
+ value: {{ .Release.Name }}-engine
📝 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
- name: WORKSPACE_ENGINE_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: WORKSPACE_ENGINE_STATEFUL_SET_NAME
value: {{ .Chart.Name }}-engine
- name: WORKSPACE_ENGINE_HEADLESS_SERVICE
value: {{ .Release.Name }}-engine
- name: WORKSPACE_ENGINE_PORT
value: "8081"
- name: WORKSPACE_ENGINE_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: WORKSPACE_ENGINE_STATEFUL_SET_NAME
value: {{ .Release.Name }}-engine
- name: WORKSPACE_ENGINE_HEADLESS_SERVICE
value: {{ .Release.Name }}-engine
- name: WORKSPACE_ENGINE_PORT
value: "8081"
🤖 Prompt for AI Agents
In charts/ctrlplane/charts/event-queue/templates/deployment.yaml around lines 99
to 108, the WORKSPACE_ENGINE_STATEFUL_SET_NAME environment var is set to {{
.Chart.Name }}-engine but should use the release name; update the value to {{
.Release.Name }}-engine so it matches the workspace-engine StatefulSet naming
convention and keep the other env entries unchanged.

Comment on lines +18 to +21
selector:
matchLabels:
{{- include "ctrlplane.selectorLabels" $ | nindent 6 }}
{{- include "workspace-engine.labels" . | nindent 6 }}
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

🧩 Analysis chain

Verify mixed selector labels usage.

The selector combines ctrlplane.selectorLabels (from parent chart) with workspace-engine.labels (from local chart). Ensure this is intentional and that:

  1. The parent chart's selector labels are appropriate for this subchart's pods
  2. The combined labels don't create conflicts or overly broad selectors
  3. Services and other resources can correctly select these pods

Run this script to examine the label structure:


🏁 Script executed:

#!/bin/bash
# Check what labels are generated by both helpers

echo "=== Checking ctrlplane helpers ==="
rg -n "define \"ctrlplane.selectorLabels\"" -A 10

echo -e "\n=== Checking workspace-engine helpers ==="
rg -n "define \"workspace-engine.labels\"" -A 10 charts/ctrlplane/charts/workspace-engine/

echo -e "\n=== Checking other uses of ctrlplane.selectorLabels in workspace-engine ==="
rg "ctrlplane.selectorLabels" charts/ctrlplane/charts/workspace-engine/

Length of output: 2202


🏁 Script executed:

#!/bin/bash
# Locate workspace-engine.selectorLabels definition
rg -n "define \"workspace-engine.selectorLabels\"" -A10 -B3 charts/ctrlplane/charts/workspace-engine/templates/_helpers.tpl

Length of output: 472


Remove duplicate selector labels.

The StatefulSet’s matchLabels merges ctrlplane.selectorLabels and workspace-engine.labels, but both define app.kubernetes.io/name and app.kubernetes.io/instance, causing duplicate keys and invalid YAML. Use only one selector helper (e.g. workspace-engine.selectorLabels) or adjust label definitions to avoid collisions.

🤖 Prompt for AI Agents
In charts/ctrlplane/charts/workspace-engine/templates/statefulset.yaml around
lines 18 to 21, the matchLabels block currently includes both
ctrlplane.selectorLabels and workspace-engine.labels which both set
app.kubernetes.io/name and app.kubernetes.io/instance, causing duplicate keys
and invalid YAML; fix by using only one selector helper (e.g. replace the two
includes with a single include of workspace-engine.selectorLabels) or modify the
helpers so only one provides selector labels (move non-selector metadata into
workspace-engine.labels and keep selector-only keys in
workspace-engine.selectorLabels) so matchLabels contains a single,
non-duplicated set of keys.

Comment on lines +53 to +54
- name: KAFKA_PARTITION_ID
value: "$(echo $POD_NAME | sed 's/.*-//')"
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

Critical: Shell substitution in env var value won't execute.

The KAFKA_PARTITION_ID environment variable contains a shell command that won't be executed by Kubernetes. The literal string "$(echo $POD_NAME | sed 's/.*-//')" will be passed as the value, not the result of the command.

To extract the StatefulSet pod ordinal, consider these solutions:

Solution 1: Use a wrapper script in command/args

           env:
             - name: POD_NAME
               valueFrom:
                 fieldRef:
                   fieldPath: metadata.name
-            - name: KAFKA_PARTITION_ID
-              value: "$(echo $POD_NAME | sed 's/.*-//')"
+          command:
+            - /bin/sh
+            - -c
+            - |
+              export KAFKA_PARTITION_ID=$(echo $POD_NAME | sed 's/.*-//')
+              exec /your-app-binary

Solution 2: Extract in application code
Remove the KAFKA_PARTITION_ID env var and have the application extract the ordinal from POD_NAME directly.

Solution 3: Use an initContainer
Create an initContainer that computes the partition ID and writes it to a shared volume, then read it in the main container.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In charts/ctrlplane/charts/workspace-engine/templates/statefulset.yaml around
lines 53-54, the KAFKA_PARTITION_ID env var currently contains a shell
substitution string that Kubernetes will not execute; replace this with a
working solution such as: remove the literal substitution and either (a) add a
small wrapper script as the container entrypoint that reads POD_NAME, computes
the ordinal (e.g., strip prefix up to last dash), exports KAFKA_PARTITION_ID and
execs the app; or (b) change the application to compute the partition from the
POD_NAME env var at startup; alternatively, implement an initContainer that
writes the computed partition to a shared emptyDir file which the main container
reads into KAFKA_PARTITION_ID—pick one approach and update the StatefulSet to
remove the non-executed shell string and wire the chosen mechanism.

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.

1 participant