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/apisix-helm-chart.git
The following commit(s) were added to refs/heads/master by this push:
new 7dce1da feat: support to expose admin api (#19)
7dce1da is described below
commit 7dce1da72e6b5f6a8eb56429932d1bfa6ff041df
Author: Alex Zhang <[email protected]>
AuthorDate: Wed Jan 13 20:55:21 2021 +0800
feat: support to expose admin api (#19)
---
chart/apisix/templates/configmap.yaml | 6 ++-
chart/apisix/templates/deployment.yaml | 5 +++
.../{service-gateway.yaml => service-admin.yaml} | 44 +++++++++-------------
chart/apisix/templates/service-gateway.yaml | 2 +
chart/apisix/values.yaml | 9 +++++
5 files changed, 38 insertions(+), 28 deletions(-)
diff --git a/chart/apisix/templates/configmap.yaml
b/chart/apisix/templates/configmap.yaml
index 36e500e..01e6987 100644
--- a/chart/apisix/templates/configmap.yaml
+++ b/chart/apisix/templates/configmap.yaml
@@ -82,7 +82,9 @@ data:
- 0.0.0.0/0
{{- end}}
# - "::/64"
- # port_admin: 9180 # use a separate port
+ {{- if .Values.admin.enabled }}
+ port_admin: {{ .Values.admin.port }}
+ {{- end }}
# Default token when use API to call for Admin API.
# *NOTE*: Highly recommended to modify this value to protect APISIX's
Admin API.
@@ -162,4 +164,4 @@ data:
stream_plugins:
{{- range $plugin := .Values.stream_plugins }}
- {{ $plugin }}
- {{- end }}
\ No newline at end of file
+ {{- end }}
diff --git a/chart/apisix/templates/deployment.yaml
b/chart/apisix/templates/deployment.yaml
index e21bc23..f5ea61f 100644
--- a/chart/apisix/templates/deployment.yaml
+++ b/chart/apisix/templates/deployment.yaml
@@ -57,6 +57,11 @@ spec:
- name: tls
containerPort: {{ .Values.gateway.tls.containerPort }}
protocol: TCP
+ {{- if .Values.admin.enabled }}
+ - name: admin
+ containerPort: {{ .Values.admin.port }}
+ protocol: TCP
+ {{- end }}
readinessProbe:
failureThreshold: 6
initialDelaySeconds: 10
diff --git a/chart/apisix/templates/service-gateway.yaml
b/chart/apisix/templates/service-admin.yaml
similarity index 52%
copy from chart/apisix/templates/service-gateway.yaml
copy to chart/apisix/templates/service-admin.yaml
index 5866fe2..9d3b535 100644
--- a/chart/apisix/templates/service-gateway.yaml
+++ b/chart/apisix/templates/service-admin.yaml
@@ -13,53 +13,45 @@
# 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.admin.enabled }}
apiVersion: v1
kind: Service
metadata:
- name: {{ include "apisix.fullname" . }}-gateway
+ name: {{ include "apisix.fullname" . }}-admin
namespace: {{ .Release.Namespace }}
annotations:
- {{- range $key, $value := .Values.gateway.annotations }}
+ {{- range $key, $value := .Values.admin.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 }}
+ type: {{ .Values.admin.type }}
+ {{- if eq .Values.admin.type "LoadBalancer" }}
+ {{- if .Values.admin.loadBalancerIP }}
+ loadBalancerIP: {{ .Values.admin.loadBalancerIP }}
{{- end }}
- {{- if .Values.gateway.loadBalancerSourceRanges }}
+ {{- if .Values.admin.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
- {{- range $cidr := .Values.gateway.loadBalancerSourceRanges }}
+ {{- range $cidr := .Values.admin.loadBalancerSourceRanges }}
- {{ $cidr }}
{{- end }}
{{- end }}
{{- end }}
+ {{- if gt (len .Values.admin.externalIPs) 0 }}
externalIPs:
- {{- range $ip := .Values.gateway.externalIPs }}
+ {{- range $ip := .Values.admin.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 }}
+ ports:
+ - name: apisix-admin
+ port: {{ .Values.admin.servicePort }}
+ targetPort: {{ .Values.admin.containerPort }}
+ {{- if (and (eq .Values.admin.type "NodePort") (not (empty
.Values.admin.nodePort))) }}
+ nodePort: {{ .Values.admin.nodePort }}
{{- end }}
protocol: TCP
- {{- end }}
selector:
{{- include "apisix.selectorLabels" . | nindent 4 }}
+{{ end }}
diff --git a/chart/apisix/templates/service-gateway.yaml
b/chart/apisix/templates/service-gateway.yaml
index 5866fe2..f7bc210 100644
--- a/chart/apisix/templates/service-gateway.yaml
+++ b/chart/apisix/templates/service-gateway.yaml
@@ -38,10 +38,12 @@ spec:
{{- end }}
{{- end }}
{{- end }}
+ {{- if gt (len .Values.admin.externalIPs) 0 }}
externalIPs:
{{- range $ip := .Values.gateway.externalIPs }}
- {{ $ip }}
{{- end }}
+ {{- end }}
ports:
{{- if .Values.gateway.http.enabled }}
- name: apisix-gateway
diff --git a/chart/apisix/values.yaml b/chart/apisix/values.yaml
index 5de32da..bb366fc 100644
--- a/chart/apisix/values.yaml
+++ b/chart/apisix/values.yaml
@@ -97,6 +97,15 @@ dns:
admin:
# Enable Admin API
enabled: true
+ # admin service type
+ type: ClusterIP
+ # loadBalancerIP: a.b.c.d
+ # loadBalancerSourceRanges:
+ # - "143.231.0.0/16"
+ externalIPs: []
+ #
+ port: 9180
+ servicePort: 9180
# Admin API support CORS response headers
cors: true
# Admin API credentials