c61475f3c583636631ca000396dcae3ff61c70d1
[ealt-edge.git] / mep / mepserver / kong-k8s.yaml
1 # Copyright 2020 Huawei Technologies Co., Ltd.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15
16 # kong deployment
17 ---
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   labels:
22     app: apigw-kong
23   name: apigw-kong
24   namespace: mep
25 spec:
26   replicas: 1
27   selector:
28     matchLabels:
29       app: apigw-kong
30   template:
31     metadata:
32       labels:
33         app: apigw-kong
34     spec:
35       initContainers:
36         - name: check-db-ready
37           image: postgres:9.6
38           command: ['sh', '-c', 'until pg_isready -h postgres-db -p 5432;
39                    do echo waiting for database; sleep 2; done;']
40       containers:
41         - name: kong-proxy
42           image: kong:1.5.1-alpine
43           env:
44             - name: KONG_DATABASE
45               value: "postgres"
46             - name: KONG_NGINX_WORKER_PROCESSES
47               value: "1"
48             - name: KONG_ADMIN_ACCESS_LOG
49               value: /dev/stdout
50             - name: KONG_ADMIN_ERROR_LOG
51               value: /dev/stderr
52             - name: KONG_ADMIN_ACCESS_LOG
53               value: /dev/stdout
54             - name: KONG_ADMIN_ERROR_LOG
55               value: /dev/stderr
56             - name: KONG_ADMIN_LISTEN
57               value: 127.0.0.1:8444 ssl
58             - name: KONG_PROXY_LISTEN
59               value: 0.0.0.0:8000, 0.0.0.0:8443 ssl http2
60             - name: KONG_ADMIN_LISTEN
61               value: 0.0.0.0:8001
62             - name: KONG_PG_DATABASE
63               value: kong
64             - name: KONG_PG_HOST
65               value: postgres-db
66             - name: KONG_PG_USER
67               value: kong
68             - name: KONG_PG_PASSWORD
69               value: kong
70             - name: KONG_PROXY_ACCESS_LOG
71               value: /dev/stdout
72             - name: KONG_PROXY_ERROR_LOG
73               value: /dev/stderr
74             #- name: KONG_SSL_CERT
75               #value: /run/kongssl/server.cer
76             #- name: KONG_SSL_CERT_KEY
77               #value: /run/kongssl/server_key.pem
78           ports:
79             - containerPort: 8000
80               name: proxy
81               protocol: TCP
82             - containerPort: 8443
83               name: proxy-ssl
84               protocol: TCP
85             - containerPort: 8001
86               name: admin-api
87               protocol: TCP
88             - containerPort: 8444
89               name: admin-api-ssl
90               protocol: TCP
91           #volumeMounts:
92             #- name: kongssl
93               #mountPath: "/run/kongssl"
94               #readOnly: true
95       #volumes:
96         #- name: kongssl
97           #secret:
98             #secretName: kongssl-secret
99
100
101 # kong service
102 ---
103 apiVersion: v1
104 kind: Service
105 metadata:
106   name: kong-service
107   namespace: mep
108 spec:
109   selector:
110     app: apigw-kong
111   type: NodePort
112   ports:
113     - port: 8000
114       name: proxy
115       nodePort: 30010
116     - port: 8443
117       name: proxy-ssl
118       nodePort: 30011
119     - port: 8001
120       name: admin-api
121       nodePort: 30012
122     - port: 8444
123       name: admin-api-ssl
124       nodePort: 30013