Skip to content

Commit d37c54b

Browse files
committed
Added option to set the rules configuration with an existing configmap.
1 parent 77c15db commit d37c54b

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

charts/apisix/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ The command removes all the Kubernetes components associated with the chart and
6565
| apisix.customPlugins.plugins[0].configMap.name | string | `"configmap-name"` | name of configmap. |
6666
| apisix.deployment.mode | string | `"traditional"` | Apache APISIX deployment mode Optional: traditional, decoupled, standalone ref: https://apisix.apache.org/docs/apisix/deployment-modes/ |
6767
| apisix.deployment.role | string | `"traditional"` | Deployment role Optional: traditional, data_plane, control_plane ref: https://apisix.apache.org/docs/apisix/deployment-modes/ |
68-
| apisix.deployment.standaloneConfig | string | `""` | Standalone rules configuration ref: https://apisix.apache.org/docs/apisix/deployment-modes/#standalone |
68+
| apisix.deployment.standalone.config | string | `"routes: - uri: /hi upstream: nodes: "127.0.0.1:1980": 1 type: roundrobin"` | Standalone rules configuration ref: https://apisix.apache.org/docs/apisix/deployment-modes/#standalone |
69+
| apisix.deployment.standalone.existingConfigMap | string | `""` | Specifies the name of the ConfigMap that contains the rule configurations. |
6970
| apisix.discovery.enabled | bool | `false` | Enable or disable Apache APISIX integration service discovery |
7071
| apisix.discovery.registry | object | `{}` | Registry is the same to the one in APISIX [config-default.yaml](https://github.com/apache/apisix/blob/master/conf/config-default.yaml#L281), and refer to such file for more setting details. also refer to [this documentation for integration service discovery](https://apisix.apache.org/docs/apisix/discovery) |
7172
| apisix.dns.resolvers[0] | string | `"127.0.0.1"` | |

charts/apisix/templates/apisix-config-cm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
{{- if eq .Values.apisix.deployment.mode "standalone" }}
17+
{{- if and (eq .Values.apisix.deployment.mode "standalone") (not .Values.apisix.deployment.standalone.existingConfigMap) }}
1818
kind: ConfigMap
1919
apiVersion: v1
2020
metadata:
2121
name: apisix.yaml
2222
data:
2323
apisix.yaml: |
24-
{{- .Values.apisix.deployment.standaloneConfig | nindent 4 }}
24+
{{- .Values.apisix.deployment.standalone.config | nindent 4 }}
2525
#END
2626
{{- end }}

charts/apisix/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ spec:
238238
volumes:
239239
{{- if eq .Values.apisix.deployment.mode "standalone" }}
240240
- configMap:
241-
name: apisix.yaml
241+
name: {{ .Values.apisix.deployment.standalone.existingConfigMap | default "apisix.yaml" }}
242242
name: apisix-admin
243243
{{- end }}
244244
- configMap:

charts/apisix/values.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,20 @@ apisix:
308308
# -- Standalone rules configuration
309309
#
310310
# ref: https://apisix.apache.org/docs/apisix/deployment-modes/#standalone
311-
standaloneConfig: |
312-
routes:
313-
-
314-
uri: /hi
315-
upstream:
316-
nodes:
317-
"127.0.0.1:1980": 1
318-
type: roundrobin
311+
standalone:
312+
# -- Rules which are set to the default apisix.yaml configmap.
313+
# -- if apisix.delpoyment.standalone.existingConfigMap is empty, these are used.
314+
config: |
315+
routes:
316+
-
317+
uri: /hi
318+
upstream:
319+
nodes:
320+
"127.0.0.1:1980": 1
321+
type: roundrobin
322+
# -- Specifies the name of the ConfigMap that contains the rule configurations.
323+
# The configuration must be set to the key named `apisix.yaml` in the configmap.
324+
existingConfigMap: ""
319325

320326
admin:
321327
# -- Enable Admin API

0 commit comments

Comments
 (0)