Skip to content

Commit 16d9989

Browse files
feat: support backup mode for gateway chart (#235)
Signed-off-by: Abhishek Choudhary <[email protected]> Signed-off-by: Nic <[email protected]> Co-authored-by: Nic <[email protected]>
1 parent 2a4bfdf commit 16d9989

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

charts/gateway/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ The command removes all the Kubernetes components associated with the chart and
147147
| deployment.certs.certsSecret | string | `""` | secret name used for decoupled mode |
148148
| deployment.certs.mTLSCACert | string | `""` | mTLS CA cert filename in mTLSCACertSecret |
149149
| deployment.certs.mTLSCACertSecret | string | `""` | trusted_ca_cert name in certsSecret |
150-
| deployment.fallback_cp | object | `{}` | use cloud storage as the fallback control plane, should be consistent with the same configuration in control plane side. |
150+
| deployment.fallback_cp | object | `{}` | use cloud storage as the fallback control plane |
151151
| discovery.enabled | bool | `false` | Enable or disable API7 Gateway integration service discovery |
152152
| 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) |
153153
| dns.resolvers[0] | string | `"127.0.0.1"` | |

charts/gateway/templates/_pod.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ spec:
138138
{{- end }}
139139
{{- end }}
140140
{{- end }}
141+
{{- if and .Values.deployment.fallback_cp.mode (eq .Values.deployment.fallback_cp.mode "write") }}
142+
{{- /* Disable probes when fallback_cp mode is set to write */ -}}
143+
{{- else }}
141144
{{- if .Values.gateway.readinessProbe }}
142145
readinessProbe:
143146
{{- toYaml .Values.gateway.readinessProbe | nindent 8 }}
@@ -155,6 +158,7 @@ spec:
155158
livenessProbe:
156159
{{- toYaml .Values.gateway.livenessProbe | nindent 8 }}
157160
{{- end }}
161+
{{- end }}
158162
lifecycle:
159163
preStop:
160164
exec:

charts/gateway/templates/configmap.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ data:
186186
{{- toYaml .Values.apisix.stream.luaSharedDict | nindent 10 }}
187187
{{- end }}
188188
http:
189+
{{- if and (.Values.deployment.fallback_cp) (eq .Values.deployment.fallback_cp.mode "write") }}
190+
enable_access_log: false
191+
{{- else }}
189192
enable_access_log: {{ .Values.logs.enableAccessLog }}
193+
{{- end }}
190194
{{- if .Values.logs.enableAccessLog }}
191195
access_log: "{{ .Values.logs.accessLog }}"
192196
access_log_format: >-
@@ -262,12 +266,14 @@ data:
262266
{{- end }}
263267
264268
deployment:
265-
{{- if .Values.deployment.fallback_cp }}
266-
role: data_plane
267-
role_data_plane:
268-
config_provider: yaml
269+
{{- if and (.Values.deployment.fallback_cp) }}
269270
fallback_cp:
270271
{{- toYaml .Values.deployment.fallback_cp | nindent 8 }}
272+
{{- end }}
273+
{{- if and (.Values.deployment.fallback_cp) (ne .Values.deployment.fallback_cp.mode "write") }}
274+
role: data_plane
275+
role_data_plane:
276+
config_provider: json
271277
{{- else }}
272278
role: traditional
273279
role_traditional:

charts/gateway/values.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,20 +236,26 @@ rbac:
236236
create: false
237237

238238
deployment:
239-
# -- use cloud storage as the fallback control plane,
240-
# should be consistent with the same configuration in control plane side.
239+
# -- use cloud storage as the fallback control plane
241240
fallback_cp: {}
241+
# # Allowed values: `write`, `read`, default `read`
242+
# mode: "write"
243+
# # how often (in seconds) to sync data to cloud storage, only used when mode is `write`
244+
# interval: 10
245+
# # aws s3 configuration, when access key or secret key are not set, will use the IAM role attached to the pod
242246
# aws_s3:
243247
# access_key: "access"
244248
# secret_key: "secret"
245249
# region: "ap-south-1"
246250
# resource_bucket: "to-push-resource-data"
247251
# config_bucket: "to-push-config-data"
252+
# # azure blob storage configuration, when account key is not set, will use the Managed Identity attached to the pod
248253
# azure_blob:
249254
# account_name: "$YOUR_ACCOUNT_NAME"
250255
# account_key: "$YOUR_ACCOUNT_KEY"
251256
# resource_container: yaml
252257
# config_container: config
258+
# # optional, when not set, will use the default endpoint: "https://$YOUR_ACCOUNT_NAME.blob.core.windows.net"
253259
# endpoint: "$YOUR_AZURE_BLOB_ENDPOINT"
254260

255261
# -- certs used for certificates in decoupled mode

0 commit comments

Comments
 (0)