From 6330350e71d2642ac932bde1be06fe46180454bb Mon Sep 17 00:00:00 2001 From: Gallardot Date: Mon, 28 Mar 2022 08:55:54 +0800 Subject: [PATCH] feat(apisix): add timezone and extraEnvVars (#232) --- charts/apisix/README.md | 2 ++ charts/apisix/templates/deployment.yaml | 8 ++++++++ charts/apisix/values.yaml | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/charts/apisix/README.md b/charts/apisix/README.md index 9e773de..dfe28ea 100644 --- a/charts/apisix/README.md +++ b/charts/apisix/README.md @@ -76,6 +76,8 @@ The following tables lists the configurable parameters of the apisix chart and t | `apisix.luaModuleHook.configMapRef.name` | Name of the ConfigMap where the lua module codes store | "" | | `apisix.luaModuleHook.configMapRef.mounts[].key` | Name of the ConfigMap key, for setting the mapping relationship between ConfigMap key and the lua module code path. | `""` | | `apisix.luaModuleHook.configMapRef.mounts[].path` | Filepath of the plugin code, for setting the mapping relationship between ConfigMap key and the lua module code path. | `""` | +| `apisix.timezone` | The timezone where APISIX container uses. For example: UTC, Asia/Shanghai. This value will be set on apisix container's environment variable TZ. Sometimes may need to set the timezone to be consistent with local time zone, otherwise the apisix's logs may used to retrieve event maybe in wrong timezone. | `""` | +| `apisix.extraEnvVars` | APISIX container extra environment variables , See [define-environment-variable-container](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/) for the detail. | `[]` | `extraVolumes` | Additional `volume`, See [Kubernetes Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the detail. | `[]` | | `extraVolumeMounts` | Additional `volumeMounts`, See [Kubernetes Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for the detail. | `[]` | diff --git a/charts/apisix/templates/deployment.yaml b/charts/apisix/templates/deployment.yaml index d1a6517..cc967c3 100644 --- a/charts/apisix/templates/deployment.yaml +++ b/charts/apisix/templates/deployment.yaml @@ -51,6 +51,14 @@ spec: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.apisix.image.repository }}:{{ .Values.apisix.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.apisix.image.pullPolicy }} + env: + {{- if .Values.apisix.timezone }} + - name: TZ + value: {{ .Values.apisix.timezone }} + {{- end }} + {{- if .Values.apisix.extraEnvVars }} + {{- include "apisix.tplvalues.render" (dict "value" .Values.apisix.extraEnvVars "context" $) | nindent 12 }} + {{- end }} ports: - name: http containerPort: {{ .Values.gateway.http.containerPort }} diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml index 12f70b5..a98c1f9 100644 --- a/charts/apisix/values.yaml +++ b/charts/apisix/values.yaml @@ -96,6 +96,25 @@ apisix: podAntiAffinity: enabled: false + # timezone is the timezone where apisix uses. + # For example: "UTC" or "Asia/Shanghai" + # This value will be set on apisix container's environment variable TZ. + # You may need to set the timezone to be consistent with your local time zone, + # otherwise the apisix's logs may used to retrieve event maybe in wrong timezone. + timezone: "" + + # extraEnvVars An array to add extra env vars + # e.g: + # extraEnvVars: + # - name: FOO + # value: "bar" + # - name: FOO2 + # valueFrom: + # secretKeyRef: + # name: SECRET_NAME + # key: KEY + extraEnvVars: [] + nameOverride: "" fullnameOverride: ""