Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions charts/apisix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ The command removes all the Kubernetes components associated with the chart and
| apisix.ssl.existingCASecret | string | `""` | Specifies the name of Secret contains trusted CA certificates in the PEM format used to verify the certificate when APISIX needs to do SSL/TLS handshaking with external services (e.g. etcd) |
| apisix.ssl.fallbackSNI | string | `""` | Define SNI to fallback if none is presented by client |
| apisix.ssl.sslProtocols | string | `"TLSv1.2 TLSv1.3"` | TLS protocols allowed to use. |
| apisix.standaloneConfig.config | string | `""` | If apisix.deployment.mode is "standalone": custom apisix.yaml as string. Takes precedence over configMapRef. |
| apisix.standaloneConfig.configMapName | string | `""` | If apisix.deployment.mode is "standalone": reference to an existing config map. It must contain the key "apisix.yaml". |
| apisix.stream_plugins | list | `[]` | Customize the list of APISIX stream_plugins to enable. By default, APISIX's default stream_plugins are automatically used. See [config-default.yaml](https://github.com/apache/apisix/blob/master/conf/config-default.yaml) |
| apisix.vault.enabled | bool | `false` | Enable or disable the vault integration |
| apisix.vault.host | string | `""` | The host address where the vault server is running. |
Expand Down
22 changes: 22 additions & 0 deletions charts/apisix/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,25 @@ Key to use to fetch viewer token from secret
{{- "viewer" }}
{{- end }}
{{- end }}

{{/*
Return true if we should render the standalone config.
*/}}
{{- define "apisix.shouldRenderStandaloneConfig" -}}
{{- $isStandalone := eq .Values.apisix.deployment.mode "standalone" -}}
{{- $configEmpty := empty .Values.apisix.standaloneConfig.config -}}
{{- $configMapNameEmpty := empty .Values.apisix.standaloneConfig.configMapName -}}
{{- $dontRender := and $configEmpty (not $configMapNameEmpty) -}}
{{- ternary true false (and $isStandalone (not $dontRender)) -}}
{{- end }}

{{/*
Return the name of the standalone config.
*/}}
{{- define "apisix.standaloneConfigName" -}}
{{- if (eq (include "apisix.shouldRenderStandaloneConfig" .) "true") -}}
"apisix.yaml"
{{- else -}}
{{ .Values.apisix.standaloneConfig.configMapName | quote }}
{{- end -}}
{{- end }}
7 changes: 6 additions & 1 deletion charts/apisix/templates/apisix-config-cm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if eq .Values.apisix.deployment.mode "standalone" }}
{{- if (eq (include "apisix.shouldRenderStandaloneConfig" .) "true") }}
kind: ConfigMap
apiVersion: v1
metadata:
name: apisix.yaml
data:
apisix.yaml: |
{{- with .Values.apisix.standaloneConfig.config }}
{{ . | indent 4 }}
{{- else }}
# Use apisix.standaloneConfig.config to customize this
routes:
-
uri: /hi
Expand All @@ -30,3 +34,4 @@ data:
type: roundrobin
#END
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/apisix/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ spec:
volumes:
{{- if eq .Values.apisix.deployment.mode "standalone" }}
- configMap:
name: apisix.yaml
name: {{ include "apisix.standaloneConfigName" . }}
name: apisix-admin
{{- end }}
- configMap:
Expand Down
7 changes: 7 additions & 0 deletions charts/apisix/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ apisix:
# ref: https://apisix.apache.org/docs/apisix/deployment-modes/
role: "traditional"

standaloneConfig:
# -- If apisix.deployment.mode is "standalone": custom apisix.yaml as string. Takes precedence over configMapRef.
config: ""
# -- If apisix.deployment.mode is "standalone": reference to an existing config map. It must contain the key "apisix.yaml".
configMapName: ""


admin:
# -- Enable Admin API
enabled: true
Expand Down