This is an automated email from the ASF dual-hosted git repository.

chenjunxu 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 1c4d268  Refactored standalone rules configuration to be editable 
through helm values and added option to set the rules configuration with an 
existing configmap. (#717)
1c4d268 is described below

commit 1c4d268eda5ae071f21903afc73bb24a5db4da12
Author: Johannes Ylönen <[email protected]>
AuthorDate: Fri Dec 5 11:29:18 2025 +0200

    Refactored standalone rules configuration to be editable through helm 
values and added option to set the rules configuration with an existing 
configmap. (#717)
---
 charts/apisix/README.md                      |  3 +++
 charts/apisix/templates/apisix-config-cm.yml | 10 ++--------
 charts/apisix/templates/deployment.yaml      |  2 +-
 charts/apisix/values.yaml                    | 18 ++++++++++++++++++
 4 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/charts/apisix/README.md b/charts/apisix/README.md
index 225e0ca..4faed5b 100644
--- a/charts/apisix/README.md
+++ b/charts/apisix/README.md
@@ -68,6 +68,9 @@ The command removes all the Kubernetes components associated 
with the chart and
 | apisix.customPlugins.plugins[0].configMap.name | string | `"configmap-name"` 
| name of configmap. |
 | apisix.deployment.mode | string | `"traditional"` | Apache APISIX deployment 
mode Optional: traditional, decoupled, standalone  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.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 |
+| apisix.deployment.standalone.config | string | `"routes:\n-\n  uri: /hi\n  
upstream:\n    nodes:\n      \"127.0.0.1:1980\": 1\n    type: roundrobin\n"` | 
Rules which are set to the default apisix.yaml configmap. If 
apisix.delpoyment.standalone.existingConfigMap is empty, these are used. |
+| apisix.deployment.standalone.existingConfigMap | string | `""` | Specifies 
the name of the ConfigMap that contains the rule configurations. The 
configuration must be set to the key named `apisix.yaml` in the configmap. |
 | apisix.deployment.role_traditional.config_provider | string | `"etcd"` |  |
 | apisix.discovery.enabled | bool | `false` | Enable or disable Apache APISIX 
integration service discovery |
 | apisix.discovery.registry | object | `{}` | Service discovery registry. 
Refer to [configuration under 
discovery](https://github.com/apache/apisix/blob/master/conf/config.yaml.example#L307)
 for example. Also see [example of using external service 
discovery](https://apisix.apache.org/docs/ingress-controller/1.8.0/tutorials/external-service-discovery/).
 |
diff --git a/charts/apisix/templates/apisix-config-cm.yml 
b/charts/apisix/templates/apisix-config-cm.yml
index d76fe99..89087fe 100644
--- a/charts/apisix/templates/apisix-config-cm.yml
+++ b/charts/apisix/templates/apisix-config-cm.yml
@@ -14,19 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{- if eq .Values.apisix.deployment.mode "standalone" }}
+{{- if and (eq .Values.apisix.deployment.mode "standalone") (not 
.Values.apisix.deployment.standalone.existingConfigMap) }}
 kind: ConfigMap
 apiVersion: v1
 metadata:
   name: apisix.yaml
 data:
   apisix.yaml: |
-    routes:
-    -
-      uri: /hi
-      upstream:
-        nodes:
-          "127.0.0.1:1980": 1
-        type: roundrobin
+    {{- .Values.apisix.deployment.standalone.config | nindent 4 }}
     #END
 {{- end }}
diff --git a/charts/apisix/templates/deployment.yaml 
b/charts/apisix/templates/deployment.yaml
index 1c4102e..acda6be 100644
--- a/charts/apisix/templates/deployment.yaml
+++ b/charts/apisix/templates/deployment.yaml
@@ -253,7 +253,7 @@ spec:
       volumes:
         {{- if eq .Values.apisix.deployment.mode "standalone" }}
         - configMap:
-            name: apisix.yaml
+            name: {{ .Values.apisix.deployment.standalone.existingConfigMap | 
default "apisix.yaml" }}
           name: apisix-admin
         {{- end }}
         - configMap:
diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml
index 65945e3..520f4d0 100644
--- a/charts/apisix/values.yaml
+++ b/charts/apisix/values.yaml
@@ -355,6 +355,24 @@ apisix:
       # enum: etcd, yaml
       config_provider: "etcd"
 
+    # -- Standalone rules configuration
+    #
+    # ref: https://apisix.apache.org/docs/apisix/deployment-modes/#standalone
+    standalone:
+      # -- Rules which are set to the default apisix.yaml configmap.
+      # If apisix.delpoyment.standalone.existingConfigMap is empty, these are 
used.
+      config: |
+        routes:
+        -
+          uri: /hi
+          upstream:
+            nodes:
+              "127.0.0.1:1980": 1
+            type: roundrobin
+      # -- Specifies the name of the ConfigMap that contains the rule 
configurations.
+      # The configuration must be set to the key named `apisix.yaml` in the 
configmap.
+      existingConfigMap: ""
+
   admin:
     # -- Enable Admin API
     enabled: true

Reply via email to