You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/06/22 13:10:42 UTC
[incubator-apisix-helm-chart] branch master updated: Apache APISIX
HelmChart Initial commit (#1)
This is an automated email from the ASF dual-hosted git repository.
membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-helm-chart.git
The following commit(s) were added to refs/heads/master by this push:
new 68cc029 Apache APISIX HelmChart Initial commit (#1)
68cc029 is described below
commit 68cc02996689acf38ec2f67a60eb18a7f3f1f68c
Author: Shenal Silva <sh...@users.noreply.github.com>
AuthorDate: Mon Jun 22 18:40:30 2020 +0530
Apache APISIX HelmChart Initial commit (#1)
---
README.md | 31 ++++-
chart/apisix/.helmignore | 20 +++
chart/apisix/Chart.yaml | 39 ++++++
chart/apisix/templates/NOTES.txt | 21 +++
chart/apisix/templates/_helpers.tpl | 63 +++++++++
chart/apisix/templates/configmap.yaml | 152 +++++++++++++++++++++
chart/apisix/templates/deployment.yaml | 102 ++++++++++++++
chart/apisix/templates/hpa.yaml | 44 ++++++
chart/apisix/templates/ingress.yaml | 57 ++++++++
chart/apisix/templates/service-gateway.yaml | 64 +++++++++
chart/apisix/templates/tests/test-connection.yaml | 31 +++++
chart/apisix/values.yaml | 156 ++++++++++++++++++++++
12 files changed, 779 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index dc4ba00..5a3bc63 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,30 @@
-# incubator-apisix-helm-chart
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+Apache APISIX
+=============
+
+## Documentation
+
+#### Prerequisites
+
+* Install etcd
+
+#### Deploy the chart
+$ helm install <release_name> ./chart/apisix
\ No newline at end of file
diff --git a/chart/apisix/.helmignore b/chart/apisix/.helmignore
new file mode 100644
index 0000000..351b35f
--- /dev/null
+++ b/chart/apisix/.helmignore
@@ -0,0 +1,20 @@
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/chart/apisix/Chart.yaml b/chart/apisix/Chart.yaml
new file mode 100644
index 0000000..fa435a3
--- /dev/null
+++ b/chart/apisix/Chart.yaml
@@ -0,0 +1,39 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+apiVersion: v2
+name: apisix
+description: A Helm chart for Apache APISIX
+
+# A chart can be either an 'application' or a 'library' chart.
+#
+# Application charts are a collection of templates that can be packaged into versioned archives
+# to be deployed.
+#
+# Library charts provide useful utilities or functions for the chart developer. They're included as
+# a dependency of application charts to inject those utilities and functions into the rendering
+# pipeline. Library charts do not define any templates and therefore cannot be deployed.
+type: application
+
+# This is the chart version. This version number should be incremented each time you make changes
+# to the chart and its templates, including the app version.
+# Versions are expected to follow Semantic Versioning (https://semver.org/)
+version: 0.1.0
+
+# This is the version number of the application being deployed. This version number should be
+# incremented each time you make changes to the application. Versions are not expected to
+# follow Semantic Versioning. They should reflect the version the application is using.
+appVersion: 1.16.0
diff --git a/chart/apisix/templates/NOTES.txt b/chart/apisix/templates/NOTES.txt
new file mode 100644
index 0000000..a654315
--- /dev/null
+++ b/chart/apisix/templates/NOTES.txt
@@ -0,0 +1,21 @@
+1. Get the application URL by running these commands:
+{{- if .Values.gateway.ingress.enabled }}
+{{- range $host := .Values.gateway.ingress.hosts }}
+ {{- range .paths }}
+ http{{ if $.Values.gateway.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
+ {{- end }}
+{{- end }}
+{{- else if contains "NodePort" .Values.gateway.type }}
+ export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "apisix.fullname" . }})
+ export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
+ echo http://$NODE_IP:$NODE_PORT
+{{- else if contains "LoadBalancer" .Values.gateway.type }}
+ NOTE: It may take a few minutes for the LoadBalancer IP to be available.
+ You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "apisix.fullname" . }}'
+ export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "apisix.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
+ echo http://$SERVICE_IP:{{ .Values.gateway.http.servicePort }}
+{{- else if contains "ClusterIP" .Values.gateway.type }}
+ export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "apisix.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
+ echo "Visit http://127.0.0.1:8080 to use your application"
+ kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
+{{- end }}
diff --git a/chart/apisix/templates/_helpers.tpl b/chart/apisix/templates/_helpers.tpl
new file mode 100644
index 0000000..27252c0
--- /dev/null
+++ b/chart/apisix/templates/_helpers.tpl
@@ -0,0 +1,63 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "apisix.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "apisix.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "apisix.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "apisix.labels" -}}
+helm.sh/chart: {{ include "apisix.chart" . }}
+{{ include "apisix.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "apisix.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "apisix.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "apisix.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "apisix.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
diff --git a/chart/apisix/templates/configmap.yaml b/chart/apisix/templates/configmap.yaml
new file mode 100644
index 0000000..5e69fa0
--- /dev/null
+++ b/chart/apisix/templates/configmap.yaml
@@ -0,0 +1,152 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "apisix.fullname" . }}
+data:
+ config.yaml: |-
+ #
+ # Licensed to the Apache Software Foundation (ASF) under one or more
+ # contributor license agreements. See the NOTICE file distributed with
+ # this work for additional information regarding copyright ownership.
+ # The ASF licenses this file to You under the Apache License, Version 2.0
+ # (the "License"); you may not use this file except in compliance with
+ # the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+ apisix:
+ node_listen: {{ .Values.gateway.http.containerPort }} # APISIX listening port
+ enable_heartbeat: true
+ enable_admin: {{ .Values.admin.enabled }}
+ enable_admin_cors: {{ .Values.admin.cors }}
+ enable_debug: false
+ enable_dev_mode: false # Sets nginx worker_processes to 1 if set to true
+ enable_reuseport: true # Enable nginx SO_REUSEPORT switch if set to true.
+ enable_ipv6: true
+ config_center: etcd # etcd: use etcd to store the config value
+ # yaml: fetch the config value from local yaml file `/your_path/conf/apisix.yaml`
+
+ #proxy_protocol: # Proxy Protocol configuration
+ # listen_http_port: 9181 # The port with proxy protocol for http, it differs from node_listen and port_admin.
+ # This port can only receive http request with proxy protocol, but node_listen & port_admin
+ # can only receive http request. If you enable proxy protocol, you must use this port to
+ # receive http request with proxy protocol
+ # listen_https_port: 9182 # The port with proxy protocol for https
+ # enable_tcp_pp: true # Enable the proxy protocol for tcp proxy, it works for stream_proxy.tcp option
+ # enable_tcp_pp_to_upstream: true # Enables the proxy protocol to the upstream server
+
+ proxy_cache: # Proxy Caching configuration
+ cache_ttl: 10s # The default caching time if the upstream does not specify the cache time
+ zones: # The parameters of a cache
+ - name: disk_cache_one # The name of the cache, administrator can be specify
+ # which cache to use by name in the admin api
+ memory_size: 50m # The size of shared memory, it's used to store the cache index
+ disk_size: 1G # The size of disk, it's used to store the cache data
+ disk_path: "/tmp/disk_cache_one" # The path to store the cache data
+ cache_levels: "1:2" # The hierarchy levels of a cache
+ # - name: disk_cache_two
+ # memory_size: 50m
+ # disk_size: 1G
+ # disk_path: "/tmp/disk_cache_two"
+ # cache_levels: "1:2"
+
+ # allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
+ # - 127.0.0.0/24 # If we don't set any IP list, then any IP access is allowed by default.
+ # - 172.17.0.0/24
+ # - "::/64"
+ # port_admin: 9180 # use a separate port
+
+ # Default token when use API to call for Admin API.
+ # *NOTE*: Highly recommended to modify this value to protect APISIX's Admin API.
+ # Disabling this configuration item means that the Admin API does not
+ # require any authentication.
+ admin_key:
+ -
+ name: "admin"
+ key: {{ .Values.admin.credentials.admin }}
+ role: admin
+ # viewer: only can view configuration data
+ -
+ name: "viewer"
+ key: {{ .Values.admin.credentials.viewer }}
+ role: viewer
+ router:
+ http: 'radixtree_uri' # radixtree_uri: match route by uri(base on radixtree)
+ # radixtree_host_uri: match route by host + uri(base on radixtree)
+ ssl: 'radixtree_sni' # radixtree_sni: match route by SNI(base on radixtree)
+ # stream_proxy: # TCP/UDP proxy
+ # tcp: # TCP proxy port list
+ # - 9100
+ # - 9101
+ # udp: # UDP proxy port list
+ # - 9200
+ # - 9211
+ # dns_resolver:
+ # {{- range $resolver := .Values.dns.resolvers }}
+ # - {{ $resolver }}
+ # {{- end }}
+ dns_resolver_valid: {{.Values.dns.validity}}
+ resolver_timeout: {{.Values.dns.timeout}}
+ ssl:
+ enable: {{ .Values.gateway.tls.enabled }}
+ enable_http2: {{ .Values.gateway.tls.http2.enabled }}
+ listen_port: {{ .Values.gateway.tls.containerPort }}
+ ssl_protocols: "TLSv1 TLSv1.1 TLSv1.2 TLSv1.3"
+ ssl_ciphers: "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA- [...]
+
+ nginx_config: # config for render the template to genarate nginx.conf
+ error_log: "/dev/stderr"
+ error_log_level: "warn" # warn,error
+ worker_rlimit_nofile: 20480 # the number of files a worker process can open, should be larger than worker_connections
+ event:
+ worker_connections: 10620
+ http:
+ access_log: "/dev/stdout"
+ keepalive_timeout: 60s # timeout during which a keep-alive client connection will stay open on the server side.
+ client_header_timeout: 60s # timeout for reading client request header, then 408 (Request Time-out) error is returned to the client
+ client_body_timeout: 60s # timeout for reading client request body, then 408 (Request Time-out) error is returned to the client
+ send_timeout: 10s # timeout for transmitting a response to the client.then the connection is closed
+ underscores_in_headers: "on" # default enables the use of underscores in client request header fields
+ real_ip_header: "X-Real-IP" # http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
+ real_ip_from: # http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
+ - 127.0.0.1
+ - 'unix:'
+ #lua_shared_dicts: # add custom shared cache to nginx.conf
+ # ipc_shared_dict: 100m # custom shared cache, format: `cache-key: cache-size`
+
+ etcd:
+ host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
+ - {{ .Values.etcd.host | quote }} # multiple etcd address
+ prefix: {{ .Values.etcd.prefix | quote }} # apisix configurations prefix
+ timeout: {{ .Values.etcd.timeout }} # 3 seconds
+
+ plugins: # plugin list
+ {{- range $plugin := .Values.plugins }}
+ - {{ $plugin }}
+ {{- end }}
+ stream_plugins:
+ {{- range $plugin := .Values.stream_plugins }}
+ - {{ $plugin }}
+ {{- end }}
\ No newline at end of file
diff --git a/chart/apisix/templates/deployment.yaml b/chart/apisix/templates/deployment.yaml
new file mode 100644
index 0000000..7aeef3c
--- /dev/null
+++ b/chart/apisix/templates/deployment.yaml
@@ -0,0 +1,102 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ include "apisix.fullname" . }}
+ labels:
+ {{- include "apisix.labels" . | nindent 4 }}
+spec:
+{{- if not .Values.autoscaling.enabled }}
+ replicas: {{ .Values.replicaCount }}
+{{- end }}
+ selector:
+ matchLabels:
+ {{- include "apisix.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ {{- with .Values.podAnnotations }}
+ annotations:
+ {{- toYaml . | nindent 8 }}
+ checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
+ {{- end }}
+ labels:
+ {{- include "apisix.selectorLabels" . | nindent 8 }}
+ spec:
+ {{- with .Values.imagePullSecrets }}
+ imagePullSecrets:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ securityContext:
+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
+ containers:
+ - name: {{ .Chart.Name }}
+ securityContext:
+ {{- toYaml .Values.securityContext | nindent 12 }}
+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ ports:
+ - name: http
+ containerPort: {{ .Values.gateway.http.containerPort }}
+ protocol: TCP
+ - name: tls
+ containerPort: {{ .Values.gateway.tls.containerPort }}
+ protocol: TCP
+ readinessProbe:
+ failureThreshold: 6
+ initialDelaySeconds: 10
+ periodSeconds: 10
+ successThreshold: 1
+ tcpSocket:
+ port: {{ .Values.gateway.http.containerPort }}
+ timeoutSeconds: 1
+ lifecycle:
+ preStop:
+ exec:
+ command:
+ - /bin/sh
+ - -c
+ - "sleep 30"
+ volumeMounts:
+ - mountPath: /usr/local/apisix/conf/config.yaml
+ name: apisix-config
+ subPath: config.yaml
+ resources:
+ {{- toYaml .Values.resources | nindent 12 }}
+ # - name: dnsmasq
+ # image: "janeczku/go-dnsmasq:release-1.0.7"
+ # args:
+ # - --listen
+ # - "127.0.0.1:53"
+ # - --default-resolver
+ # - --append-search-domains
+ volumes:
+ - configMap:
+ name: {{ include "apisix.fullname" . }}
+ name: apisix-config
+ {{- with .Values.nodeSelector }}
+ nodeSelector:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.affinity }}
+ affinity:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ {{- with .Values.tolerations }}
+ tolerations:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
diff --git a/chart/apisix/templates/hpa.yaml b/chart/apisix/templates/hpa.yaml
new file mode 100644
index 0000000..fe478be
--- /dev/null
+++ b/chart/apisix/templates/hpa.yaml
@@ -0,0 +1,44 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if .Values.autoscaling.enabled }}
+apiVersion: autoscaling/v2beta1
+kind: HorizontalPodAutoscaler
+metadata:
+ name: {{ include "apisix.fullname" . }}
+ labels:
+ {{- include "apisix.labels" . | nindent 4 }}
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ include "apisix.fullname" . }}
+ minReplicas: {{ .Values.autoscaling.minReplicas }}
+ maxReplicas: {{ .Values.autoscaling.maxReplicas }}
+ metrics:
+ {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
+ - type: Resource
+ resource:
+ name: cpu
+ targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
+ {{- end }}
+ {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
+ - type: Resource
+ resource:
+ name: memory
+ targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
+ {{- end }}
+{{- end }}
diff --git a/chart/apisix/templates/ingress.yaml b/chart/apisix/templates/ingress.yaml
new file mode 100644
index 0000000..e6dcdb7
--- /dev/null
+++ b/chart/apisix/templates/ingress.yaml
@@ -0,0 +1,57 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if .Values.gateway.ingress.enabled -}}
+{{- $fullName := include "apisix.fullname" . -}}
+{{- $svcPort := .Values.gateway.http.servicePort -}}
+{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1beta1
+{{- else -}}
+apiVersion: extensions/v1beta1
+{{- end }}
+kind: Ingress
+metadata:
+ name: {{ $fullName }}
+ labels:
+ {{- include "apisix.labels" . | nindent 4 }}
+ {{- with .Values.gateway.ingress.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ {{- if .Values.gateway.ingress.tls }}
+ tls:
+ {{- range .Values.gateway.ingress.tls }}
+ - hosts:
+ {{- range .hosts }}
+ - {{ . | quote }}
+ {{- end }}
+ secretName: {{ .secretName }}
+ {{- end }}
+ {{- end }}
+ rules:
+ {{- range .Values.gateway.ingress.hosts }}
+ - host: {{ .host | quote }}
+ http:
+ paths:
+ {{- range .paths }}
+ - path: {{ . }}
+ backend:
+ serviceName: {{ $fullName }}
+ servicePort: {{ $svcPort }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
diff --git a/chart/apisix/templates/service-gateway.yaml b/chart/apisix/templates/service-gateway.yaml
new file mode 100644
index 0000000..59f9d58
--- /dev/null
+++ b/chart/apisix/templates/service-gateway.yaml
@@ -0,0 +1,64 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ include "apisix.fullname" . }}-gateway
+ annotations:
+ {{- range $key, $value := .Values.gateway.annotations }}
+ {{ $key }}: {{ $value | quote }}
+ {{- end }}
+ labels:
+ {{- include "apisix.labels" . | nindent 4 }}
+spec:
+ type: {{ .Values.gateway.type }}
+ {{- if eq .Values.gateway.type "LoadBalancer" }}
+ {{- if .Values.gateway.loadBalancerIP }}
+ loadBalancerIP: {{ .Values.gateway.loadBalancerIP }}
+ {{- end }}
+ {{- if .Values.gateway.loadBalancerSourceRanges }}
+ loadBalancerSourceRanges:
+ {{- range $cidr := .Values.gateway.loadBalancerSourceRanges }}
+ - {{ $cidr }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+ externalIPs:
+ {{- range $ip := .Values.gateway.externalIPs }}
+ - {{ $ip }}
+ {{- end }}
+ ports:
+ {{- if .Values.gateway.http.enabled }}
+ - name: apisix-gateway
+ port: {{ .Values.gateway.http.servicePort }}
+ targetPort: {{ .Values.gateway.http.containerPort }}
+ {{- if (and (eq .Values.gateway.type "NodePort") (not (empty .Values.gateway.http.nodePort))) }}
+ nodePort: {{ .Values.gateway.http.nodePort }}
+ {{- end }}
+ protocol: TCP
+ {{- end }}
+ {{- if or .Values.gateway.tls.enabled }}
+ - name: apisix-gateway-tls
+ port: {{ .Values.gateway.tls.servicePort }}
+ targetPort: {{ .Values.gateway.tls.containerPort }}
+ {{- if (and (eq .Values.gateway.type "NodePort") (not (empty .Values.gateway.tls.nodePort))) }}
+ nodePort: {{ .Values.gateway.tls.nodePort }}
+ {{- end }}
+ protocol: TCP
+ {{- end }}
+ selector:
+ {{- include "apisix.selectorLabels" . | nindent 4 }}
diff --git a/chart/apisix/templates/tests/test-connection.yaml b/chart/apisix/templates/tests/test-connection.yaml
new file mode 100644
index 0000000..d5bf0ea
--- /dev/null
+++ b/chart/apisix/templates/tests/test-connection.yaml
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+kind: Pod
+metadata:
+ name: "{{ include "apisix.fullname" . }}-test-connection"
+ labels:
+ {{- include "apisix.labels" . | nindent 4 }}
+ annotations:
+ "helm.sh/hook": test-success
+spec:
+ containers:
+ - name: wget
+ image: busybox
+ command: ['wget']
+ args: ['{{ include "apisix.fullname" . }}:{{ .Values.gateway.http.containerPort }}']
+ restartPolicy: Never
diff --git a/chart/apisix/values.yaml b/chart/apisix/values.yaml
new file mode 100644
index 0000000..217d9ea
--- /dev/null
+++ b/chart/apisix/values.yaml
@@ -0,0 +1,156 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+replicaCount: 1
+image:
+ repository: apache/apisix
+ pullPolicy: IfNotPresent
+ # Overrides the image tag whose default is the chart appVersion.
+ tag: 1.3-alpine
+
+imagePullSecrets: []
+nameOverride: ""
+fullnameOverride: ""
+
+podAnnotations: {}
+
+podSecurityContext: {}
+ # fsGroup: 2000
+
+securityContext: {}
+ # capabilities:
+ # drop:
+ # - ALL
+ # readOnlyRootFilesystem: true
+ # runAsNonRoot: true
+ # runAsUser: 1000
+
+gateway:
+ type: NodePort
+ # type: LoadBalancer
+ # annotations:
+ # service.beta.kubernetes.io/aws-load-balancer-type: nlb
+ http:
+ enabled: true
+ servicePort: 80
+ containerPort: 9080
+ tls:
+ enabled: false
+ servicePort: 443
+ containerPort: 9443
+ http2:
+ enabled: true
+
+ ingress:
+ enabled: false
+ annotations:
+ # kubernetes.io/ingress.class: nginx
+ # kubernetes.io/tls-acme: "true"
+ hosts:
+ - host: apisix.local
+ paths: []
+ tls: []
+ # - secretName: apisix-tls
+ # hosts:
+ # - chart-example.local
+
+# etcd configuration
+# use the FQDN address or the IP of the etcd
+etcd:
+ host: http://etcd-apisix.local:2379 # http://172.20.128.89:2379
+ prefix: "/apisix"
+ timeout: 3
+
+dns:
+ resolvers:
+ - 127.0.0.1
+ - 172.20.0.10
+ - 114.114.114.114
+ - 223.5.5.5
+ - 1.1.1.1
+ - 8.8.8.8
+ validity: 30
+ timeout: 5
+
+admin:
+ # Enable Admin API
+ enabled: true
+ # Admin API support CORS response headers
+ cors: true
+ # Admin API credentials
+ credentials:
+ admin: edd1c9f034335f136f87ad84b625c8f1
+ viewer: 4054f7cf07e344346cd3f287985e76a2
+
+# APISIX plugins to be enabled
+plugins:
+ - example-plugin
+ - limit-req
+ - limit-count
+ - limit-conn
+ - key-auth
+ - basic-auth
+ - prometheus
+ - node-status
+ - jwt-auth
+ - zipkin
+ - ip-restriction
+ - grpc-transcode
+ - serverless-pre-function
+ - serverless-post-function
+ - openid-connect
+ - proxy-rewrite
+ - redirect
+ - response-rewrite
+ - fault-injection
+ - udp-logger
+ - wolf-rbac
+ - proxy-cache
+ - tcp-logger
+ - proxy-mirror
+ - kafka-logger
+ - cors
+stream_plugins:
+ - mqtt-proxy
+
+resources:
+ limits:
+ cpu: '2'
+ requests:
+ cpu: '50m'
+ # We usually recommend not to specify default resources and to leave this as a conscious
+ # choice for the user. This also increases chances charts run on environments with little
+ # resources, such as Minikube. If you do want to specify resources, uncomment the following
+ # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+ # limits:
+ # cpu: 100m
+ # memory: 128Mi
+ # requests:
+ # cpu: 100m
+ # memory: 128Mi
+
+autoscaling:
+ enabled: false
+ minReplicas: 1
+ maxReplicas: 100
+ targetCPUUtilizationPercentage: 80
+ targetMemoryUtilizationPercentage: 80
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}