Skip to content

Add helm values to use an external configmap on APISIX standalone mode #705

@tkyoo

Description

@tkyoo

When using APISIX standalone mode as a subchart, 'apisix.yaml' configmap is always re-initialized when upgrading the parent chart.

I think using an external configmap as the "apisix.yaml" is a simple solution for solving them!

Example: (variable names and paths are very sensitive part of the project, so this code is just a sample!)

apisix-config-configmap.yaml:

{{- if and (eq .Values.deployment.mode "standalone") (eq (len .Values.apisix.standalone.extraConfigMap) 0 ) }}
kind: ConfigMap
apiVersion: v1
metadata:
  name: apisix.yaml
data:
  apisix.yaml: |
    routes:
    -
      uri: /hi
      upstream:
        nodes:
          "127.0.0.1:1980": 1
        type: roundrobin
    #END
{{- end }}

_pod.tpl:

  volumes:
    {{- if eq .Values.deployment.mode "standalone" }}
    - configMap:
        name: {{ .Values.apisix.standalone.extraConfigMap | default "apisix.yaml" }}
      name: apisix-admin
    {{- end }}

values.yaml:

apisix:
  ...
  standalone:
    extraConfigMap: "apisix-yaml"

Maybe this feature will also be very helpful for other APISIX users :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions