Skip to content

feat: add aisix Helm chart#278

Open
AlinsRan wants to merge 11 commits intomainfrom
feat/aisix-helm-chart-clean
Open

feat: add aisix Helm chart#278
AlinsRan wants to merge 11 commits intomainfrom
feat/aisix-helm-chart-clean

Conversation

@AlinsRan
Copy link
Copy Markdown
Contributor

@AlinsRan AlinsRan commented Apr 15, 2026

Summary

  • Adds a new charts/aisix/ Helm chart for deploying AISIX AI Gateway on Kubernetes
  • Bundles bitnami/etcd as an optional subchart (enabled by default)
  • Exposes proxy port (3000) via configurable Service (NodePort by default) and admin port (3001) via ClusterIP
  • Supports admin key via values or existing Kubernetes Secret
  • Includes HPA, Ingress, and ServiceAccount templates
  • Implements the "Kubernetes Helm chart" Roadmap item in the aisix project

Chart Structure

charts/aisix/
├── Chart.yaml           # name: aisix, version: 0.1.0, appVersion: "0.1"
├── Chart.lock
├── .helmignore
├── values.yaml
├── README.md
└── templates/
    ├── _helpers.tpl
    ├── NOTES.txt
    ├── configmap.yaml      # renders /etc/aisix/config.yaml
    ├── deployment.yaml
    ├── serviceaccount.yaml
    ├── service-proxy.yaml  # port 3000
    ├── service-admin.yaml  # port 3001
    ├── ingress.yaml
    ├── ingress-admin.yaml
    └── hpa.yaml

How to Test

helm dependency update charts/aisix
helm lint charts/aisix
helm template test-aisix charts/aisix --set 'deployment.admin.adminKey[0].key=testkey'

Quick Install

helm install my-aisix ./charts/aisix \
  --set 'deployment.admin.adminKey[0].key=your-strong-key'

Summary by CodeRabbit

  • New Features

    • Added AISIX Helm chart to deploy AISIX on Kubernetes with configurable image, replicas, autoscaling, bundled or external etcd, service account/security options, ConfigMap/Secret support, and optional HPA.
    • Configurable proxy and admin surfaces (NodePort/LoadBalancer/ClusterIP), optional TLS, ingress routing, and port-forward fallback; admin UI/API and gateway services included.
  • Documentation

    • Chart README added and top-level Projects entry updated; includes install/uninstall examples, config reference, and post-install NOTES with usage commands.

Copilot AI review requested due to automatic review settings April 15, 2026 09:21
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new Helm chart "aisix" with chart metadata, values, helpers, Kubernetes templates (Deployment, Services, Ingresses, HPA, ServiceAccount, ConfigMap, Secret), NOTES, .helmignore, and a README entry linking the chart from the repo root.

Changes

Cohort / File(s) Summary
Top-level docs
README.md
Added aisix entry linking to ./charts/aisix/README.md.
Chart metadata & packaging
charts/aisix/Chart.yaml, charts/aisix/.helmignore
New Chart.yaml (apiVersion v2, application, version 0.1.0, maintainer, etcd dependency v8.7.7 with condition) and .helmignore with common ignore patterns.
Chart docs & notes
charts/aisix/README.md, charts/aisix/templates/NOTES.txt
Added chart README with install/usage/config examples; NOTES.txt renders post-install instructions and resolves Proxy/Admin URLs for ingress, NodePort, LoadBalancer, or port-forward scenarios.
Helpers
charts/aisix/templates/_helpers.tpl
New named templates for name/fullname, labels, selectorLabels, serviceAccountName, etcd scheme and hosts generation used across templates.
Configuration
charts/aisix/templates/configmap.yaml, charts/aisix/values.yaml
ConfigMap template renders /etc/aisix/config.yaml (etcd hosts/prefix/timeout, admin key placeholder, server listen settings); comprehensive values.yaml for image, deployment, autoscaling, services, ingress, admin, and bundled etcd settings.
Workload
charts/aisix/templates/deployment.yaml
Deployment template with replicas/strategy, pod annotations/labels, image, probes, env (admin key via existing Secret or generated Secret), config mount, extra volumes/mounts, initContainers, resources, and scheduling options.
Secrets
charts/aisix/templates/secret.yaml
Conditional Secret manifest for admin key when admin enabled and no existingSecret provided.
Autoscaling
charts/aisix/templates/hpa.yaml
Conditional HPA template (v2 or v2beta schema) when autoscaling enabled; supports CPU/memory utilization metrics.
Services
charts/aisix/templates/service-proxy.yaml, charts/aisix/templates/service-admin.yaml
Proxy and admin Service templates with configurable type, ports, externalTrafficPolicy, externalIPs, annotations, and selectors.
Ingresses
charts/aisix/templates/ingress.yaml, charts/aisix/templates/ingress-admin.yaml
Conditional Ingress templates for gateway and admin with per-host path rules, TLS and annotations support.
ServiceAccount
charts/aisix/templates/serviceaccount.yaml
Conditional ServiceAccount template (created when serviceAccount.create is true) with labels and optional annotations.

Sequence Diagram(s)

sequenceDiagram
    participant Operator as "Operator (helm)"
    participant Chart as "Helm Chart (aisix)"
    participant Kube as "Kubernetes API"
    participant Pod as "AISIX Pod"
    participant Etcd as "etcd (bundled/external)"

    Operator->>Chart: helm install/upgrade
    Chart->>Kube: render & apply manifests (ServiceAccount, Services, ConfigMap, Secret, Deployment, Ingress, HPA)
    Kube-->>Chart: acknowledge resources
    Kube->>Pod: schedule & start pod(s)
    Pod->>Kube: mount ConfigMap/Secret, become ready
    Pod->>Etcd: connect using configured hosts/scheme
    Etcd-->>Pod: respond to requests
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • nic-6443

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Security Check ❌ Error Helm chart contains two critical security vulnerabilities: TLS hard-coded to false for proxy service with no configuration option, and conditional secret creation incompatible with unconditional deployment reference. Make server.proxy.tls.enabled configurable via values.yaml with secure default, and remove admin.enabled condition from secret.yaml to ensure consistent secret creation.
E2e Test Quality Review ⚠️ Warning PR adds Helm chart for AISIX but contains zero automated tests, violating E2E test completeness requirement and unresolved review comments. Create E2E tests in charts/aisix/templates/tests/ directory with test Pod manifests for default installation, external etcd, ConfigMap/Secret creation, and Service discovery. Resolve unresolved review comments regarding etcd.enabled default and Secret generation conditioning.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and directly describes the main change: adding a new Helm chart for the AISIX application, which is the primary objective of this PR.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/aisix-helm-chart-clean

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

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

