Skip to content

Commit 1f88e2b

Browse files
author
Daniel Pap
committed
feat: timezone and extra env vars configurable in apisix ingress controller
1 parent 462df93 commit 1f88e2b

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

charts/apisix-ingress-controller/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ The same for container level, you need to set:
143143
| config.logLevel | string | `"info"` | the error log level, default is info, optional values are: debug, info, warn, error, panic, fatal |
144144
| config.logOutput | string | `"stderr"` | the output file path of error log, default is stderr, when the file path is "stderr" or "stdout", logs are marshalled plainly, which is more readable for human; otherwise logs are marshalled in JSON format, which can be parsed by programs easily. |
145145
| config.pluginMetadataCM | string | `""` | Pluginmetadata in APISIX can be controlled through ConfigMap. default is "" |
146+
| extraEnvVars | list | `[]` | extraEnvVars An array to add extra env vars e.g: extraEnvVars: - name: FOO value: "bar" - name: FOO2 valueFrom: secretKeyRef: name: SECRET_NAME key: KEY |
146147
| fullnameOverride | string | `""` | |
147148
| gateway.externalIPs | list | `[]` | load balancer ips |
148149
| gateway.externalTrafficPolicy | string | `"Cluster"` | |
@@ -185,6 +186,7 @@ The same for container level, you need to set:
185186
| serviceMonitor.annotations | object | `{}` | @param serviceMonitor.annotations ServiceMonitor annotations |
186187
| serviceMonitor.labels | object | `{}` | @param serviceMonitor.labels ServiceMonitor extra labels |
187188
| serviceMonitor.metricRelabelings | object | `{}` | @param serviceMonitor.metricRelabelings MetricRelabelConfigs to apply to samples before ingestion. ref: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs |
189+
| timezone | string | `""` | timezone is the timezone where apisix uses. For example: "UTC" or "Asia/Shanghai" This value will be set on apisix-ingress-controller container's environment variable TZ. You may need to set the timezone to be consistent with your local time zone, otherwise the apisix-ingress-controller's logs may be used to retrieve event in wrong timezone. |
188190
| tolerations | list | `[]` | |
189191
| topologySpreadConstraints | list | `[]` | Topology Spread Constraints for pod assignment spread across your cluster among failure-domains ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/#spread-constraints-for-pods |
190192
| updateStrategy | object | `{}` | Update strategy for apisix ingress controller deployment |

charts/apisix-ingress-controller/templates/_helpers.tpl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,17 @@ Key to use to fetch admin token from secret
9595
{{- else }}
9696
{{- "adminKey" }}
9797
{{- end }}
98-
{{- end }}
98+
{{- end }}
99+
100+
{{/*
101+
Renders a value that contains template.
102+
Usage:
103+
{{ include "apisix-ingress-controller.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
104+
*/}}
105+
{{- define "apisix-ingress-controller.tplvalues.render" -}}
106+
{{- if typeIs "string" .value }}
107+
{{- tpl .value .context }}
108+
{{- else }}
109+
{{- tpl (.value | toYaml) .context }}
110+
{{- end }}
111+
{{- end -}}

charts/apisix-ingress-controller/templates/deployment.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ spec:
121121
valueFrom:
122122
fieldRef:
123123
fieldPath: metadata.name
124+
{{- if .Values.timezone }}
125+
- name: TZ
126+
value: {{ .Values.timezone }}
127+
{{- end }}
128+
{{- if .Values.extraEnvVars }}
129+
{{- include "apisix-ingress-controller.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 10 }}
130+
{{- end }}
124131
{{- if .Values.config.apisix.existingSecret }}
125132
- name: DEFAULT_CLUSTER_ADMIN_KEY
126133
valueFrom:

charts/apisix-ingress-controller/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,25 @@ affinity: {}
183183
# ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/#spread-constraints-for-pods
184184
topologySpreadConstraints: []
185185

186+
# -- timezone is the timezone where apisix uses.
187+
# For example: "UTC" or "Asia/Shanghai"
188+
# This value will be set on apisix-ingress-controller container's environment variable TZ.
189+
# You may need to set the timezone to be consistent with your local time zone,
190+
# otherwise the apisix-ingress-controller's logs may be used to retrieve event in wrong timezone.
191+
timezone: ""
192+
193+
# -- extraEnvVars An array to add extra env vars
194+
# e.g:
195+
# extraEnvVars:
196+
# - name: FOO
197+
# value: "bar"
198+
# - name: FOO2
199+
# valueFrom:
200+
# secretKeyRef:
201+
# name: SECRET_NAME
202+
# key: KEY
203+
extraEnvVars: []
204+
186205
# namespace: "ingress-apisix"
187206

188207
# -- Enable creating ServiceMonitor objects for Prometheus operator.

0 commit comments

Comments
 (0)