Initial MEP server code 20/3420/2
authorkhemendra kumar <khemendra.kumar@huawei.com>
Tue, 12 May 2020 13:44:31 +0000 (19:14 +0530)
committerkhemendra kumar <khemendra.kumar@huawei.com>
Tue, 12 May 2020 15:36:31 +0000 (21:06 +0530)
Change-Id: I3986c22be57fdf2f32cdab9f8cc949d140836a05

28 files changed:
mep/LICENSE [new file with mode: 0644]
mep/mepserver/conf/app.conf [new file with mode: 0644]
mep/mepserver/create_mep_secret.sh [new file with mode: 0755]
mep/mepserver/deploy.sh [new file with mode: 0755]
mep/mepserver/docker-build.sh [new file with mode: 0755]
mep/mepserver/docker/Dockerfile [new file with mode: 0644]
mep/mepserver/go.mod [new file with mode: 0644]
mep/mepserver/go.sum [new file with mode: 0644]
mep/mepserver/kong-k8s.yaml [new file with mode: 0644]
mep/mepserver/main.go [new file with mode: 0644]
mep/mepserver/mep-basic.yaml [new file with mode: 0644]
mep/mepserver/mep-k8s.yaml [new file with mode: 0755]
mep/mepserver/mp1/arch/bus/base.go [new file with mode: 0644]
mep/mepserver/mp1/arch/bus/load.go [new file with mode: 0644]
mep/mepserver/mp1/models/categoryref.go [new file with mode: 0644]
mep/mepserver/mp1/models/endpointinfo.go [new file with mode: 0644]
mep/mepserver/mp1/models/filtering_criteria.go [new file with mode: 0644]
mep/mepserver/mp1/models/problemdetails.go [new file with mode: 0644]
mep/mepserver/mp1/models/securityinfo.go [new file with mode: 0644]
mep/mepserver/mp1/models/securityinfo_oauth2_info.go [new file with mode: 0644]
mep/mepserver/mp1/models/ser_avail_notify_subscribe.go [new file with mode: 0644]
mep/mepserver/mp1/models/serviceinfo.go [new file with mode: 0644]
mep/mepserver/mp1/models/transportinfo.go [new file with mode: 0644]
mep/mepserver/mp1/util/meputil.go [new file with mode: 0644]
mep/mepserver/mp1/uuid/mp1context.go [new file with mode: 0644]
mep/mepserver/postgres-k8s.yaml [new file with mode: 0644]
mep/mepserver/start.sh [new file with mode: 0755]
mep/mepserver/undeploy.sh [new file with mode: 0755]

