This is an automated email from the ASF dual-hosted git repository.
AlinsRan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git
The following commit(s) were added to refs/heads/master by this push:
new bd84181 fix(apisix): mode standalone renders the data_plane role
unless API-driven is configured (#1017)
bd84181 is described below
commit bd84181c11f8712266736aad2609f33e99198ee1
Author: Martin Matyáš <[email protected]>
AuthorDate: Thu Oct 15 08:28:18 2026 +0200
fix(apisix): mode standalone renders the data_plane role unless API-driven
is configured (#1017)
---
charts/apisix/README.md | 2 +-
charts/apisix/templates/_helpers.tpl | 22 ++++++++++++++++++++++
charts/apisix/templates/configmap.yaml | 14 +++++++-------
charts/apisix/templates/deployment.yaml | 4 ++--
charts/apisix/values.yaml | 4 ++++
5 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index 56cabab..d15bffe 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -70,7 +70,7 @@ The command removes all the Kubernetes components associated
with the chart and
| apisix.customPlugins.plugins[0].configMap.mounts | list |
`[{"key":"the-file-name","path":"mount-path"}]` | since keys in configmap is
flat, mountPath allows to define the mount path, so that plugin codes can be
mounted hierarchically. |
| apisix.customPlugins.plugins[0].configMap.name | string | `"configmap-name"`
| name of configmap. |
| apisix.deleteURITailSlash | bool | `false` | Delete the '/' at the end of
the URI |
-| apisix.deployment.mode | string | `"traditional"` | Apache APISIX deployment
mode Optional: traditional, decoupled, standalone ref:
https://apisix.apache.org/docs/apisix/deployment-modes/ |
+| apisix.deployment.mode | string | `"traditional"` | Apache APISIX deployment
mode Optional: traditional, decoupled, standalone standalone is file-driven
standalone: rules are read from the mounted apisix.yaml, and the default
traditional role is rendered as data_plane. For API-driven standalone, keep
mode traditional and set role_traditional.config_provider to yaml. ref:
https://apisix.apache.org/docs/apisix/deployment-modes/ |
| apisix.deployment.role | string | `"traditional"` | Deployment role
Optional: traditional, data_plane, control_plane ref:
https://apisix.apache.org/docs/apisix/deployment-modes/ |
| apisix.deployment.role_traditional.config_provider | string | `"etcd"` |
Config provider for the traditional role. enum: etcd, yaml |
| apisix.deployment.standalone | object | `{"config":"routes:\n-\n uri: /hi\n
upstream:\n nodes:\n \"127.0.0.1:1980\": 1\n type:
roundrobin\n","existingConfigMap":""}` | Standalone rules configuration ref:
https://apisix.apache.org/docs/apisix/deployment-modes/#standalone |
diff --git a/charts/apisix/templates/_helpers.tpl
b/charts/apisix/templates/_helpers.tpl
index 53a49bb..0dfa4e9 100644
--- a/charts/apisix/templates/_helpers.tpl
+++ b/charts/apisix/templates/_helpers.tpl
@@ -157,3 +157,25 @@ Key to use to fetch viewer token from secret
{{- "viewer" }}
{{- end }}
{{- end }}
+
+{{/*
+The deployment role APISIX runs with. mode "standalone" is file-driven
+standalone: rules come from the mounted apisix.yaml, which APISIX reads as a
+data plane with the yaml config provider. With the default traditional role on
+the etcd provider that combination could never start (no etcd is configured in
+standalone mode), so it is rendered as a data plane. A traditional role on the
+yaml provider (API-driven standalone) is kept as configured; a control plane
+needs etcd and cannot run standalone.
+*/}}
+{{- define "apisix.deployment.role" -}}
+{{- $role := .Values.apisix.deployment.role -}}
+{{- if eq .Values.apisix.deployment.mode "standalone" -}}
+{{- if eq $role "control_plane" -}}
+{{- fail "apisix.deployment.mode \"standalone\" cannot run with
apisix.deployment.role \"control_plane\": a control plane needs etcd" -}}
+{{- end -}}
+{{- if and (eq $role "traditional") (ne (default "etcd"
.Values.apisix.deployment.role_traditional.config_provider) "yaml") -}}
+{{- $role = "data_plane" -}}
+{{- end -}}
+{{- end -}}
+{{- $role -}}
+{{- end -}}
diff --git a/charts/apisix/templates/configmap.yaml
b/charts/apisix/templates/configmap.yaml
index 2529414..9f08bf8 100644
--- a/charts/apisix/templates/configmap.yaml
+++ b/charts/apisix/templates/configmap.yaml
@@ -44,7 +44,7 @@ data:
{{- end }}
{{- else }}
apisix: # universal configurations
- {{- if not (eq .Values.apisix.deployment.role "control_plane") }}
+ {{- if not (eq (include "apisix.deployment.role" $) "control_plane") }}
node_listen: # APISIX listening port
- {{ .Values.service.http.containerPort }}
{{- with .Values.service.http.additionalContainerPorts }}
@@ -188,7 +188,7 @@ data:
{{- if and .Values.apisix.ssl.enabled .Values.apisix.ssl.fallbackSNI }}
fallback_sni: {{ .Values.apisix.ssl.fallbackSNI | quote }}
{{- end }}
- {{- $useTraditionalYaml := and (eq .Values.apisix.deployment.role
"traditional") (eq .Values.apisix.deployment.role_traditional.config_provider
"yaml") }}
+ {{- $useTraditionalYaml := and (eq (include "apisix.deployment.role" $)
"traditional") (eq .Values.apisix.deployment.role_traditional.config_provider
"yaml") }}
{{- if $useTraditionalYaml }}
status:
ip: {{ default "127.0.0.1" .Values.apisix.status.ip | quote }}
@@ -357,24 +357,24 @@ data:
{{- end }}
deployment:
- role: {{ .Values.apisix.deployment.role }}
+ role: {{ (include "apisix.deployment.role" $) }}
- {{- if eq .Values.apisix.deployment.role "traditional" }}
+ {{- if eq (include "apisix.deployment.role" $) "traditional" }}
role_traditional:
config_provider: {{ default "etcd"
.Values.apisix.deployment.role_traditional.config_provider }}
{{- end }}
- {{- if eq .Values.apisix.deployment.role "control_plane" }}
+ {{- if eq (include "apisix.deployment.role" $) "control_plane" }}
role_control_plane:
config_provider: etcd
{{- end }}
- {{- if eq .Values.apisix.deployment.role "data_plane" }}
+ {{- if eq (include "apisix.deployment.role" $) "data_plane" }}
role_data_plane:
config_provider: {{- eq .Values.apisix.deployment.mode "standalone" |
ternary "yaml" "etcd" | indent 1 }}
{{- end }}
- {{- if not (eq .Values.apisix.deployment.role "data_plane") }}
+ {{- if not (eq (include "apisix.deployment.role" $) "data_plane") }}
admin:
enable_admin_ui: {{ .Values.apisix.admin.enable_admin_ui }}
allow_admin: #
http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
diff --git a/charts/apisix/templates/deployment.yaml
b/charts/apisix/templates/deployment.yaml
index c871040..3a592f1 100644
--- a/charts/apisix/templates/deployment.yaml
+++ b/charts/apisix/templates/deployment.yaml
@@ -63,7 +63,7 @@ spec:
{{- end }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds
}}
containers:
- {{- $useTraditionalYaml := and (eq .Values.apisix.deployment.role
"traditional") (eq .Values.apisix.deployment.role_traditional.config_provider
"yaml") }}
+ {{- $useTraditionalYaml := and (eq (include "apisix.deployment.role"
$) "traditional") (eq
.Values.apisix.deployment.role_traditional.config_provider "yaml") }}
- name: {{ .Chart.Name }}
{{- with .Values.securityContext }}
securityContext:
@@ -170,7 +170,7 @@ spec:
protocol: TCP
{{- end}}
- {{- if ne .Values.apisix.deployment.role "control_plane" }}
+ {{- if ne (include "apisix.deployment.role" $) "control_plane" }}
readinessProbe:
failureThreshold: 6
initialDelaySeconds: 10
diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml
index c4ab140..dd13c3d 100644
--- a/charts/apisix/values.yaml
+++ b/charts/apisix/values.yaml
@@ -461,6 +461,10 @@ apisix:
deployment:
# -- Apache APISIX deployment mode
# Optional: traditional, decoupled, standalone
+ # standalone is file-driven standalone: rules are read from the mounted
+ # apisix.yaml, and the default traditional role is rendered as data_plane.
+ # For API-driven standalone, keep mode traditional and set
+ # role_traditional.config_provider to yaml.
#
# ref: https://apisix.apache.org/docs/apisix/deployment-modes/
mode: traditional