-
Notifications
You must be signed in to change notification settings - Fork 0
init #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds 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
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`
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests
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. Comment |
There was a problem hiding this 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.
📒 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_URLenvironment variable, you should add something like:databases: "*": "host=your-postgres-host port=5432 dbname=your-db"Additionally, ensure the event-queue container's
POSTGRES_URLenvironment variable (line 69-73 in deployment.yaml) is updated to point tolocalhost:6432instead of the direct PostgreSQL connection, so it routes through PgBouncer.
| {{ 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 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Major: Incorrect value paths in pgbouncer.ini template.
The template has several issues:
-
Line 77-78: The template iterates over
$.Values.pgbouncer, but according tovalues.yaml, this contains nested structures (image,resources,internalPort,config). It should iterate over$.Values.pgbouncer.configinstead. -
Line 70: The nested range loop for database parameters lacks proper spacing, producing malformed connection strings like
host=localhostport=5432instead ofhost=localhost port=5432. -
Line 91-93: The
%includedirective 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.
| {{ 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.
| {{- 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 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| {{- 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.
| name: {{ template "pgbouncer.configFile" . }} | ||
| namespace: {{ $.Release.Namespace }} | ||
| labels: | ||
| {{- include "pgbouncer.labels" . | nindent 4 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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.
There was a problem hiding this 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 novolumessection 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:
- The description is generic ("A Helm chart for Kubernetes"). Consider describing what workspace-engine specifically does.
- 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
$imageCfgdict is defined but never used in this template. The image reference on line 41 uses.Values.image.repositoryand.Values.image.tagdirectly.-{{- $imageCfg := dict "global" $.Values.global.image "local" $.Values.image -}} apiVersion: apps/v1charts/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.
📒 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:
helm lint charts/ctrlplane/charts/workspace-enginehelm 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.
| - 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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 1Length 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.
| - 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.
| selector: | ||
| matchLabels: | ||
| {{- include "ctrlplane.selectorLabels" $ | nindent 6 }} | ||
| {{- include "workspace-engine.labels" . | nindent 6 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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:
- The parent chart's selector labels are appropriate for this subchart's pods
- The combined labels don't create conflicts or overly broad selectors
- 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.tplLength 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.
| - name: KAFKA_PARTITION_ID | ||
| value: "$(echo $POD_NAME | sed 's/.*-//')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-binarySolution 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.
Summary by CodeRabbit