520a83faf797f5ba239cf2ce7b0f70c010ba7f25
[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           ports:
75             - containerPort: 8000
76               name: proxy
77               protocol: TCP
78             - containerPort: 8443
79               name: proxy-ssl
80               protocol: TCP
81             - containerPort: 8001
82               name: admin-api
83               protocol: TCP
84             - containerPort: 8444
85               name: admin-api-ssl
86               protocol: TCP
87           volumeMounts:
88             - name: kongssl
89               mountPath: "/run/kongssl"
90               readOnly: true
91       volumes:
92         - name: kongssl
93           secret:
94             secretName: kongssl-secret
95
96
97 # kong service
98 ---
99 apiVersion: v1
100 kind: Service
101 metadata:
102   name: kong-service
103   namespace: mep
104 spec:
105   selector:
106     app: apigw-kong
107   type: NodePort
108   ports:
109     - port: 8000
110       name: proxy
111     - port: 8443
112       name: proxy-ssl
113     - port: 8001
114       name: admin-api
115     - port: 8444
116       name: admin-api-ssl