diff --git a/mep/LICENSE b/mep/LICENSE
new file mode 100644 (file)
index 0000000..607e48e
--- /dev/null
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2020 Huawei Technologies Co., Ltd.
+
+   Licensed 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.
diff --git a/mep/mepserver/conf/app.conf b/mep/mepserver/conf/app.conf
new file mode 100644 (file)
index 0000000..8e5cced
--- /dev/null
@@ -0,0 +1,166 @@
+# 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.
+
+component_name = service_center
+#run mode could be many options to specify the env like prod,dev
+runmode = dev
+
+###################################################################
+# Frontend Configurations
+###################################################################
+frontend_host_ip = 127.0.0.1
+frontend_host_port = 30103
+
+###################################################################
+# sever options
+###################################################################
+# if you want to listen at ipv6 address, then set the httpaddr value like:
+# httpaddr = 2400:A480:AAAA:200::159        (global scope)
+# httpaddr = fe80::f816:3eff:fe17:c38b%eth0 (link-local scope)
+httpaddr = 127.0.0.1
+httpport = 8088
+
+read_header_timeout = 60s
+read_timeout = 60s
+idle_timeout = 60s
+write_timeout = 60s
+# 32K
+max_header_bytes = 32768
+# 2M
+max_body_bytes = 2097152
+
+enable_pprof = 0
+
+###################################################################
+# plugin options
+###################################################################
+plugins_dir = ./plugins
+
+# pluggable discovery service
+discovery_plugin = etcd
+# the discovery plugins are part of aggregator
+aggregate_mode = ""
+
+# enable to register service center to backend registry
+self_register = 1
+
+# pluggable registry service
+# 'etcd' means app running as an etcd agent
+# 'embeded_etcd' means app running as an etcd server
+registry_plugin = embeded_etcd
+
+# registry address
+# 1. if registry_plugin equals to 'embeded_etcd'
+manager_name = "sc-0"
+manager_addr = "http://127.0.0.1:2380"
+manager_cluster = "sc-0=http://127.0.0.1:2380"
+# 2. if registry_plugin equals to 'etcd'
+# manager_cluster = "127.0.0.1:2379"
+# manager_cluster = "127.0.0.1:2381
+
+# heartbeat that sync synchronizes client's endpoints with the known endpoints from
+# the etcd membership, unit is second and value must greater then 1s, it is set
+# default 30s if value less then 0
+auto_sync_interval = 30s
+
+# the timeout for failing to establish a connection
+connect_timeout = 10s
+# the timeout for failing to read response of registry
+registry_timeout = 30s
+
+# indicate how many revision you want to keep in etcd
+compact_index_delta = 100
+compact_interval = 12h
+
+# registry cache, if this option value set 0, service center can run
+# in lower memory but no longer push the events to client.
+enable_cache = 1
+
+# pluggable cipher
+cipher_plugin = ""
+
+# suppot buildin, unlimit
+# in buildin mode(default): microservice capacity is 50000
+#                           instance capacity is 150000
+#                           schema capacity of single microservice is 100
+#                           rule capacity of single microservice is 100
+#                           tag capacity of single microservice is 100
+# in unlimit mode: all resource capacities are unlimited, including
+#                  microservices, instances, schemas, rules, tags
+quota_plugin = ""
+
+#access control plugin
+auth_plugin = ""
+
+#support om, manage
+auditlog_plugin = ""
+
+#tracing: buildin(zipkin)
+#  buildin(zipkin): Can export TRACING_COLLECTOR env variable to select
+#                   collector type, 'server' means report trace data
+#                   to zipkin server address specified by TRACING_SERVER_ADDRESS
+#                   env variable; 'file' means just output a file stored
+#                   in path specified by TRACING_FILE_PATH env variable
+trace_plugin = ""
+
+#customize the uuid format
+uuid_plugin = "mp1context"
+
+###################################################################
+# rate limit options
+###################################################################
+#ttl=m, s, ms
+limit_ttl = "s"
+#set 0 to disable rate limit
+limit_conns = 0
+#list of places to look for IP address
+limit_iplookups = "RemoteAddr,X-Forwarded-For,X-Real-IP"
+
+###################################################################
+# ssl/tls options
+###################################################################
+ssl_plugin = ""
+# 0=Non-SSL mode, 1==SSL mode
+ssl_mode = 0
+ssl_verify_client = 1
+# minimal tls protocol, [TLSv1.0, TLSv1.1, TLSv1.2]
+ssl_min_version = TLSv1.2
+ssl_ciphers = TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256
+
+###################################################################
+# log options
+###################################################################
+# MaxSize of a log file before rotate. By M Bytes.
+log_rotate_size = 20
+# Max counts to keep of a log's backup files.
+log_backup_count = 50
+# log format(text or json type)
+log_format = text
+# whether enable record syslog
+log_sys = false
+
+###################################################################
+# above is the global configurations
+# you can overide above configuration in specific env
+###################################################################
+[prod]
+# DEBUG, INFO, WARN, ERROR, FATAL
+loglevel = INFO
+logfile = ./service-center.log
+## dev env, if you are a operator,ignore this env
+[dev]
+loglevel = DEBUG
+logfile = ""
+enable_pprof = 1
\ No newline at end of file
diff --git a/mep/mepserver/create_mep_secret.sh b/mep/mepserver/create_mep_secret.sh
new file mode 100755 (executable)
index 0000000..8480e31
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+kubectl create namespace mep
+kubectl create secret --namespace mep generic mepssl-secret --from-file=server.cer --from-file=server_key.pem --from-file=trust.cer
diff --git a/mep/mepserver/deploy.sh b/mep/mepserver/deploy.sh
new file mode 100755 (executable)
index 0000000..095db45
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+./create_mep_secret.sh
+
+ kubectl apply -f mep-basic.yaml
+ kubectl apply -f postgres-k8s.yaml
+# kubectl apply -f kong-k8s.yaml
+ kubectl apply -f mep-k8s.yaml
diff --git a/mep/mepserver/docker-build.sh b/mep/mepserver/docker-build.sh
new file mode 100755 (executable)
index 0000000..f5c6b0d
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+MEP_VERSION=latest
+docker build --no-cache -t mep:${MEP_VERSION} -f docker/Dockerfile .
diff --git a/mep/mepserver/docker/Dockerfile b/mep/mepserver/docker/Dockerfile
new file mode 100644 (file)
index 0000000..2e0e329
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+FROM golang:1.14.2-alpine3.11
+
+ENV GOPROXY https://goproxy.io
+ENV GO111MODULE on
+
+WORKDIR /go/cache
+
+ADD go.mod .
+ADD go.sum .
+RUN go mod download
+
+WORKDIR /go/release
+
+ADD . .
+
+RUN GOOS=linux CGO_ENABLED=0 go build -buildmode=pie -ldflags="-s -w" -installsuffix cgo -o app main.go
+
+RUN cp -r conf/ / && cp app start.sh /
+
+EXPOSE 8088
+
+CMD ["/start.sh"]
diff --git a/mep/mepserver/go.mod b/mep/mepserver/go.mod
new file mode 100644 (file)
index 0000000..86bf510
--- /dev/null
@@ -0,0 +1,24 @@
+module mepserver
+
+go 1.14
+
+replace (
+       github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b => github.com/go-chassis/glog v0.0.0-20180920075250-95a09b2413e9
+       go.uber.org/zap v1.9.0 => github.com/uber-go/zap v1.9.0
+       golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 => github.com/golang/crypto v0.0.0-20180904163835-0709b304e793
+       golang.org/x/net v0.0.0-20180824152047-4bcd98cce591 => github.com/golang/net v0.0.0-20180824152047-4bcd98cce591
+       golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 => github.com/golang/sys v0.0.0-20180905080454-ebe1bf3edb33
+       golang.org/x/text v0.0.0-20170627122817-6353ef0f9243 => github.com/golang/text v0.0.0-20170627122817-6353ef0f9243
+       golang.org/x/time v0.0.0-20170424234030-8be79e1e0910 => github.com/golang/time v0.0.0-20170424234030-8be79e1e0910
+       google.golang.org/genproto v0.0.0-20170531203552-aa2eb687b4d3 => github.com/google/go-genproto v0.0.0-20170531203552-aa2eb687b4d3
+       google.golang.org/grpc v1.7.5 => github.com/grpc/grpc-go v1.7.5
+       k8s.io/api v0.0.0-20180601181742-8b7507fac302 => github.com/kubernetes/api v0.0.0-20180601181742-8b7507fac302
+       k8s.io/apimachinery v0.0.0-20180601181227-17529ec7eadb => github.com/kubernetes/apimachinery v0.0.0-20180601181227-17529ec7eadb
+       k8s.io/client-go v2.0.0-alpha.0.0.20180817174322-745ca8300397+incompatible => github.com/kubernetes/client-go v0.0.0-20180817174322-745ca8300397
+)
+
+require (
+       github.com/apache/servicecomb-service-center v0.0.0-20191027084911-c2dc0caef706
+       github.com/satori/go.uuid v1.1.0
+       golang.org/x/net v0.0.0-20190620200207-3b0461eec859
+)
diff --git a/mep/mepserver/go.sum b/mep/mepserver/go.sum
new file mode 100644 (file)
index 0000000..d0d9818
--- /dev/null
@@ -0,0 +1,253 @@
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/NYTimes/gziphandler v1.0.2-0.20180820182813-253f1acb9d9f h1:JliTHSbyp6SvSqw5Kdkd+kq2jJueTlDNQCyyr+4+/0o=
+github.com/NYTimes/gziphandler v1.0.2-0.20180820182813-253f1acb9d9f/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
+github.com/Shopify/sarama v1.18.0 h1:Ha2FAOngREft7C44ouUXDxSZ/Y/77IDCMV1YS4AnUkI=
+github.com/Shopify/sarama v1.18.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
+github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=
+github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
+github.com/agiledragon/gomonkey v2.0.1+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw=
+github.com/apache/servicecomb-service-center v0.0.0-20191027084911-c2dc0caef706 h1:1Hl0mbyGTW6r7eFxohtbLpPW6ylyI7l2tKa9JtegGSU=
+github.com/apache/servicecomb-service-center v0.0.0-20191027084911-c2dc0caef706/go.mod h1:zS5Wr+3WHz5as1qL8WSzzlKr7TIxuZiUXC8JjgMKJ8M=
+github.com/apache/thrift v0.0.0-20180125231006-3d556248a8b9 h1:ymi1nHra1RZXqjg5xvka4YVyK+3uKPk2B9HUlPRIiBc=
+github.com/apache/thrift v0.0.0-20180125231006-3d556248a8b9/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
+github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
+github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
+github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
+github.com/astaxie/beego v1.8.0 h1:Rc5qRXMy5fpxq3FEi+4nmykYIMtANthRJ8hcoY+1VWM=
+github.com/astaxie/beego v1.8.0/go.mod h1:0R4++1tUqERR0WYFWdfkcrsyoVBCG4DgpDGokT3yb+U=
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
+github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
+github.com/cheggaaa/pb v1.0.25/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s=
+github.com/coreos/bbolt v1.3.1-coreos.6 h1:uTXKg9gY70s9jMAKdfljFQcuh4e/BXOM+V+d00KFj3A=
+github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
+github.com/coreos/etcd v3.3.6+incompatible h1:4tm4wgWV5rLFlAV4K6kj2zhSBH3bWvzQUyn88VgN3fE=
+github.com/coreos/etcd v3.3.6+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
+github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-systemd v0.0.0-20180828140353-eee3db372b31 h1:wRzCUSYhBIk1KvRIlx+nvScCRIxX0iIhSU5h9xj7MUU=
+github.com/coreos/go-systemd v0.0.0-20180828140353-eee3db372b31/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea h1:n2Ltr3SrfQlf/9nOna1DoGKxLx3qTSI8Ttl6Xrqp6mw=
+github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
+github.com/eapache/go-resiliency v1.1.0 h1:1NtRmCAqadE2FN4ZcN6g90TP3uk8cg9rn9eNK2197aU=
+github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
+github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw=
+github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
+github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
+github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/go-chassis/glog v0.0.0-20180920075250-95a09b2413e9 h1:z6ezGZIJVMl2Yo0gOJlv8jOvCDFi9W3TLADQvJ6Z2t0=
+github.com/go-chassis/glog v0.0.0-20180920075250-95a09b2413e9/go.mod h1:tfdQUl8deEC8YmpbYjbSZJv7Y/7hC0ag9n3RVrjIoJs=
+github.com/go-chassis/paas-lager v0.0.0-20180727081842-50655443dc96 h1:VViSMNCEKU0iqveFWVJpmel5aGgE6UOOUr/ZHhWa8B4=
+github.com/go-chassis/paas-lager v0.0.0-20180727081842-50655443dc96/go.mod h1:tILYbn3+0jjCxhY6/ue9L8eRq+VJ60U6VYIdugqchB4=
+github.com/go-chassis/paas-lager v1.1.1 h1:/6wqawUGjPCpd57A/tzJzgC4MnEhNuigbayQS+2VWPQ=
+github.com/go-logfmt/logfmt v0.3.0 h1:8HUsc87TaSWLKwrnumgC8/YconD2fJQsRJAsWaPg2ic=
+github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
+github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo=
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/golang/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:uZvAcrsnNaCxlh1HorK5dUQHGmEKPh2H/Rl1kehswPo=
+github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk=
+github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/lint v0.0.0-20190409202823-5614ed5bae6fb75893070bdc0996a68765fdd275/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
+github.com/golang/protobuf v1.0.0 h1:lsek0oXi8iFE9L+EXARyHIjU5rlWIhhTkjDz3vHhWWQ=
+github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
+github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:5JyrLPvD/ZdaYkT7IqKhsP5xt7aLjA99KXRtk4EIYDk=
+github.com/golang/text v0.0.0-20170627122817-6353ef0f9243 h1:XALJSS9xekVi8gprnX9Bm+egyMT107ApTqio589gHqc=
+github.com/golang/text v0.0.0-20170627122817-6353ef0f9243/go.mod h1:GUiq9pdJKRKKAZXiVgWFEvocYuREvC14NhI4OPgEjeE=
+github.com/golang/time v0.0.0-20170424234030-8be79e1e0910 h1:NRc7Ti3G99vV7XdCoaollLoBOW94daQlaJsyer2qBOg=
+github.com/golang/time v0.0.0-20170424234030-8be79e1e0910/go.mod h1:Goyxmr1dEyuE8J10MyNptB/4WJaypDxCpNr2pf27wjI=
+github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw=
+github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/go-genproto v0.0.0-20170531203552-aa2eb687b4d3 h1:E2Y5VV8z8bqe066M0lrEmYXCXgsU4SQvIeGct4zPkn4=
+github.com/google/go-genproto v0.0.0-20170531203552-aa2eb687b4d3/go.mod h1:3Rcd9jSoLVkV/osPrt5CogLvLiarfI8U9/x78NwhuDU=
+github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck=
+github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
+github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g=
+github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
+github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
+github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
+github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
+github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
+github.com/grpc-ecosystem/grpc-gateway v1.3.0 h1:HJtP6RRwj2EpPCD/mhAWzSvLL/dFTdPm1UrWwanoFos=
+github.com/grpc-ecosystem/grpc-gateway v1.3.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
+github.com/grpc/grpc-go v1.7.5 h1:AO1n6bZsX2sh0U8Y0fDwUKOv6Uw7XOeDuDf7jeVMKVM=
+github.com/grpc/grpc-go v1.7.5/go.mod h1:OkrsaFQVyvU0P5XR5PQ2d19rg8dJ/sIJcthuZNcktKk=
+github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
+github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
+github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
+github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
+github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
+github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
+github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
+github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
+github.com/hashicorp/serf v0.8.3/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k=
+github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0=
+github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs=
+github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
+github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
+github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
+github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
+github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE=
+github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/karlseguin/ccache v2.0.3-0.20170217060820-3ba9789cfd2c+incompatible h1:Yvcw4N+1TaDTNkIuHn3gn8D1KP7Wxn4LP5GngDPWcPQ=
+github.com/karlseguin/ccache v2.0.3-0.20170217060820-3ba9789cfd2c+incompatible/go.mod h1:CM9tNPzT6EdRh14+jiW8mEF9mkNZuuE51qmgGYUB93w=
+github.com/karlseguin/expect v1.0.1 h1:z4wy4npwwHSWKjGWH85WNJO42VQhovxTCZDSzhjo8hY=
+github.com/karlseguin/expect v1.0.1/go.mod h1:zNBxMY8P21owkeogJELCLeHIt+voOSduHYTFUbwRAV8=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
+github.com/kubernetes/api v0.0.0-20180601181742-8b7507fac302 h1:w9o/Ji0IH+0hUX6eV9NHgYHQ0QBOFhfbNctpZ3ZXFcs=
+github.com/kubernetes/api v0.0.0-20180601181742-8b7507fac302/go.mod h1:o5K7QWn2BV3MxynyVmAM1hhJxCL/FTrSymRIVwXDw58=
+github.com/kubernetes/apimachinery v0.0.0-20180601181227-17529ec7eadb h1:BuNmIG2pNJspCLPkruNcZCmR8RtHc8WDy6hRiCFV7M8=
+github.com/kubernetes/apimachinery v0.0.0-20180601181227-17529ec7eadb/go.mod h1:Pe/YBTPc3vqoMkbuIWPH8CF9ehINdvNyS0dP3J6HC0s=
+github.com/kubernetes/client-go v0.0.0-20180817174322-745ca8300397 h1:jx8QGtpqZkPXUz+DceA5DKIOXb0oTISb9th5GmJC4WE=
+github.com/kubernetes/client-go v0.0.0-20180817174322-745ca8300397/go.mod h1:kszVi2i+FeqECZHhjpkV5h5zM0GnURfJv897YzgoAQ8=
+github.com/labstack/echo v3.2.2-0.20180316170059-a5d81b8d4a62+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s=
+github.com/labstack/gommon v0.2.1/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
+github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
+github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
+github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
+github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/natefinch/lumberjack v0.0.0-20170531160350-a96e63847dc3 h1:BDvcX7oM8ZWOS08LQXaW8ucGblfoSG4srpoW6pKhvqs=
+github.com/natefinch/lumberjack v0.0.0-20170531160350-a96e63847dc3/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
+github.com/olekukonko/tablewriter v0.0.0-20180506121414-d4647c9c7a84/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
+github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/gomega v1.4.1 h1:PZSj/UFNaVp3KxrzHOcS7oyuWA7LoOY/77yCTEFu21U=
+github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
+github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 h1:lM6RxxfUMrYL/f8bWEUqdXrANWtrL7Nndbm9iFN0DlU=
+github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
+github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg=
+github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
+github.com/openzipkin/zipkin-go-opentracing v0.3.3-0.20180123190626-6bb822a7f15f h1:nn2nWXhr9DIrC4IxlTiwow9G6Zq6jVWdckXhIzYtJOM=
+github.com/openzipkin/zipkin-go-opentracing v0.3.3-0.20180123190626-6bb822a7f15f/go.mod h1:js2AbwmHW0YD9DwIw2JhQWmbfFi/UnWyYwdVhqbCDOE=
+github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
+github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
+github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
+github.com/prometheus/client_golang v0.8.1-0.20170628125436-ab4214782d02 h1:Wud705ibHyyfQnllggTZva4YsYCECxhGVkcq58A1j6A=
+github.com/prometheus/client_golang v0.8.1-0.20170628125436-ab4214782d02/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_model v0.0.0-20170216185247-6f3806018612 h1:13pIdM2tpaDi4OVe24fgoIS7ZTqMt0QI+bwQsX5hq+g=
+github.com/prometheus/client_model v0.0.0-20170216185247-6f3806018612/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e h1:n/3MEhJQjQxrOUCzh1Y3Re6aJUUWRp2M9+Oc3eVn/54=
+github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
+github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 h1:agujYaXJSxSo18YNX3jzl+4G6Bstwt+kqv47GS12uL0=
+github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk=
+github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
+github.com/rs/cors v0.0.0-20170608165155-8dd4211afb5d h1:573lGU02rfWK16h656qmmul1zPul8WPPCDekyq+keVs=
+github.com/rs/cors v0.0.0-20170608165155-8dd4211afb5d/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
+github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/satori/go.uuid v1.1.0 h1:B9KXyj+GzIpJbV7gmr873NsY6zpbxNy24CBtGrk7jHo=
+github.com/satori/go.uuid v1.1.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
+github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
+github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=
+github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
+github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
+github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
+github.com/spf13/cobra v0.0.0-20170624150100-4d647c8944eb/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
+github.com/spf13/pflag v1.0.0 h1:oaPbdDe/x0UncahuwiPxW1GYJyilRAdsPnq3e1yaPcI=
+github.com/spf13/pflag v1.0.0/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
+github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
+github.com/uber-go/zap v1.9.0 h1:HSDaxzxZlbVzACpHSNfxOga0D/vTBAuE7vUarwRGeGg=
+github.com/uber-go/zap v1.9.0/go.mod h1:GY+83l3yxBcBw2kmHu/sAWwItnTn+ynxHCRo+WiIQOY=
+github.com/ugorji/go v1.1.1 h1:gmervu+jDMvXTbcHQ0pd2wee85nEoE0BsVyEuzkfK8w=
+github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
+github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
+github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50wTf68f99/Zt14pr046Tgt3Lp2vLyFZKzbFXTOabXw=
+github.com/widuu/gojson v0.0.0-20170212122013-7da9d2cd949b/go.mod h1:9W1pyetRkwXqjR9tjOSrSuhGHBK0EqXoQSwWbhBHHwA=
+github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 h1:3UeQBvD0TFrlVjOeLOBz+CPAI8dnbqNSVwUwRrkp7vQ=
+github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM=
+github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 h1:MPPkRncZLN9Kh4MEFmbnK4h3BD7AUmskWv2+EeZJCCs=
+github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
+go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
+go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
+go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
+go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
+golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3 h1:KYQXGkl6vs02hK7pK4eIbw0NpNPedieTSTEiJ//bwGs=
+golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0=
+golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5 h1:x6r4Jo0KNzOOzYd8lbcRsqjuqEASK6ob3auvWYM4/8U=
+golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
+gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
+gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
+gopkg.in/karlseguin/expect.v1 v1.0.1 h1:9u0iUltnhFbJTHaSIH0EP+cuTU5rafIgmcsEsg2JQFw=
+gopkg.in/karlseguin/expect.v1 v1.0.1/go.mod h1:uB7QIJBcclvYbwlUDkSCsGjAOMis3fP280LyhuDEf2I=
+gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
+gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/mep/mepserver/kong-k8s.yaml b/mep/mepserver/kong-k8s.yaml
new file mode 100644 (file)
index 0000000..f52ca86
--- /dev/null
@@ -0,0 +1,112 @@
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+
+# kong deployment
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  labels:
+    app: apigw-kong
+  name: apigw-kong
+  namespace: mep
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: apigw-kong
+  template:
+    metadata:
+      labels:
+        app: apigw-kong
+    spec:
+      initContainers:
+        - name: check-db-ready
+          image: postgres:9.6
+          command: ['sh', '-c', 'until pg_isready -h postgres-db -p 5432;
+                   do echo waiting for database; sleep 2; done;']
+      containers:
+        - name: kong-proxy
+          image: kong:1.5.1-alpine
+          env:
+            - name: KONG_DATABASE
+              value: "postgres"
+            - name: KONG_NGINX_WORKER_PROCESSES
+              value: "1"
+            - name: KONG_ADMIN_ACCESS_LOG
+              value: /dev/stdout
+            - name: KONG_ADMIN_ERROR_LOG
+              value: /dev/stderr
+            - name: KONG_ADMIN_ACCESS_LOG
+              value: /dev/stdout
+            - name: KONG_ADMIN_ERROR_LOG
+              value: /dev/stderr
+            - name: KONG_ADMIN_LISTEN
+              value: 127.0.0.1:8444 ssl
+            - name: KONG_PROXY_LISTEN
+              value: 0.0.0.0:8000, 0.0.0.0:8443 ssl http2
+            - name: KONG_ADMIN_LISTEN
+              value: 0.0.0.0:8001
+            - name: KONG_PG_DATABASE
+              value: kong
+            - name: KONG_PG_HOST
+              value: postgres-db
+            - name: KONG_PG_USER
+              value: kong
+            - name: KONG_PG_PASSWORD
+              value: kong
+          ports:
+            - containerPort: 8000
+              name: proxy
+              protocol: TCP
+            - containerPort: 8443
+              name: proxy-ssl
+              protocol: TCP
+            - containerPort: 8001
+              name: admin-api
+              protocol: TCP
+            - containerPort: 8444
+              name: admin-api-ssl
+              protocol: TCP
+          volumeMounts:
+            - name: kongssl
+              mountPath: "/run/kongssl"
+              readOnly: true
+          volumes:
+            - name: kongssl
+              secret:
+                secretName: kongssl-secret
+
+
+# kong service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: kong-service
+  namespace: mep
+spec:
+  selector:
+    app: apigw-kong
+  type: NodePort
+  ports:
+    - port: 8000
+      name: proxy
+    - port: 8443
+      name: proxy-ssl
+    - port: 8001
+      name: admin-api
+    - port: 8444
+      name: admin-api-ssl
diff --git a/mep/mepserver/main.go b/mep/mepserver/main.go
new file mode 100644 (file)
index 0000000..b54b57f
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package main
+
+import (
+       "github.com/apache/servicecomb-service-center/server"
+       _ "github.com/apache/servicecomb-service-center/server/bootstrap"
+       _ "github.com/apache/servicecomb-service-center/server/init"
+
+       _ "mepserver/mp1"
+       _ "mepserver/mp1/uuid"
+)
+
+func main() {
+       server.Run()
+}
diff --git a/mep/mepserver/mep-basic.yaml b/mep/mepserver/mep-basic.yaml
new file mode 100644 (file)
index 0000000..d8f6cbe
--- /dev/null
@@ -0,0 +1,56 @@
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+
+# mep namespace
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: mep
+
+# persitent volume
+---
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+  name: postgres-pv-volume
+  labels:
+    type: local
+    app: postgres
+spec:
+  storageClassName: manual
+  capacity:
+    storage: 5Gi
+  accessModes:
+    - ReadWriteMany
+  hostPath:
+    path: "/mnt/data"
+
+# pvc
+---
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: postgres-pv-claim
+  namespace: mep
+  labels:
+    app: postgres
+spec:
+  storageClassName: manual
+  accessModes:
+    - ReadWriteMany
+  resources:
+    requests:
+      storage: 5Gi
diff --git a/mep/mepserver/mep-k8s.yaml b/mep/mepserver/mep-k8s.yaml
new file mode 100755 (executable)
index 0000000..298c5c4
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+
+# mep pod
+---
+apiVersion: v1
+kind: Pod
+metadata:
+  name: mep
+  namespace: mep
+  labels:
+    app: mep
+spec:
+  containers:
+    - image: khemendra/mep:latest
+      imagePullPolicy: Always
+      name: mep-pod
+      ports:
+        - containerPort: 8088
+        - containerPort: 8443
+      env:
+        - name: SSL_ROOT
+          value: "/etc/mepssl"
+        - name: MEP_SSL_MODE
+          value: "0"
+      volumeMounts:
+        - name: mepssl
+          mountPath: "/etc/mepssl"
+          readOnly: true
+  volumes:
+    - name: mepssl
+      secret:
+        secretName: mepssl-secret
+
+
+# mep service
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: mep-service
+  namespace: mep
+spec:
+  selector:
+    app: mep
+  type: NodePort
+  ports:
+    - port: 8088
+      name: mep-port
+      nodePort: 30088
+    - port: 8443
+      name: mep-https-port
+      nodePort: 30443
diff --git a/mep/mepserver/mp1/arch/bus/base.go b/mep/mepserver/mp1/arch/bus/base.go
new file mode 100644 (file)
index 0000000..f049c73
--- /dev/null
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package bus
+
+import (
+       "fmt"
+       "reflect"
+       "strconv"
+       "strings"
+)
+
+type JSONPathInfo struct {
+       ParentNode reflect.Value
+       CurNode    reflect.Value
+       CurName    string
+       e          error
+}
+
+type JpErr struct {
+       ErrDes string
+       JPath  string
+}
+
+func (e *JpErr) Error() string {
+       return fmt.Sprintf("jpath error info:%s, json path:%s", e.ErrDes, e.JPath)
+}
+
+func ObjReflectPath(p reflect.Value, v reflect.Value, path string) JSONPathInfo {
+       fieldName, subPath := GetFirstName(path)
+
+       switch v.Kind() {
+       case reflect.Invalid:
+               return JSONPathInfo{e: &JpErr{"reflect.Invalid", path}}
+
+       case reflect.Slice, reflect.Array:
+               return ObjReflectPathArray(v, fieldName, subPath)
+       case reflect.Struct:
+               return ObjReflectPathStruct(v, fieldName, subPath)
+
+       case reflect.Map:
+               return ObjReflectPathMap(v, fieldName, subPath)
+
+       case reflect.Ptr:
+               if v.IsNil() {
+                       return JSONPathInfo{e: &JpErr{"pointer is null", path}}
+               }
+               return ObjReflectPath(p, v.Elem(), path)
+       case reflect.Interface:
+               if v.IsNil() {
+                       return JSONPathInfo{e: &JpErr{"kind is interface, nil", path}}
+               }
+
+               if subPath == "" {
+                       return ReflectSafeAddr(v, v.Elem())
+               }
+               return ObjReflectPath(p, v.Elem(), path)
+
+       default:
+               return GetFieldFromPath(p, v, path)
+       }
+}
+
+func ObjReflectPathArray(v reflect.Value, fieldName string, subPath string) JSONPathInfo {
+       if fieldName == "-" {
+               mapInfo := ReflectSafeAddr(v, reflect.ValueOf(nil))
+               mapInfo.CurName = "-"
+               return mapInfo
+       }
+
+       idx, err := strconv.Atoi(fieldName)
+       if err != nil {
+               return JSONPathInfo{e: &JpErr{"Atoi error", fieldName}}
+       }
+       if idx >= v.Len() {
+               return JSONPathInfo{e: &JpErr{"Index out of range", fieldName}}
+       }
+       if subPath == "" {
+               return ReflectSafeAddr(v, v.Index(idx))
+       }
+       return ObjReflectPath(v, v.Index(idx), subPath)
+}
+
+func ObjReflectPathStruct(v reflect.Value, fieldName string, subPath string) JSONPathInfo {
+
+       vType := v.Type()
+       for i := 0; i < v.NumField(); i++ {
+               if !MatchJSONFieldName(vType, i, fieldName) {
+                       continue
+               }
+               if subPath == "" {
+                       return ReflectSafeAddr(v, v.Field(i))
+               }
+               return ObjReflectPath(v, v.Field(i), subPath)
+       }
+       return JSONPathInfo{e: &JpErr{"can not find field in struct", fieldName}}
+
+}
+
+func ObjReflectPathMap(v reflect.Value, fieldName string, subPath string) JSONPathInfo {
+       for _, key := range v.MapKeys() {
+               if ReflectValueToString(key) != fieldName {
+                       continue
+               }
+
+               if subPath == "" {
+                       mapInfo := ReflectSafeAddr(v, reflect.ValueOf(nil))
+                       mapInfo.CurName = fieldName
+                       return mapInfo
+               }
+               return ObjReflectPath(v, v.MapIndex(key), subPath)
+
+       }
+       if subPath == "" {
+               mapInfo := ReflectSafeAddr(v, reflect.ValueOf(nil))
+               mapInfo.CurName = fieldName
+               return mapInfo
+       }
+
+       return JSONPathInfo{e: &JpErr{"path not in map:" + fieldName, subPath}}
+}
+
+func GetFirstName(path string) (string, string) {
+       if len(path) == 0 {
+               return "", ""
+       }
+       newPath := path
+       if path[0] == '/' {
+               newPath = path[1:]
+       }
+       pos := strings.IndexByte(newPath, '/')
+       if pos < 0 {
+               pos = len(newPath)
+       }
+       subPath := newPath[pos:]
+       firstName := newPath[0:pos]
+       escape := strings.IndexByte(firstName, '~')
+       if escape >= 0 {
+               firstName = strings.Replace(firstName, "~1", "/", -1)
+               firstName = strings.Replace(firstName, "~0", "~", -1)
+       }
+       return firstName, subPath
+}
+
+func MatchJSONFieldName(vType reflect.Type, i int, jsonName string) bool {
+       tag := vType.Field(i).Tag
+       if !strings.Contains(string(tag), jsonName) {
+               return false
+       }
+       name := tag.Get("json")
+       if name == "" {
+               name = strings.ToLower(vType.Field(i).Name)
+       } else {
+               pos := strings.IndexByte(name, ',')
+               if pos > 0 {
+                       name = name[0:pos]
+               }
+       }
+       if name == jsonName {
+               return true
+       }
+
+       return false
+}
+
+func GetFieldFromPath(p reflect.Value, v reflect.Value, path string) JSONPathInfo {
+       var info JSONPathInfo
+       if !v.CanAddr() {
+               return JSONPathInfo{e: &JpErr{"CanAddr false", path}}
+       }
+
+       switch v.Kind() {
+       case reflect.Invalid:
+               return JSONPathInfo{e: &JpErr{"Kind invalid", path}}
+
+       case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+               info.ParentNode = p
+               info.CurNode = v
+               return info
+
+       case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+               info.ParentNode = p
+               info.CurNode = v
+               return info
+
+       case reflect.Bool:
+               info.ParentNode = p
+               info.CurNode = v
+               return info
+       case reflect.String:
+               info.ParentNode = p
+               info.CurNode = v
+               return info
+       case reflect.Slice, reflect.Map:
+               info.ParentNode = p
+               info.CurNode = v
+               return info
+       case reflect.Ptr:
+               info.ParentNode = p
+               info.CurNode = v
+               return info
+       case reflect.Chan, reflect.Func:
+               return JSONPathInfo{e: &JpErr{"Kind Chan or Func", path}}
+       default:
+               return JSONPathInfo{e: &JpErr{"upexpect Kint: reflect.Array, reflect.Struct, reflect.Interface", path}}
+       }
+}
+
+func ReflectValueToString(v reflect.Value) string {
+       switch v.Kind() {
+       case reflect.Invalid:
+               return "invalid"
+       case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+               return strconv.FormatInt(v.Int(), 10)
+       case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+               return strconv.FormatUint(v.Uint(), 10)
+       case reflect.Bool:
+               return strconv.FormatBool(v.Bool())
+       case reflect.String:
+               return v.String()
+       case reflect.Chan, reflect.Func, reflect.Ptr, reflect.Slice, reflect.Map:
+               return "invalid"
+       default:
+               return "invalid"
+       }
+}
+
+func ReflectSafeAddr(p reflect.Value, v reflect.Value) JSONPathInfo {
+       var info JSONPathInfo
+
+       if p.CanAddr(){
+               info.ParentNode = p
+       }
+
+       if v.CanAddr(){
+               info.CurNode = v
+       }
+       return info
+}
diff --git a/mep/mepserver/mp1/arch/bus/load.go b/mep/mepserver/mp1/arch/bus/load.go
new file mode 100644 (file)
index 0000000..e4aac47
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package bus
+
+import (
+       "reflect"
+       "strings"
+)
+
+func parseTags(tag reflect.StructTag) (string, string) {
+       fieldName := tag.Get("json")
+       if fieldName == "" {
+               return "", ""
+       }
+       fieldNames := strings.Split(fieldName, ",")
+       secTag := "in"
+       if len(fieldNames) > 1 {
+               secTag = fieldNames[1]
+       }
+       return fieldNames[0], secTag
+}
+
+func LoadObjByInd(dst interface{}, src interface{}, direction string) bool {
+       rflDst := reflect.ValueOf(dst).Elem()
+       rflSrc := reflect.ValueOf(src).Elem()
+       vType := rflDst.Type()
+       for i := 0; i < rflDst.NumField(); i++ {
+               fieldName, secTag := parseTags(vType.Field(i).Tag)
+               if fieldName == "" {
+                       continue
+               }
+               if secTag != direction {
+                       continue
+               }
+
+               valDst := rflDst.Field(i)
+               srcNode := ObjReflectPath(rflSrc, rflSrc, fieldName)
+               if srcNode.e != nil || srcNode.CurNode.Kind() == reflect.Invalid {
+                       continue
+               }
+
+               valSrc := srcNode.CurNode
+               if direction == "in" {
+                       valDst.Set(valSrc)
+               } else {
+                       valSrc.Set(valDst)
+               }
+       }
+       return true
+}
diff --git a/mep/mepserver/mp1/models/categoryref.go b/mep/mepserver/mp1/models/categoryref.go
new file mode 100644 (file)
index 0000000..d570705
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+// This type represents the category reference
+type CategoryRef struct {
+       Href    string `json:"href,omitempty"`
+       ID      string `json:"id,omitempty"`
+       Name    string `json:"name,omitempty"`
+       Version string `json:"version,omitempty"`
+}
diff --git a/mep/mepserver/mp1/models/endpointinfo.go b/mep/mepserver/mp1/models/endpointinfo.go
new file mode 100644 (file)
index 0000000..d8a12f1
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+type EndPointInfo struct {
+       Uris        []string
+       Addresses   []EndPointInfoAddress
+       Alternative interface{}
+}
+
+type EndPointInfoAddress struct {
+       Host string `json:"host,omitempty"`
+       Port uint32 `json:"port,omitempty"`
+}
diff --git a/mep/mepserver/mp1/models/filtering_criteria.go b/mep/mepserver/mp1/models/filtering_criteria.go
new file mode 100644 (file)
index 0000000..d451002
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+// Filtering criteria to match services for which events are requested to be reported. If absent, matches all services. All child attributes are combined with the logical  \"AND\" operation.
+type FilteringCriteria struct {
+       SerInstanceIds []string      `json:"serInstanceIds,omitempty"`
+       SerNames       []string      `json:"serNames,omitempty"`
+       SerCategories  []CategoryRef `json:"serCategories,omitempty"`
+       States         []string      `json:"states,omitempty"`
+       IsLocal        bool          `json:"isLocal,omitempty"`
+}
diff --git a/mep/mepserver/mp1/models/problemdetails.go b/mep/mepserver/mp1/models/problemdetails.go
new file mode 100644 (file)
index 0000000..5102d97
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+import (
+       "encoding/json"
+
+       "github.com/apache/servicecomb-service-center/pkg/log"
+)
+
+type ProblemDetails struct {
+       ProbType string `json:"type,omitempty"`
+       Title    string `json:"title,omitempty"`
+       Status   uint32 `json:"status,omitempty"`
+       Detail   string `json:"detail,omitempty"`
+       Instance string `json:"instance,omitempty"`
+}
+
+func (pd ProblemDetails) String() string {
+       d, err := json.Marshal(pd)
+       if err != nil {
+               log.Errorf(err, "Marsh ProblemDetails error!")
+               return ""
+       }
+       return string(d)
+}
diff --git a/mep/mepserver/mp1/models/securityinfo.go b/mep/mepserver/mp1/models/securityinfo.go
new file mode 100644 (file)
index 0000000..00af31e
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+// This type represents security information related to a transport
+type SecurityInfo struct {
+       OAuth2Info SecurityInfoOAuth2Info `json:"oAuth2Info,omitempty"`
+}
diff --git a/mep/mepserver/mp1/models/securityinfo_oauth2_info.go b/mep/mepserver/mp1/models/securityinfo_oauth2_info.go
new file mode 100644 (file)
index 0000000..7b21662
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+// Parameters related to use of OAuth 2.0
+type SecurityInfoOAuth2Info struct {
+       GrantTypes    []string `json:"grantTypes"`
+       TokenEndpoint string   `json:"tokenEndpoint"`
+}
diff --git a/mep/mepserver/mp1/models/ser_avail_notify_subscribe.go b/mep/mepserver/mp1/models/ser_avail_notify_subscribe.go
new file mode 100644 (file)
index 0000000..37d7056
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+// This type represents a subscription to the notifications from the  MEC platform regarding the availability of a MEC service or a list of MEC services.
+type SerAvailabilityNotificationSubscription struct {
+       SubscriptionType  string            `json:"subscriptionType"`
+       CallbackReference string            `json:"callbackReference"`
+       Links             string            `json:"_links"`
+       FilteringCriteria FilteringCriteria `json:"filteringCriteria,omitempty"`
+}
diff --git a/mep/mepserver/mp1/models/serviceinfo.go b/mep/mepserver/mp1/models/serviceinfo.go
new file mode 100644 (file)
index 0000000..01b48a6
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+import (
+       "encoding/json"
+       "fmt"
+       "math"
+       "strconv"
+       "strings"
+       "time"
+
+       "github.com/apache/servicecomb-service-center/pkg/log"
+       "github.com/apache/servicecomb-service-center/pkg/util"
+       "github.com/apache/servicecomb-service-center/server/core/proto"
+
+       meputil "mepserver/mp1/util"
+)
+
+type ServiceInfo struct {
+       SerInstanceId     string        `json:"serInstanceId,omitempty"`
+       SerName           string        `json:"serName"`
+       SerCategory       CategoryRef   `json:"serCategory,omitempty"`
+       Version           string        `json:"version"`
+       State             string        `json:"state"`
+       TransportID       string        `json:"transportId,omitempty"`
+       TransportInfo     TransportInfo `json:"transportInfo"`
+       Serializer        string        `json:"serializer"`
+       ScopeOfLocality   string        `json:"scopeOfLocality,omitempty"`
+       ConsumedLocalOnly bool          `json:"consumedLocalOnly,omitempty"`
+       IsLocal           bool          `json:"isLocal,omitempty"`
+}
+
+func (s *ServiceInfo) ToServiceRequest(req *proto.CreateServiceRequest) {
+       if req == nil {
+               log.Warn("create service request nil")
+       }
+       if req.Service == nil {
+               req.Service = &proto.MicroService{}
+       }
+       req.Service.AppId = ""
+       req.Service.ServiceName = s.SerName
+       req.Service.Version = s.Version
+       req.Service.Status = "UP"
+       if s.State == "INACTIVE" {
+               req.Service.Status = "DOWN"
+       }
+}
+
+func (s *ServiceInfo) ToRegisterInstance(req *proto.RegisterInstanceRequest) {
+       if req == nil {
+               log.Warn("register instance request nil")
+       }
+       if req.Instance == nil {
+               req.Instance = &proto.MicroServiceInstance{}
+       }
+       req.Instance.Properties = make(map[string]string, 5)
+       req.Instance.Properties["serName"] = s.SerName
+       s.serCategoryToProperties(req.Instance.Properties)
+       req.Instance.Version = s.Version
+       req.Instance.Timestamp = strconv.FormatInt(time.Now().Unix(), 10)
+       req.Instance.ModTimestamp = req.Instance.Timestamp
+
+       req.Instance.Status = "UP"
+       if s.State == "INACTIVE" {
+               req.Instance.Status = "DOWN"
+       }
+       properties := req.Instance.Properties
+       meputil.InfoToProperties(properties, "transportId", s.TransportID)
+       meputil.InfoToProperties(properties, "serializer", s.Serializer)
+       meputil.InfoToProperties(properties, "ScopeOfLocality", s.ScopeOfLocality)
+       meputil.InfoToProperties(properties, "ConsumedLocalOnly", strconv.FormatBool(s.ConsumedLocalOnly))
+       meputil.InfoToProperties(properties, "IsLocal", strconv.FormatBool(s.IsLocal))
+       req.Instance.HostName = "default"
+       var epType string
+       req.Instance.Endpoints, epType = s.toEndpoints()
+       req.Instance.Properties["endPointType"] = epType
+
+       healthCheck := &proto.HealthCheck{
+               Mode: proto.CHECK_BY_HEARTBEAT,
+               Port: 0,
+               Interval: math.MaxInt32 - 1,
+               Times: 0,
+               Url: "",
+       }
+       req.Instance.HealthCheck = healthCheck
+       s.transportInfoToProperties(req.Instance.Properties)
+}
+
+func (s *ServiceInfo) toEndpoints() ([]string, string) {
+       if len(s.TransportInfo.Endpoint.Addresses) != 0 {
+               return s.TransportInfo.Endpoint.Uris, "uris"
+       }
+       endPoints := make([]string, 0, 1)
+       if len(s.TransportInfo.Endpoint.Addresses) != 0 {
+
+               for _, v := range s.TransportInfo.Endpoint.Addresses {
+                       addrDes := fmt.Sprintf("%s:%d", v.Host, v.Port)
+                       endPoints = append(endPoints, addrDes)
+               }
+               return endPoints, "addresses"
+       }
+
+       if s.TransportInfo.Endpoint.Alternative != nil {
+               jsonBytes, err := json.Marshal(s.TransportInfo.Endpoint.Alternative)
+               if err != nil {
+                       return nil, ""
+               }
+               jsonText := util.BytesToStringWithNoCopy(jsonBytes)
+               endPoints = append(endPoints, jsonText)
+               return endPoints, "alternative"
+       }
+       return nil, ""
+}
+
+func (s *ServiceInfo) transportInfoToProperties(properties map[string]string) {
+       if properties == nil {
+               return
+       }
+       meputil.InfoToProperties(properties, "transportInfo/id", s.TransportInfo.ID)
+       meputil.InfoToProperties(properties, "transportInfo/name", s.TransportInfo.Name)
+       meputil.InfoToProperties(properties, "transportInfo/description", s.TransportInfo.Description)
+       meputil.InfoToProperties(properties, "transportInfo/type", string(s.TransportInfo.TransType))
+       meputil.InfoToProperties(properties, "transportInfo/protocol", s.TransportInfo.Protocol)
+       meputil.InfoToProperties(properties, "transportInfo/version", s.TransportInfo.Version)
+       grantTypes := strings.Join(s.TransportInfo.Security.OAuth2Info.GrantTypes, ",")
+       meputil.InfoToProperties(properties, "transportInfo/security/oAuth2Info/grantTypes", grantTypes)
+       meputil.InfoToProperties(properties, "transportInfo/security/oAuth2Info/tokenEndpoint", s.TransportInfo.Security.OAuth2Info.TokenEndpoint)
+
+}
+
+func (s *ServiceInfo) serCategoryToProperties(properties map[string]string) {
+       if properties == nil {
+               return
+       }
+       meputil.InfoToProperties(properties, "serCategory/href", s.SerCategory.Href)
+       meputil.InfoToProperties(properties, "serCategory/id", s.SerCategory.ID)
+       meputil.InfoToProperties(properties, "serCategory/name", s.SerCategory.Name)
+       meputil.InfoToProperties(properties, "serCategory/version", s.SerCategory.Version)
+}
+
+func (s *ServiceInfo) FromServiceInstance(inst *proto.MicroServiceInstance) {
+       s.SerInstanceId = inst.ServiceId + inst.InstanceId
+       s.serCategoryFromProperties(inst.Properties)
+       s.Version = inst.Version
+       s.State = "ACTIVE"
+       if inst.Status == "DOWN" {
+               s.State = "INACTIVE"
+       }
+
+       epType := "uris"
+       if inst.Properties != nil {
+               s.SerName = inst.Properties["serName"]
+               s.TransportID = inst.Properties["transportId"]
+               s.Serializer = inst.Properties["serializer"]
+               epType = inst.Properties["endPointType"]
+               s.ScopeOfLocality = inst.Properties["ScopeOfLocality"]
+               var err error
+               s.ConsumedLocalOnly, err = strconv.ParseBool(inst.Properties["ConsumedLocalOnly"])
+               if err != nil {
+                       log.Warn("parse bool ConsumedLocalOnly fail")
+               }
+               s.IsLocal, err = strconv.ParseBool(inst.Properties["IsLocal"])
+               if err != nil {
+                       log.Warn("parse bool ConsumedLocalOnly fail")
+               }
+       }
+       s.fromEndpoints(inst.Endpoints, epType)
+       s.transportInfoFromProperties(inst.Properties)
+}
+
+func (s *ServiceInfo) serCategoryFromProperties(properties map[string]string) {
+       if properties == nil {
+               return
+       }
+       s.SerCategory.Href = properties["serCategory/href"]
+       s.SerCategory.ID = properties["serCategory/id"]
+       s.SerCategory.Name = properties["serCategory/name"]
+       s.SerCategory.Version = properties["serCategory/version"]
+}
+
+func (s *ServiceInfo) fromEndpoints(uris []string, epType string) {
+       if epType == "uris" {
+               s.TransportInfo.Endpoint.Uris = uris
+               return
+       }
+       if epType == "address" {
+
+               s.TransportInfo.Endpoint.Addresses = make([]EndPointInfoAddress, 0, 1)
+               for _, v := range uris {
+                       host, port := meputil.GetHostPort(v)
+                       tmp := EndPointInfoAddress{
+                               Host: host,
+                               Port: uint32(port),
+                       }
+                       s.TransportInfo.Endpoint.Addresses = append(s.TransportInfo.Endpoint.Addresses, tmp)
+               }
+       }
+       if epType == "alternative" {
+               jsonObj, err := meputil.JsonTextToObj(uris[0])
+               if err != nil {
+                       s.TransportInfo.Endpoint.Alternative = jsonObj
+               }
+               return
+       }
+}
+
+func (s *ServiceInfo) transportInfoFromProperties(properties map[string]string) {
+       if properties == nil {
+               return
+       }
+       s.TransportInfo.ID = properties["transportInfo/id"]
+       s.TransportInfo.Name = properties["transportInfo/name"]
+       s.TransportInfo.Description = properties["transportInfo/description"]
+       s.TransportInfo.TransType = TransportTypes(properties["transportInfo/type"])
+       s.TransportInfo.Protocol = properties["transportInfo/protocol"]
+       s.TransportInfo.Version = properties["transportInfo/version"]
+       grantTypes := properties["transportInfo/security/oAuth2Info/grantTypes"]
+       s.TransportInfo.Security.OAuth2Info.GrantTypes = strings.Split(grantTypes, ",")
+       s.TransportInfo.Security.OAuth2Info.TokenEndpoint = properties["transportInfo/security/oAuth2Info/tokenEndpoint"]
+}
diff --git a/mep/mepserver/mp1/models/transportinfo.go b/mep/mepserver/mp1/models/transportinfo.go
new file mode 100644 (file)
index 0000000..3f5a515
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package models
+
+// This type represents the general information of a MEC service.
+type TransportInfo struct {
+       ID          string         `json:"id,omitempty"`
+       Name        string         `json:"name,omitempty"`
+       Description string         `json:"description,omitempty"`
+       TransType   TransportTypes `json:"type,omitempty"`
+       Protocol    string         `json:"protocol,omitempty"`
+       Version     string         `json:"version,omitempty"`
+       // This type represents information about a transport endpoint
+       Endpoint         EndPointInfo `json:"endpoint,omitempty"`
+       Security         SecurityInfo `json:"security,omitempty"`
+       ImplSpecificInfo interface{}  `json:"implSpecificInfo,omitempty"`
+}
+
+type TransportTypes string
diff --git a/mep/mepserver/mp1/util/meputil.go b/mep/mepserver/mp1/util/meputil.go
new file mode 100644 (file)
index 0000000..f81e5bc
--- /dev/null
@@ -0,0 +1,265 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package util
+
+import (
+       "bytes"
+       "context"
+       "encoding/json"
+       "fmt"
+       "net/http"
+       "net/url"
+       "strconv"
+       "strings"
+
+       "github.com/apache/servicecomb-service-center/pkg/log"
+       "github.com/apache/servicecomb-service-center/pkg/rest"
+       "github.com/apache/servicecomb-service-center/pkg/util"
+       "github.com/apache/servicecomb-service-center/server/core"
+       "github.com/apache/servicecomb-service-center/server/core/backend"
+       "github.com/apache/servicecomb-service-center/server/core/proto"
+       svcerror "github.com/apache/servicecomb-service-center/server/error"
+       "github.com/apache/servicecomb-service-center/server/plugin/pkg/registry"
+       "github.com/apache/servicecomb-service-center/server/rest/controller"
+       svcutil "github.com/apache/servicecomb-service-center/server/service/util"
+)
+
+func InfoToProperties(properties map[string]string, key string, value string) {
+       if value != "" {
+               properties[key] = value
+       }
+}
+
+func JsonTextToObj(jsonText string) (interface{}, error) {
+       data := []byte(jsonText)
+       var jsonMap interface{}
+       decoder := json.NewDecoder(bytes.NewReader(data))
+       err := decoder.Decode(&jsonMap)
+       if err != nil {
+               return nil, err
+       }
+       return jsonMap, nil
+}
+
+func GetHostPort(uri string) (string, int) {
+       idx := strings.LastIndex(uri, ":")
+       domain := uri
+       port := 0
+       var err error
+       if idx > 0 {
+               port, err = strconv.Atoi(uri[idx+1:])
+               if err != nil {
+                       port = 0
+               }
+               domain = uri[:idx]
+       }
+       return domain, port
+}
+
+func GetHTTPTags(r *http.Request) (url.Values, []string) {
+       var ids []string
+       query := r.URL.Query()
+       keys := query.Get("tags")
+       if len(keys) > 0 {
+               ids = strings.Split(keys, ",")
+       }
+
+       return query, ids
+}
+
+func GetFindParam(r *http.Request) (context.Context, *proto.FindInstancesRequest, url.Values) {
+
+       query, ids := GetHTTPTags(r)
+
+       req := &proto.FindInstancesRequest{
+               ConsumerServiceId: r.Header.Get("X-ConsumerId"),
+               AppId:             query.Get("instance_id"),
+               ServiceName:       query.Get("ser_name"),
+               VersionRule:       query.Get("version"),
+               Environment:       query.Get("env"),
+               Tags:              ids,
+       }
+
+       if req.AppId == "" {
+               req.AppId = "default"
+       }
+       if req.VersionRule == "" {
+               req.VersionRule = "latest"
+       }
+       ctx := util.SetTargetDomainProject(r.Context(), r.Header.Get("X-Domain-Name"), query.Get(":project"))
+       return ctx, req, query
+}
+
+//send http response
+func WriteHTTPResponse(w http.ResponseWriter, resp *proto.Response, obj interface{}) {
+       if resp != nil && resp.GetCode() != proto.Response_SUCCESS {
+               controller.WriteError(w, resp.GetCode(), resp.GetMessage())
+               return
+       }
+       if obj == nil {
+               w.Header().Set(rest.HEADER_RESPONSE_STATUS, strconv.Itoa(http.StatusOK))
+               w.Header().Set(rest.HEADER_CONTENT_TYPE, rest.CONTENT_TYPE_TEXT)
+               w.WriteHeader(http.StatusOK)
+               return
+       }
+
+       objJSON, err := json.Marshal(obj)
+       if err != nil {
+               controller.WriteError(w, svcerror.ErrInternal, err.Error())
+               return
+       }
+       w.Header().Set(rest.HEADER_RESPONSE_STATUS, strconv.Itoa(http.StatusOK))
+       w.Header().Set(rest.HEADER_CONTENT_TYPE, rest.CONTENT_TYPE_JSON)
+       w.WriteHeader(http.StatusCreated)
+       _, err = fmt.Fprintln(w, util.BytesToStringWithNoCopy(objJSON))
+       if err != nil {
+               return
+       }
+}
+
+func WriteResponse(w http.ResponseWriter, resp *proto.Response, obj interface{}) {
+       if resp != nil && resp.GetCode() != proto.Response_SUCCESS {
+               controller.WriteError(w, resp.GetCode(), resp.GetMessage())
+               return
+       }
+       if obj == nil {
+               w.Header().Set(rest.HEADER_RESPONSE_STATUS, strconv.Itoa(http.StatusOK))
+               w.Header().Set(rest.HEADER_CONTENT_TYPE, rest.CONTENT_TYPE_TEXT)
+               w.WriteHeader(http.StatusOK)
+               return
+       }
+
+       objJSON, err := json.Marshal(obj)
+       if err != nil {
+               controller.WriteError(w, svcerror.ErrInternal, err.Error())
+               return
+       }
+       w.Header().Set(rest.HEADER_RESPONSE_STATUS, strconv.Itoa(http.StatusOK))
+       w.Header().Set(rest.HEADER_CONTENT_TYPE, rest.CONTENT_TYPE_JSON)
+       w.WriteHeader(http.StatusOK)
+       _, err = fmt.Fprintln(w, util.BytesToStringWithNoCopy(objJSON))
+       if err != nil {
+               return
+       }
+}
+
+func HttpErrResponse(w http.ResponseWriter, statusCode int, obj interface{}) {
+       if obj == nil {
+               w.Header().Set(rest.HEADER_RESPONSE_STATUS, strconv.Itoa(statusCode))
+               w.Header().Set(rest.HEADER_CONTENT_TYPE, rest.CONTENT_TYPE_TEXT)
+               w.WriteHeader(statusCode)
+               return
+       }
+
+       objJSON, err := json.Marshal(obj)
+       if err != nil {
+               log.Errorf(err, "json marshal object fail")
+               return
+       }
+       w.Header().Set(rest.HEADER_RESPONSE_STATUS, strconv.Itoa(http.StatusOK))
+       w.Header().Set(rest.HEADER_CONTENT_TYPE, rest.CONTENT_TYPE_JSON)
+       w.WriteHeader(statusCode)
+       _, err = fmt.Fprintln(w, util.BytesToStringWithNoCopy(objJSON))
+       if err != nil {
+               log.Errorf(err, "send http response fail")
+       }
+}
+
+// heartbeat use put to update a service register info
+func Heartbeat(ctx context.Context, mp1SvcId string) error {
+       serviceID := mp1SvcId[:len(mp1SvcId)/2]
+       instanceID := mp1SvcId[len(mp1SvcId)/2:]
+       req := &proto.HeartbeatRequest{
+               ServiceId:  serviceID,
+               InstanceId: instanceID,
+       }
+       _, err := core.InstanceAPI.Heartbeat(ctx, req)
+       return err
+}
+
+func GetServiceInstance(ctx context.Context, serviceId string) (*proto.MicroServiceInstance, error) {
+       domainProjet := util.ParseDomainProject(ctx)
+       serviceID := serviceId[:len(serviceId)/2]
+       instanceID := serviceId[len(serviceId)/2:]
+       instance, err := svcutil.GetInstance(ctx, domainProjet, serviceID, instanceID)
+       if err != nil {
+               return nil, err
+       }
+       if instance == nil {
+               err = fmt.Errorf("domainProjet %s sservice Id %s not exist", domainProjet, serviceID)
+       }
+       return instance, err
+}
+
+func FindInstanceByKey(result url.Values) (*proto.FindInstancesResponse, error) {
+       serCategoryId := result.Get("ser_category_id")
+       scopeOfLocality := result.Get("scope_of_locality")
+       consumedLocalOnly := result.Get("consumed_local_only")
+       isLocal := result.Get("is_local")
+       isQueryAllSvc := serCategoryId == "" && scopeOfLocality == "" && consumedLocalOnly == "" && isLocal == ""
+
+       opts := []registry.PluginOp{
+               registry.OpGet(registry.WithStrKey("/cse-sr/inst/files///"), registry.WithPrefix()),
+       }
+       resp, err := backend.Registry().TxnWithCmp(context.Background(), opts, nil, nil)
+       if err != nil {
+               return nil, fmt.Errorf("query from etch error")
+       }
+       var findResp []*proto.MicroServiceInstance
+       for _, value := range resp.Kvs {
+               var instance map[string]interface{}
+               err = json.Unmarshal(value.Value, &instance)
+               if err != nil {
+                       return nil, fmt.Errorf("string convert to instance failed")
+               }
+               dci := &proto.DataCenterInfo{Name: "", Region: "", AvailableZone: ""}
+               instance["datacenterinfo"] = dci
+               var message []byte
+               message, err = json.Marshal(&instance)
+               if err != nil {
+                       log.Errorf(err, "Instance convert to string failed!")
+               }
+               var ins *proto.MicroServiceInstance
+               err = json.Unmarshal(message, &ins)
+               if err != nil {
+                       log.Errorf(err, "String convert to MicroServiceInstance failed!")
+               }
+               property := ins.Properties
+               if isQueryAllSvc && property != nil {
+                       findResp = append(findResp, ins)
+               } else if strings.EqualFold(property["serCategory/id"], serCategoryId) ||
+                       strings.EqualFold(property["ConsumedLocalOnly"], consumedLocalOnly) ||
+                       strings.EqualFold(property["ScopeOfLocality"], scopeOfLocality) ||
+                       strings.EqualFold(property["IsLocal"], isLocal) {
+                       findResp = append(findResp, ins)
+               }
+       }
+       if len(findResp) == 0 {
+               return nil, fmt.Errorf("service not found")
+       }
+       response := &proto.Response{Code: 0, Message: ""}
+       ret := &proto.FindInstancesResponse{Response: response, Instances: findResp}
+       return ret, nil
+}
+
+func SetMapValue(theMap map[string]interface{}, key string, val interface{}) {
+       mapValue, ok := theMap[key]
+       if !ok || mapValue == nil {
+               theMap[key] = val
+       }
+}
+
diff --git a/mep/mepserver/mp1/uuid/mp1context.go b/mep/mepserver/mp1/uuid/mp1context.go
new file mode 100644 (file)
index 0000000..46da3b1
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2020 Huawei Technologies Co., Ltd.
+ *
+ * Licensed 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.
+ */
+
+package uuid
+
+import (
+       "crypto/sha256"
+       "fmt"
+
+       "github.com/apache/servicecomb-service-center/pkg/util"
+       mgr "github.com/apache/servicecomb-service-center/server/plugin"
+       "github.com/apache/servicecomb-service-center/server/plugin/pkg/uuid"
+       "github.com/apache/servicecomb-service-center/server/plugin/pkg/uuid/buildin"
+       "golang.org/x/net/context"
+)
+
+func init() {
+       mgr.RegisterPlugin(mgr.Plugin{PName: mgr.UUID, Name: "mp1context", New: New})
+
+}
+
+func New() mgr.PluginInstance {
+       return &Mp1ContextUUID{}
+}
+
+type Mp1ContextUUID struct {
+       buildin.BuildinUUID
+}
+
+func (cu *Mp1ContextUUID) fromContext(ctx context.Context) string {
+       key, ok := ctx.Value(uuid.ContextKey).(string)
+       if !ok {
+               return ""
+       }
+       return key
+}
+
+func (cu *Mp1ContextUUID) GetServiceId(ctx context.Context) string {
+       content := cu.fromContext(ctx)
+       if len(content) == 0 {
+               return cu.BuildinUUID.GetServiceId(ctx)
+       }
+
+       shaSum := sha256.Sum256(util.StringToBytesWithNoCopy(content))
+       shaHalf := shaSum[0:8]
+       return fmt.Sprintf("%x", shaHalf)
+}
+
+func (cu *Mp1ContextUUID) GetInstanceId(_ context.Context) string {
+       shaSum := sha256.Sum256(util.StringToBytesWithNoCopy(util.GenerateUuid()))
+       shaHalf := shaSum[0:8]
+       return fmt.Sprintf("%x", shaHalf)
+}
diff --git a/mep/mepserver/postgres-k8s.yaml b/mep/mepserver/postgres-k8s.yaml
new file mode 100644 (file)
index 0000000..49c0007
--- /dev/null
@@ -0,0 +1,103 @@
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+
+# postgres database
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: postgres-db
+  namespace: mep
+  labels:
+    app: postgres-db
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: postgres-db
+  template:
+    metadata:
+      labels:
+        app: postgres-db
+    spec:
+      volumes:
+        - name: postgres-data
+          persistentVolumeClaim:
+            claimName: postgres-pv-claim
+      containers:
+        - name: postgres-db
+          image: postgres:9.6
+          imagePullPolicy: "IfNotPresent"
+          env:
+            - name: POSTGRES_DB
+              value: kong
+            - name: POSTGRES_USER
+              value: kong
+            - name: POSTGRES_PASSWORD
+              value: kong
+          volumeMounts:
+            - mountPath: /var/lib/postgresql/data
+              name: postgres-data
+          ports:
+            - containerPort: 5432
+
+# prepare postgres-db
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: prepare-postgre-db
+  namespace: mep
+spec:
+  template:
+    spec:
+      initContainers:
+        - name: check-db-ready
+          image: postgres:9.6
+          command: ['sh', '-c', 'until pg_isready -h postgres-db -p 5432;
+                    do echo waiting for database; sleep 2; done;']
+      containers:
+        - name: prepare-postgres-db
+          image: kong:1.5.1-alpine
+          env:
+            - name: KONG_DATABASE
+              value: "postgres"
+            - name: KONG_PG_DATABASE
+              value: kong
+            - name: KONG_PG_HOST
+              value: postgres-db
+            - name: KONG_PG_USER
+              value: kong
+            - name: KONG_PG_PASSWORD
+              value: kong
+          command: ['kong']
+          args: ['migrations', 'bootstrap']
+      restartPolicy: Never
+  backoffLimit: 4
+
+
+# postgres servcie
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: postgres-db
+  namespace: mep
+spec:
+  selector:
+    app: postgres-db
+  type: ClusterIP
+  ports:
+    - port: 5432
diff --git a/mep/mepserver/start.sh b/mep/mepserver/start.sh
new file mode 100755 (executable)
index 0000000..8365c15
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+cd /
+set +e
+sed -i "s/^httpaddr.*=.*$/httpaddr = $(hostname)/g" conf/app.conf
+sed -i "s/^ssl_mode.*=.*$/ssl_mode = ${MEP_SSL_MODE:-0}/g" conf/app.conf
+sed -i "s/^ssl_verify_client.*=.*$/ssl_verify_client = 0/g" conf/app.conf
+set -e
+./app
diff --git a/mep/mepserver/undeploy.sh b/mep/mepserver/undeploy.sh
new file mode 100755 (executable)
index 0000000..683ae7e
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Copyright 2020 Huawei Technologies Co., Ltd.
+#
+# Licensed 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.
+
+
+ kubectl delete -f mep-k8s.yaml
+# kubectl delete -f kong-k8s.yaml
+ kubectl delete -f postgres-k8s.yaml
+ kubectl delete -f mep-basic.yaml