Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tkyoo opened this issue Jan 17, 2024 · 3 comments
Open

Comments

@tkyoo
Copy link

tkyoo commented Jan 17, 2024

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 :)

@Gallardot
Copy link
Member

It's a meaningful suggestion, but few users would do this, especially in a k8s cluster. Supporting such a feature would require users to ensure correct configuration on their own, which could introduce risks.

@jompu
Copy link

jompu commented Jan 30, 2024

It's a meaningful suggestion, but few users would do this, especially in a k8s cluster. Supporting such a feature would require users to ensure correct configuration on their own, which could introduce risks.

Isn't it the idea on standalone mode, that you can edit this file? Now it is not possible to use standalone mode on kubernetes (with this helm chart) because you cannot actually add any configuration there. Unless if you are fine with editing the configmap straight on the cluster.

For example, I would like to have this configuration stored in git repository which I use for deployment. But currently it is impossible.

@jompu
Copy link

jompu commented Feb 5, 2024

I have created a pull request with related changes. The pull request allows to override content of the apisix.yaml ConfigMap or to use existing ConfigMap.

Meanwhile you can use either branch dev or more-standalone-config-options from https://github.com/jompu/apisix-helm-chart to install modified version of the APISIX 2.6.0 chart.

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

No branches or pull requests

3 participants