Adds a new charts/aisix Helm chart to deploy AISIX AI Gateway on Kubernetes, including optional bundled etcd and standard Kubernetes resources (Deployment/Services/Ingress/HPA/SA).

Changes:

  • Introduces a complete AISIX Helm chart (Chart.yaml/values.yaml/templates/README/NOTES) with proxy + admin endpoints.
  • Adds bitnami/etcd as an optional dependency (vendored .tgz + Chart.lock).
  • Updates the repo root README to list the new chart.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
charts/aisix/Chart.yaml Defines the AISIX chart metadata and etcd dependency.
charts/aisix/Chart.lock Locks the etcd dependency version/digest.
charts/aisix/.helmignore Helm ignore patterns for chart packaging.
charts/aisix/README.md Chart usage and configuration documentation.
charts/aisix/values.yaml Default configuration for AISIX, services, ingress, autoscaling, and etcd subchart.
charts/aisix/templates/_helpers.tpl Naming/label helpers and etcd host construction helper.
charts/aisix/templates/configmap.yaml Renders AISIX config file into a ConfigMap.
charts/aisix/templates/deployment.yaml Deploys AISIX pod(s) and mounts config/env/ports.
charts/aisix/templates/service-proxy.yaml Exposes proxy port (3000) via configurable Service.
charts/aisix/templates/service-admin.yaml Exposes admin port (3001) via Service.
charts/aisix/templates/ingress.yaml Optional Ingress for the proxy service.
charts/aisix/templates/ingress-admin.yaml Optional Ingress for the admin service.
charts/aisix/templates/hpa.yaml Optional HorizontalPodAutoscaler.
charts/aisix/templates/serviceaccount.yaml Optional ServiceAccount.
charts/aisix/templates/NOTES.txt Post-install instructions for accessing proxy/admin endpoints.
charts/aisix/charts/etcd-8.7.7.tgz Vendored etcd subchart archive.
README.md Adds AISIX to the list of available charts.

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

Comment thread charts/aisix/templates/hpa.yaml Outdated
Comment on lines +1 to +6
{{- if .Values.autoscaling.enabled }}
{{- if eq .Values.autoscaling.version "v2" }}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v2beta1
{{- end }}
Comment on lines +24 to +35
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
Comment thread charts/aisix/templates/deployment.yaml Outdated
spec:
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Comment thread charts/aisix/templates/deployment.yaml Outdated
Comment on lines +88 to +91
{{- if .Values.extraEnvVarsCM }}
envFrom:
- configMapRef:
name: {{ .Values.extraEnvVarsCM }}
Comment thread charts/aisix/templates/configmap.yaml Outdated
Comment on lines +18 to +22
{{- if .Values.deployment.admin.existingSecret }}
- key: "{{"{{"}}AISIX_ADMIN_KEY{{"}}"}}"
{{- else }}
{{- toYaml .Values.deployment.admin.adminKey | nindent 10 }}
{{- end }}
Comment thread charts/aisix/values.yaml Outdated
Comment on lines +94 to +96
# IMPORTANT: change this before deploying to production.
adminKey:
- key: "changeme"
Comment on lines +22 to +26
paths:
{{- range .paths }}
- path: {{ . }}
pathType: Prefix
backend:
Copy link
Copy Markdown

@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

🧹 Nitpick comments (7)
charts/aisix/README.md (1)

16-18: Prefer non-CLI secret flow in primary install examples.

Passing admin keys through --set is easy to leak via shell history/process inspection. Recommend making the existing-Secret path the primary example, and if retaining CLI examples, use --set-string with a brief caution.

Also applies to: 61-64

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/README.md` around lines 16 - 18, Change the primary install
example to use the existing-Secret flow instead of passing secrets on the CLI:
show how to reference an existing Kubernetes Secret for
deployment.admin.adminKey (e.g., point to the existing Secret key name and
secretKeyRef) as the top example, and if you keep the CLI variant that uses
deployment.admin.adminKey[0].key, switch it to using --set-string and add a
one-line caution about shell-history/process-list leakage; update the examples
around the same area (including the other occurrences at lines 61-64) so they
consistently prefer the Secret-based approach and include the --set-string +
caution only as an alternative.
charts/aisix/templates/ingress.yaml (1)

13-17: Add ingressClassName support for better cluster compatibility.

Without an explicit class, some controllers may ignore this Ingress depending on cluster defaults.

Suggested patch
 spec:
+  {{- with .Values.ingress.ingressClassName }}
+  ingressClassName: {{ . | quote }}
+  {{- end }}
   {{- if .Values.ingress.tls }}
   tls:
     {{- toYaml .Values.ingress.tls | nindent 4 }}
   {{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/ingress.yaml` around lines 13 - 17, The Ingress
manifest currently only injects TLS and lacks support for an explicit ingress
class; update the Ingress spec to conditionally set spec.ingressClassName from a
value like .Values.ingress.className when provided. Modify the template around
the spec (near the existing .Values.ingress.tls block in
charts/aisix/templates/ingress.yaml) to include a conditional that emits
"ingressClassName: {{ .Values.ingress.className }}" only when
.Values.ingress.className is set, preserving indentation and not changing the
existing TLS logic.
charts/aisix/templates/ingress-admin.yaml (1)

13-17: Mirror ingressClassName support in admin Ingress.

For consistency and controller compatibility, add class selection here as well.

Suggested patch
 spec:
+  {{- with .Values.adminIngress.ingressClassName }}
+  ingressClassName: {{ . | quote }}
+  {{- end }}
   {{- if .Values.adminIngress.tls }}
   tls:
     {{- toYaml .Values.adminIngress.tls | nindent 4 }}
   {{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/ingress-admin.yaml` around lines 13 - 17, Add support
for ingressClassName in the admin Ingress spec so it mirrors the main Ingress
behavior; update the ingress-admin.yaml template to conditionally emit the
spec.ingressClassName when .Values.adminIngress.ingressClassName is set (use the
same conditional pattern as the tls block and proper indentation via nindent),
referencing .Values.adminIngress.ingressClassName and the template name
ingress-admin.yaml to locate the place to insert the field while keeping the
existing tls handling intact.
charts/aisix/templates/NOTES.txt (1)

1-3: Pod listing may match pods from other releases.

The label selector only uses app.kubernetes.io/name, which could match pods from different Helm releases of the same chart. For consistency with the pod selection on lines 18 and 29, include both labels.

Proposed fix
 AISIX has been installed. Check its status by running:
-  kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/name={{ include "aisix.name" . }}"
+  kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/name={{ include "aisix.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/NOTES.txt` around lines 1 - 3, The kubectl pod
selector in NOTES.txt uses only app.kubernetes.io/name and may match pods from
other releases; update the selector to include both labels used elsewhere (the
chart name and the release instance) by changing the -l selector to include
app.kubernetes.io/name={{ include "aisix.name" . }} and
app.kubernetes.io/instance={{ .Release.Name }} so it targets only pods from this
release.
charts/aisix/templates/deployment.yaml (2)

76-77: Consider making RUST_LOG configurable.

The log level is hardcoded to "info". Making this configurable via values would allow users to adjust logging verbosity for debugging.

Proposed change

In values.yaml:

# -- Rust log level (e.g., info, debug, warn, error)
rustLogLevel: "info"

In deployment.yaml:

             - name: RUST_LOG
-              value: "info"
+              value: {{ .Values.rustLogLevel | default "info" | quote }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/deployment.yaml` around lines 76 - 77, Make RUST_LOG
configurable by adding a new values entry rustLogLevel (default "info") in
values.yaml and update the deployment template so the RUST_LOG env var uses that
value (e.g., reference .Values.rustLogLevel and use a Helm default fallback to
"info" if absent); change the env var setting for RUST_LOG in deployment.yaml to
read from the Helm value instead of the hardcoded "info" so users can override
log level at deploy time.

35-49: Consider providing secure default security contexts.

Trivy flags that the container lacks readOnlyRootFilesystem and uses default security context. While the chart allows customization via .Values.securityContext and .Values.podSecurityContext, providing secure defaults would improve the out-of-box security posture.

Proposed secure defaults in values.yaml
podSecurityContext:
  runAsNonRoot: true
  seccompProfile:
    type: RuntimeDefault

securityContext:
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities:
    drop:
      - ALL

If the AISIX container requires a writable filesystem, set readOnlyRootFilesystem: false or add an emptyDir volume for writable paths.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/deployment.yaml` around lines 35 - 49, The deployment
lacks secure default security contexts; update the chart by adding safe defaults
in values.yaml for podSecurityContext (e.g., runAsNonRoot: true,
seccompProfile.type: RuntimeDefault) and for securityContext (e.g.,
allowPrivilegeEscalation: false, readOnlyRootFilesystem: true,
capabilities.drop: [ALL]) and ensure the template continues to honor
.Values.podSecurityContext and .Values.securityContext (using Helm's
default/merge behavior) so these defaults apply when the user doesn't override
them; if the container truly needs writable paths, document setting
readOnlyRootFilesystem: false or mount an emptyDir for those paths.
charts/aisix/values.yaml (1)

168-187: Consider noting that etcd RBAC is disabled by default.

The etcd subchart has auth.rbac.create: false which means no authentication is required to access etcd. While this simplifies initial setup, it may be a security concern in multi-tenant clusters. Consider adding a comment noting this should be enabled for production deployments.

Proposed documentation improvement
 etcd:
   # -- Install etcd as a subchart. Set false to use an external etcd.
   enabled: true
   image:
     repository: bitnami/etcd
   auth:
     rbac:
+      # -- Enable RBAC authentication for etcd. Recommended for production.
       create: false
       rootPassword: ""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/values.yaml` around lines 168 - 187, The values.yaml currently
sets etcd.auth.rbac.create: false which disables etcd RBAC by default; update
the etcd section (etcd, auth.rbac.create) to include a short inline comment
above or beside that key stating that RBAC is disabled by default and
recommending enabling etcd RBAC (set auth.rbac.create: true and configure
auth.tls/existingSecret) for production or multi-tenant clusters to avoid
unauthenticated access.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@charts/aisix/README.md`:
- Line 3: The README sentence "A Helm chart for
[AISIX](https://github.com/api7/aisix) — an open source, high-performance AI
Gateway and LLM proxy built in Rust." uses "open source" and should be
hyphenated; update that sentence to read "open-source" (i.e., change "an open
source" to "an open-source") so the README text uses standard hyphenation.

In `@charts/aisix/templates/hpa.yaml`:
- Around line 2-36: The HPA template conditionally emits autoscaling/v2beta1
when .Values.autoscaling.version != "v2", which produces an incompatible metrics
schema; update the HorizontalPodAutoscaler template (the apiVersion block in the
HPA template that checks .Values.autoscaling.version) to always emit apiVersion:
autoscaling/v2 and remove the conditional branch for v2beta1, and also remove
the .Values.autoscaling.version option from values.yaml (or set it as fixed to
"v2") so the chart no longer exposes or depends on the deprecated v2beta1 path.

In `@charts/aisix/values.yaml`:
- Around line 74-77: The chart defines Values.extraEnvVarsSecret but the
Deployment template only consumes extraEnvVarsCM; update the Deployment template
(the container spec that references extraEnvVarsCM/extraEnvVars) to also
conditionally include an envFrom entry for a secret when
.Values.extraEnvVarsSecret is set (e.g. add a conditional block that appends -
secretRef: name: {{ .Values.extraEnvVarsSecret }} to the container.envFrom so
both ConfigMap and Secret can be specified together), ensuring it safely handles
empty values and preserves existing extraEnvVars and extraEnvVarsCM behavior.

---

Nitpick comments:
In `@charts/aisix/README.md`:
- Around line 16-18: Change the primary install example to use the
existing-Secret flow instead of passing secrets on the CLI: show how to
reference an existing Kubernetes Secret for deployment.admin.adminKey (e.g.,
point to the existing Secret key name and secretKeyRef) as the top example, and
if you keep the CLI variant that uses deployment.admin.adminKey[0].key, switch
it to using --set-string and add a one-line caution about
shell-history/process-list leakage; update the examples around the same area
(including the other occurrences at lines 61-64) so they consistently prefer the
Secret-based approach and include the --set-string + caution only as an
alternative.

In `@charts/aisix/templates/deployment.yaml`:
- Around line 76-77: Make RUST_LOG configurable by adding a new values entry
rustLogLevel (default "info") in values.yaml and update the deployment template
so the RUST_LOG env var uses that value (e.g., reference .Values.rustLogLevel
and use a Helm default fallback to "info" if absent); change the env var setting
for RUST_LOG in deployment.yaml to read from the Helm value instead of the
hardcoded "info" so users can override log level at deploy time.
- Around line 35-49: The deployment lacks secure default security contexts;
update the chart by adding safe defaults in values.yaml for podSecurityContext
(e.g., runAsNonRoot: true, seccompProfile.type: RuntimeDefault) and for
securityContext (e.g., allowPrivilegeEscalation: false, readOnlyRootFilesystem:
true, capabilities.drop: [ALL]) and ensure the template continues to honor
.Values.podSecurityContext and .Values.securityContext (using Helm's
default/merge behavior) so these defaults apply when the user doesn't override
them; if the container truly needs writable paths, document setting
readOnlyRootFilesystem: false or mount an emptyDir for those paths.

In `@charts/aisix/templates/ingress-admin.yaml`:
- Around line 13-17: Add support for ingressClassName in the admin Ingress spec
so it mirrors the main Ingress behavior; update the ingress-admin.yaml template
to conditionally emit the spec.ingressClassName when
.Values.adminIngress.ingressClassName is set (use the same conditional pattern
as the tls block and proper indentation via nindent), referencing
.Values.adminIngress.ingressClassName and the template name ingress-admin.yaml
to locate the place to insert the field while keeping the existing tls handling
intact.

In `@charts/aisix/templates/ingress.yaml`:
- Around line 13-17: The Ingress manifest currently only injects TLS and lacks
support for an explicit ingress class; update the Ingress spec to conditionally
set spec.ingressClassName from a value like .Values.ingress.className when
provided. Modify the template around the spec (near the existing
.Values.ingress.tls block in charts/aisix/templates/ingress.yaml) to include a
conditional that emits "ingressClassName: {{ .Values.ingress.className }}" only
when .Values.ingress.className is set, preserving indentation and not changing
the existing TLS logic.

In `@charts/aisix/templates/NOTES.txt`:
- Around line 1-3: The kubectl pod selector in NOTES.txt uses only
app.kubernetes.io/name and may match pods from other releases; update the
selector to include both labels used elsewhere (the chart name and the release
instance) by changing the -l selector to include app.kubernetes.io/name={{
include "aisix.name" . }} and app.kubernetes.io/instance={{ .Release.Name }} so
it targets only pods from this release.

In `@charts/aisix/values.yaml`:
- Around line 168-187: The values.yaml currently sets etcd.auth.rbac.create:
false which disables etcd RBAC by default; update the etcd section (etcd,
auth.rbac.create) to include a short inline comment above or beside that key
stating that RBAC is disabled by default and recommending enabling etcd RBAC
(set auth.rbac.create: true and configure auth.tls/existingSecret) for
production or multi-tenant clusters to avoid unauthenticated access.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 32a909d1-9c36-4fb1-9e8d-02355d5bc46c

📥 Commits

Reviewing files that changed from the base of the PR and between 8e20c00 and 73965e7.

⛔ Files ignored due to path filters (1)
  • charts/aisix/Chart.lock is excluded by !**/*.lock
📒 Files selected for processing (16)
  • README.md
  • charts/aisix/.helmignore
  • charts/aisix/Chart.yaml
  • charts/aisix/README.md
  • charts/aisix/charts/etcd-8.7.7.tgz
  • charts/aisix/templates/NOTES.txt
  • charts/aisix/templates/_helpers.tpl
  • charts/aisix/templates/configmap.yaml
  • charts/aisix/templates/deployment.yaml
  • charts/aisix/templates/hpa.yaml
  • charts/aisix/templates/ingress-admin.yaml
  • charts/aisix/templates/ingress.yaml
  • charts/aisix/templates/service-admin.yaml
  • charts/aisix/templates/service-proxy.yaml
  • charts/aisix/templates/serviceaccount.yaml
  • charts/aisix/values.yaml

Comment thread charts/aisix/README.md Outdated
Comment thread charts/aisix/templates/hpa.yaml Outdated
Comment on lines +2 to +36
{{- if eq .Values.autoscaling.version "v2" }}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v2beta1
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "aisix.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "aisix.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "aisix.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

When was autoscaling/v2beta1 removed from Kubernetes?

💡 Result:

The autoscaling/v2beta1 API version (HorizontalPodAutoscaler) was removed from Kubernetes in version 1.25, meaning it is no longer served by the API server starting with Kubernetes v1.25.

Citations:


HPA metrics schema incompatible with v2beta1 API version.

The metrics definition uses the autoscaling/v2 schema (with target.type and target.averageUtilization), but this template can also render as autoscaling/v2beta1 based on .Values.autoscaling.version. The v2beta1 API expects targetAverageUtilization directly on the resource object, not nested under target.

Since v2beta1 was deprecated in Kubernetes 1.23 and removed in 1.25, remove the v2beta1 option entirely and always use autoscaling/v2.

Proposed fix: Remove v2beta1 support
 {{- if .Values.autoscaling.enabled }}
-{{- if eq .Values.autoscaling.version "v2" }}
 apiVersion: autoscaling/v2
-{{- else }}
-apiVersion: autoscaling/v2beta1
-{{- end }}
 kind: HorizontalPodAutoscaler

Also update values.yaml to remove the version option:

 autoscaling:
   enabled: false
-  # -- HPA version, the value is "v2" or "v2beta1", default "v2"
-  version: v2
   minReplicas: 1
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/hpa.yaml` around lines 2 - 36, The HPA template
conditionally emits autoscaling/v2beta1 when .Values.autoscaling.version !=
"v2", which produces an incompatible metrics schema; update the
HorizontalPodAutoscaler template (the apiVersion block in the HPA template that
checks .Values.autoscaling.version) to always emit apiVersion: autoscaling/v2
and remove the conditional branch for v2beta1, and also remove the
.Values.autoscaling.version option from values.yaml (or set it as fixed to "v2")
so the chart no longer exposes or depends on the deprecated v2beta1 path.

Comment thread charts/aisix/values.yaml
Comment on lines +74 to +77
# -- Additional environment variables
extraEnvVars: []
extraEnvVarsCM: ""
extraEnvVarsSecret: ""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

extraEnvVarsSecret is defined but not used in deployment.yaml.

The extraEnvVarsSecret value is documented here but the Deployment template only uses extraEnvVarsCM (for ConfigMap) and doesn't include logic to load environment variables from a Secret.

Proposed fix in deployment.yaml (lines 88-92)
           {{- if .Values.extraEnvVarsCM }}
           envFrom:
             - configMapRef:
                 name: {{ .Values.extraEnvVarsCM }}
+          {{- end }}
+          {{- if .Values.extraEnvVarsSecret }}
+            - secretRef:
+                name: {{ .Values.extraEnvVarsSecret }}
           {{- end }}

Or if both can be specified together:

+          {{- if or .Values.extraEnvVarsCM .Values.extraEnvVarsSecret }}
+          envFrom:
           {{- if .Values.extraEnvVarsCM }}
-          envFrom:
             - configMapRef:
                 name: {{ .Values.extraEnvVarsCM }}
           {{- end }}
+          {{- if .Values.extraEnvVarsSecret }}
+            - secretRef:
+                name: {{ .Values.extraEnvVarsSecret }}
+          {{- end }}
+          {{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/values.yaml` around lines 74 - 77, The chart defines
Values.extraEnvVarsSecret but the Deployment template only consumes
extraEnvVarsCM; update the Deployment template (the container spec that
references extraEnvVarsCM/extraEnvVars) to also conditionally include an envFrom
entry for a secret when .Values.extraEnvVarsSecret is set (e.g. add a
conditional block that appends - secretRef: name: {{ .Values.extraEnvVarsSecret
}} to the container.envFrom so both ConfigMap and Secret can be specified
together), ensuring it safely handles empty values and preserves existing
extraEnvVars and extraEnvVarsCM behavior.

Copilot AI review requested due to automatic review settings April 15, 2026 09:34
Copy link
Copy Markdown

@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

♻️ Duplicate comments (1)
charts/aisix/README.md (1)

3-3: ⚠️ Potential issue | 🟡 Minor

Use “open-source” hyphenation.

Line 3 should use the compound adjective form: “an open-source, high-performance AI Gateway...”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/README.md` at line 3, The phrase "an open source,
high-performance AI Gateway..." should use the compound adjective hyphenation
"open-source"; update the README sentence that currently reads "an open source,
high-performance AI Gateway and LLM proxy built in Rust" to "an open-source,
high-performance AI Gateway and LLM proxy built in Rust" so the compound
modifier is correctly hyphenated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@charts/aisix/README.md`:
- Around line 16-17: The helm install examples use unquoted --set arguments with
angle-bracket placeholders and array index syntax (e.g., the command using --set
deployment.admin.adminKey[0].key=<your-admin-key>); update those README lines to
wrap the entire --set key=value argument in quotes (for example "--set
deployment.admin.adminKey[0].key=<your-admin-key>") and ensure placeholders with
angle brackets are preserved inside the quotes so the shell won’t treat '<' as
redirection or '[0]' as a glob pattern; apply the same quoting to any other
--set usages (such as where a strong key is set) so copy-paste works reliably.

---

Duplicate comments:
In `@charts/aisix/README.md`:
- Line 3: The phrase "an open source, high-performance AI Gateway..." should use
the compound adjective hyphenation "open-source"; update the README sentence
that currently reads "an open source, high-performance AI Gateway and LLM proxy
built in Rust" to "an open-source, high-performance AI Gateway and LLM proxy
built in Rust" so the compound modifier is correctly hyphenated.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d55233ef-fa53-4e11-8aab-64e54a93d7f1

📥 Commits

Reviewing files that changed from the base of the PR and between 73965e7 and a8feeae.

📒 Files selected for processing (3)
  • charts/aisix/Chart.yaml
  • charts/aisix/README.md
  • charts/aisix/values.yaml
✅ Files skipped from review due to trivial changes (2)
  • charts/aisix/Chart.yaml
  • charts/aisix/values.yaml

Comment thread charts/aisix/README.md Outdated
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

Adds a new Helm chart (charts/aisix/) to deploy AISIX AI Gateway on Kubernetes, including optional bundled etcd, core workload/service templates, and user-facing documentation/notes.

Changes:

  • Introduces AISIX chart metadata, default values, and helper templates for naming/labels and etcd host construction.
  • Adds Kubernetes manifests for Deployment, ConfigMap-rendered app config, Services (proxy/admin), Ingresses, ServiceAccount, and HPA.
  • Updates the repository root README to list the new chart.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
charts/aisix/values.yaml Defines chart defaults for image, services, AISIX config, ingress, autoscaling, and optional etcd subchart.
charts/aisix/templates/serviceaccount.yaml Optional ServiceAccount creation and metadata wiring.
charts/aisix/templates/service-proxy.yaml Proxy Service (port 3000) with configurable type/NodePort settings.
charts/aisix/templates/service-admin.yaml Admin Service (port 3001) with configurable type/annotations.
charts/aisix/templates/ingress.yaml Proxy Ingress template.
charts/aisix/templates/ingress-admin.yaml Admin Ingress template.
charts/aisix/templates/hpa.yaml HorizontalPodAutoscaler template for scaling AISIX Deployment.
charts/aisix/templates/deployment.yaml AISIX Deployment: config mount, ports, env vars, probes/resources, scheduling knobs.
charts/aisix/templates/configmap.yaml Renders /etc/aisix/config.yaml from Helm values, including Secret-backed admin key placeholder support.
charts/aisix/templates/_helpers.tpl Name/label helpers and etcd host URL construction (subchart vs external).
charts/aisix/templates/NOTES.txt Post-install instructions for discovering proxy/admin URLs.
charts/aisix/charts/etcd-8.7.7.tgz Vendored etcd dependency chart package.
charts/aisix/README.md Chart usage docs and configuration table.
charts/aisix/Chart.yaml Chart metadata and etcd dependency declaration.
charts/aisix/Chart.lock Locked dependency versions/digest for reproducible builds.
charts/aisix/.helmignore Helm packaging ignore patterns for the chart.
README.md Adds AISIX chart link to the repository chart list.

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

Comment thread charts/aisix/README.md
Comment on lines +30 to +34
| Parameter | Description | Default |
|-----------|-------------|---------|
| `image.repository` | AISIX image repository | `ghcr.io/api7/aisix` |
| `image.tag` | AISIX image tag | `0.1.0` |
| `replicaCount` | Number of replicas | `1` |
Comment thread charts/aisix/README.md Outdated
| `server.admin.listen` | Admin API listen address | `0.0.0.0:3001` |
| `proxyService.type` | Proxy Service type | `NodePort` |
| `adminService.type` | Admin Service type | `ClusterIP` |
| `etcd.enabled` | Install bundled etcd | `true` |
Comment thread charts/aisix/templates/deployment.yaml Outdated
Comment on lines +88 to +91
{{- if .Values.extraEnvVarsCM }}
envFrom:
- configMapRef:
name: {{ .Values.extraEnvVarsCM }}
Comment thread charts/aisix/templates/hpa.yaml Outdated
Comment on lines +2 to +36
{{- if eq .Values.autoscaling.version "v2" }}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v2beta1
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "aisix.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "aisix.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "aisix.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
Comment thread charts/aisix/values.yaml
Comment on lines +168 to +172
# -- etcd subchart (bitnami/etcd)
etcd:
# -- Install etcd as a subchart. Set false to use an external etcd.
enabled: false
image:
Copy link
Copy Markdown

@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

🧹 Nitpick comments (3)
charts/aisix/templates/ingress.yaml (1)

13-17: Consider adding ingressClassName support.

The Ingress template uses networking.k8s.io/v1 but doesn't support spec.ingressClassName, which is the recommended way to specify the ingress controller in Kubernetes 1.18+. The annotation-based approach (kubernetes.io/ingress.class) is deprecated.

♻️ Proposed fix to add ingressClassName support
 spec:
+  {{- if .Values.gateway.ingress.className }}
+  ingressClassName: {{ .Values.gateway.ingress.className }}
+  {{- end }}
   {{- if .Values.gateway.ingress.tls }}
   tls:
     {{- toYaml .Values.gateway.ingress.tls | nindent 4 }}
   {{- end }}

And add to values.yaml under gateway.ingress:

    # -- Ingress class name
    className: ""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/ingress.yaml` around lines 13 - 17, Add support for
ingressClassName in the Ingress template by reading a new value at
.Values.gateway.ingress.className and, when non-empty, set spec.ingressClassName
to that value in charts/aisix/templates/ingress.yaml; update the template to
prefer spec.ingressClassName over deprecated annotation usage
(kubernetes.io/ingress.class) and ensure to add the corresponding values
gateway.ingress.className: "" in values.yaml so chart consumers can configure
the ingress controller class.
charts/aisix/templates/configmap.yaml (1)

27-28: Consider making TLS configurable.

The proxy TLS setting is hardcoded to false. Consider exposing this as a configurable value for users who want to enable TLS termination at the application level.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/configmap.yaml` around lines 27 - 28, The tls.enabled
value is hardcoded to false; make it configurable by wiring it to a Helm values
entry (e.g., use .Values.proxy.tls.enabled) so users can toggle TLS from
values.yaml, add the corresponding default (false) and comment in values.yaml,
and ensure any code reading tls.enabled (the tls block) handles the boolean
value correctly when templates render.
charts/aisix/templates/deployment.yaml (1)

36-49: Consider providing secure defaults for securityContext.

Trivy flags that the deployment uses default security context which allows root privileges (KSV-0118) and doesn't set readOnlyRootFilesystem (KSV-0014). While the template correctly supports user-provided security contexts, the empty defaults in values.yaml mean users must explicitly configure them.

Consider providing secure defaults:

🔐 Proposed secure defaults in values.yaml
podSecurityContext:
  runAsNonRoot: true
  seccompProfile:
    type: RuntimeDefault

securityContext:
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  runAsNonRoot: true
  capabilities:
    drop:
      - ALL

Verify that AISIX can run with readOnlyRootFilesystem: true. If it needs to write to specific paths, add emptyDir volumes for those locations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/deployment.yaml` around lines 36 - 49, Add secure
defaults for podSecurityContext and container securityContext in values.yaml
(e.g., runAsNonRoot, seccompProfile RuntimeDefault, allowPrivilegeEscalation:
false, readOnlyRootFilesystem: true, drop ALL capabilities) so the deployment
template (deployment.yaml) uses safe defaults when .Values.podSecurityContext or
.Values.securityContext are empty; update any container-specific settings (the
aisix container and any initContainers) to ensure they can run with
readOnlyRootFilesystem by provisioning emptyDir volumes for writable paths or
adjusting paths in the container, and include a short verification note that
AISIX runs with readOnlyRootFilesystem:true or list the required writable
mounts.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@charts/aisix/templates/configmap.yaml`:
- Around line 29-30: The admin listen line (server.admin.listen: "{{
.Values.admin.ip }}:{{ .Values.admin.containerPort }}") is always rendered even
when .Values.admin.enabled is false; wrap the entire admin block (the "admin:"
key plus the listen line) in a Helm conditional using .Values.admin.enabled
(e.g., {{- if .Values.admin.enabled }} ... {{- end }}), preserving YAML
indentation so the block is omitted when admin.enabled is false and included
when true.

In `@charts/aisix/values.yaml`:
- Around line 92-96: The default adminKey value ("changeme") in values.yaml is
insecure; update documentation and templates to force or surface a non-default
secret: add a clear warning in the README and helm chart README about changing
adminKey, remove the literal "changeme" default or replace it with an
empty/placeholder value, and enforce a check in the Helm template (e.g., in
configmap.yaml or deployment templates that reference deployment.admin.adminKey
or adminKey) using Helm's required/fail logic or by validating that (index
.Values.deployment.admin.adminKey 0).key is not "changeme"; optionally implement
generating a random key at install time if adminKey is unset and no
existingSecret is provided.
- Around line 127-129: The values.yaml currently sets hosts -> host: aisix.local
with paths: [] which yields an Ingress with no routing rules when
gateway.ingress.enabled is true; change the default paths array under hosts (the
paths key) to include a sensible route (for example "/") so the generated
Ingress has at least one rule; update the hosts entry where host: aisix.local
and paths are defined to provide a non-empty array (e.g., ["/"]) and ensure any
templating that renders gateway.ingress.enabled uses that paths value.

---

Nitpick comments:
In `@charts/aisix/templates/configmap.yaml`:
- Around line 27-28: The tls.enabled value is hardcoded to false; make it
configurable by wiring it to a Helm values entry (e.g., use
.Values.proxy.tls.enabled) so users can toggle TLS from values.yaml, add the
corresponding default (false) and comment in values.yaml, and ensure any code
reading tls.enabled (the tls block) handles the boolean value correctly when
templates render.

In `@charts/aisix/templates/deployment.yaml`:
- Around line 36-49: Add secure defaults for podSecurityContext and container
securityContext in values.yaml (e.g., runAsNonRoot, seccompProfile
RuntimeDefault, allowPrivilegeEscalation: false, readOnlyRootFilesystem: true,
drop ALL capabilities) so the deployment template (deployment.yaml) uses safe
defaults when .Values.podSecurityContext or .Values.securityContext are empty;
update any container-specific settings (the aisix container and any
initContainers) to ensure they can run with readOnlyRootFilesystem by
provisioning emptyDir volumes for writable paths or adjusting paths in the
container, and include a short verification note that AISIX runs with
readOnlyRootFilesystem:true or list the required writable mounts.

In `@charts/aisix/templates/ingress.yaml`:
- Around line 13-17: Add support for ingressClassName in the Ingress template by
reading a new value at .Values.gateway.ingress.className and, when non-empty,
set spec.ingressClassName to that value in charts/aisix/templates/ingress.yaml;
update the template to prefer spec.ingressClassName over deprecated annotation
usage (kubernetes.io/ingress.class) and ensure to add the corresponding values
gateway.ingress.className: "" in values.yaml so chart consumers can configure
the ingress controller class.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e5015454-9f56-45af-8c90-5fe2616be19b

📥 Commits

Reviewing files that changed from the base of the PR and between eca980e and 6f0de84.

📒 Files selected for processing (8)
  • charts/aisix/templates/NOTES.txt
  • charts/aisix/templates/configmap.yaml
  • charts/aisix/templates/deployment.yaml
  • charts/aisix/templates/ingress-admin.yaml
  • charts/aisix/templates/ingress.yaml
  • charts/aisix/templates/service-admin.yaml
  • charts/aisix/templates/service-proxy.yaml
  • charts/aisix/values.yaml
✅ Files skipped from review due to trivial changes (1)
  • charts/aisix/templates/NOTES.txt

Comment on lines +29 to +30
admin:
listen: "{{ .Values.admin.ip }}:{{ .Values.admin.containerPort }}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, examine the ConfigMap template
find . -type f -name "configmap.yaml" | head -5

Repository: api7/api7-helm-chart

Length of output: 198


🏁 Script executed:

# Get the full ConfigMap template to understand context
cat -n charts/aisix/templates/configmap.yaml | head -60

Repository: api7/api7-helm-chart

Length of output: 1180


🏁 Script executed:

# Search for how admin.enabled is used in other templates
rg "admin\.enabled" charts/aisix/templates/ -A 2 -B 2

Repository: api7/api7-helm-chart

Length of output: 1462


🏁 Script executed:

# Check values schema or defaults for admin configuration
cat -n charts/aisix/values.yaml 2>/dev/null | grep -A 10 "admin:"

Repository: api7/api7-helm-chart

Length of output: 914


🏁 Script executed:

# Search for AISIX documentation or references in the repo
find . -type f -name "*.md" | xargs grep -l "admin" | head -5

Repository: api7/api7-helm-chart

Length of output: 115


🏁 Script executed:

# Check if there are other Helm charts or configurations that show admin as optional
rg "server.*admin" charts/ -B 2 -A 2

Repository: api7/api7-helm-chart

Length of output: 493


🏁 Script executed:

# Look at the deployment template to understand how the config is used
cat -n charts/aisix/templates/deployment.yaml | grep -A 20 -B 5 "config.yaml"

Repository: api7/api7-helm-chart

Length of output: 1101


🏁 Script executed:

# Search for any documentation about AISIX configuration schema
find . -type f \( -name "*.yaml" -o -name "*.yml" -o -name "*.md" \) | xargs grep -l "server\.admin" 2>/dev/null

Repository: api7/api7-helm-chart

Length of output: 88


🏁 Script executed:

# Check if there are any existing patterns of conditional config blocks in the configmap
cat -n charts/aisix/templates/configmap.yaml

Repository: api7/api7-helm-chart

Length of output: 1180


🏁 Script executed:

# Search for AISIX documentation or test files that might show config structure
find . -type f -name "*.md" -o -name "*.txt" | xargs grep -l "server\.admin\|aisix.*config" 2>/dev/null | head -10

Repository: api7/api7-helm-chart

Length of output: 88


🏁 Script executed:

# Look for any AISIX references or upstream references
rg "github.com.*aisix\|api7.*aisix" . -t yaml -t md | head -5

Repository: api7/api7-helm-chart

Length of output: 46


🏁 Script executed:

# Check the complete values.yaml to see if admin can actually be disabled
cat -n charts/aisix/values.yaml | grep -A 15 "^admin:"

Repository: api7/api7-helm-chart

Length of output: 46


🏁 Script executed:

# Look for any AISIX source code or examples in the repo
find . -type f -name "*.go" -o -name "*.js" -o -name "*.py" | xargs grep -l "server\.admin\|AISIX" 2>/dev/null | head -5

Repository: api7/api7-helm-chart

Length of output: 46


🏁 Script executed:

# Check if there are any test files or examples that show AISIX config without admin
find . -type f -name "*.yaml" -o -name "*.yml" | xargs grep -l "AISIX\|aisix" 2>/dev/null | grep -E "(test|example|spec)" | head -10

Repository: api7/api7-helm-chart

Length of output: 46


🏁 Script executed:

# Look at how the chart handles other optional server blocks (if any)
cat -n charts/aisix/templates/configmap.yaml | grep -E "({{-\s*if|{{-\s*end)"

Repository: api7/api7-helm-chart

Length of output: 158


🏁 Script executed:

# Check if there's any documentation on AISIX config schema or if server.admin is optional
find . -type f -name "*.md" | xargs cat | grep -A 10 -B 5 "server\.admin\|admin.*listen" 2>/dev/null | head -50

Repository: api7/api7-helm-chart

Length of output: 2909


Conditionally render admin config block to match admin.enabled flag.

The server.admin.listen configuration is always included in the ConfigMap, even when .Values.admin.enabled is false. This creates an inconsistency: the Service, Ingress, and container port are properly gated by the admin.enabled flag elsewhere in the chart (as seen in service-admin.yaml, ingress-admin.yaml, and deployment.yaml), but the configuration block itself is not. To maintain consistency and avoid potential configuration validation issues in AISIX, wrap the admin block conditionally:

     server:
       proxy:
         listen: "{{ .Values.gateway.ip }}:{{ .Values.gateway.containerPort }}"
         tls:
           enabled: false
+      {{- if .Values.admin.enabled }}
       admin:
         listen: "{{ .Values.admin.ip }}:{{ .Values.admin.containerPort }}"
+      {{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/templates/configmap.yaml` around lines 29 - 30, The admin listen
line (server.admin.listen: "{{ .Values.admin.ip }}:{{
.Values.admin.containerPort }}") is always rendered even when
.Values.admin.enabled is false; wrap the entire admin block (the "admin:" key
plus the listen line) in a Helm conditional using .Values.admin.enabled (e.g.,
{{- if .Values.admin.enabled }} ... {{- end }}), preserving YAML indentation so
the block is omitted when admin.enabled is false and included when true.

Comment thread charts/aisix/values.yaml
Comment on lines +92 to +96
admin:
# -- Admin API key(s). Each entry must have a `key` field.
# IMPORTANT: change this before deploying to production.
adminKey:
- key: "changeme"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Default admin key is insecure — add documentation warning.

The default admin key "changeme" is a security risk if users deploy without customizing. While the comment says "IMPORTANT: change this before deploying to production", consider:

  1. Adding a more prominent warning in the README
  2. Optionally generating a random key during install if not specified
  3. Using required function to force users to set it explicitly
🛡️ Option: Require explicit admin key

In configmap.yaml, you could enforce this:

{{- if and (not .Values.deployment.admin.existingSecret) (eq (index .Values.deployment.admin.adminKey 0).key "changeme") }}
{{- fail "deployment.admin.adminKey must be changed from default 'changeme' or use existingSecret" }}
{{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@charts/aisix/values.yaml` around lines 92 - 96, The default adminKey value
("changeme") in values.yaml is insecure; update documentation and templates to
force or surface a non-default secret: add a clear warning in the README and
helm chart README about changing adminKey, remove the literal "changeme" default
or replace it with an empty/placeholder value, and enforce a check in the Helm
template (e.g., in configmap.yaml or deployment templates that reference
deployment.admin.adminKey or adminKey) using Helm's required/fail logic or by
validating that (index .Values.deployment.admin.adminKey 0).key is not
"changeme"; optionally implement generating a random key at install time if
adminKey is unset and no existingSecret is provided.

Comment thread charts/aisix/values.yaml Outdated
- hpa.yaml: use correct v2beta1 metrics schema (targetAverageUtilization) to match v2 schema split, matching gateway chart pattern
- deployment.yaml: fix imagePullSecrets to emit name: wrapper; wire up extraEnvVarsSecret in envFrom; always inject AISIX_ADMIN_KEY from Secret
- configmap.yaml: always use {{AISIX_ADMIN_KEY}} placeholder instead of embedding key in ConfigMap
- secret.yaml: new template to create internal Secret from adminKey when existingSecret is not set
- values.yaml: default ingress paths to ["/"] (was []); improve etcd RBAC comment; clarify adminKey comment
- README.md: fix hyphenation, table row format, stale field names, etcd.enabled default, prefer Secret-based install example
Copilot AI review requested due to automatic review settings April 16, 2026 00:49
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

Adds a new charts/aisix/ Helm chart to deploy AISIX AI Gateway on Kubernetes, including optional etcd dependency packaging and standard Kubernetes resources (Deployment/Services/Ingress/HPA) consistent with the existing charts structure in this repo.

Changes:

  • Introduces a complete AISIX Helm chart (values, helpers, Deployment, ConfigMap, Secret, Services, Ingresses, HPA, ServiceAccount, NOTES).
  • Adds bitnami/etcd dependency metadata and vendors the packaged subchart (etcd-8.7.7.tgz) plus Chart.lock.
  • Updates the repo root README.md to link to the new chart documentation.

Reviewed changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
charts/aisix/Chart.yaml Defines the AISIX chart metadata and declares the etcd dependency.
charts/aisix/Chart.lock Locks the etcd dependency version and digest for reproducible builds.
charts/aisix/values.yaml Provides default configuration for image, services, admin key handling, autoscaling, and etcd options.
charts/aisix/README.md Documents installation and key configuration options for the AISIX chart.
charts/aisix/.helmignore Adds standard Helm packaging ignore patterns.
charts/aisix/templates/_helpers.tpl Adds naming/label helpers and logic to construct etcd endpoints.
charts/aisix/templates/configmap.yaml Renders AISIX config.yaml (etcd + admin key placeholder + listeners).
charts/aisix/templates/deployment.yaml Deploys AISIX with config mount, ports, env vars (including admin key), and optional extras.
charts/aisix/templates/secret.yaml Creates an internal Secret for the admin key when not using an existing Secret.
charts/aisix/templates/service-proxy.yaml Exposes the proxy port (3000) with configurable Service type and options.
charts/aisix/templates/service-admin.yaml Exposes the admin port (3001) as a separate Service (when enabled).
charts/aisix/templates/serviceaccount.yaml Optionally creates a ServiceAccount for the AISIX Deployment.
charts/aisix/templates/ingress.yaml Optionally exposes the proxy Service via Ingress.
charts/aisix/templates/ingress-admin.yaml Optionally exposes the admin Service via Ingress (when admin is enabled).
charts/aisix/templates/hpa.yaml Adds optional HorizontalPodAutoscaler support.
charts/aisix/templates/NOTES.txt Provides post-install access instructions for proxy/admin endpoints.
charts/aisix/charts/etcd-8.7.7.tgz Vendors the bitnami/etcd subchart artifact for offline/reproducible installs.
README.md Adds AISIX chart link to the repository chart index.

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

Comment on lines +82 to +91
- name: AISIX_ADMIN_KEY
valueFrom:
secretKeyRef:
{{- if .Values.deployment.admin.existingSecret }}
name: {{ .Values.deployment.admin.existingSecret }}
key: {{ .Values.deployment.admin.existingSecretKey }}
{{- else }}
name: {{ include "aisix.fullname" . }}-admin-key
key: admin-key
{{- end }}
Comment on lines +10 to +12
stringData:
admin-key: {{ (index .Values.deployment.admin.adminKey 0).key | quote }}
{{- end }}
Comment thread charts/aisix/values.yaml
Comment on lines +165 to +169
# -- etcd subchart (bitnami/etcd)
etcd:
# -- Install etcd as a subchart. Set false to use an external etcd.
enabled: false
image:
Comment thread charts/aisix/values.yaml
Comment on lines +94 to +96
# WARNING: change this before deploying to production.
adminKey:
- key: "changeme"
Comment thread charts/aisix/README.md
Comment on lines +34 to +36
| Parameter | Description | Default |
|-----------|-------------|---------|
| `image.repository` | AISIX image repository | `ghcr.io/api7/aisix` |
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.

2 participants