From 37e5052b0d53c9137cba0b18f0d28f311826aba6 Mon Sep 17 00:00:00 2001 From: khemendra kumar Date: Tue, 21 Jul 2020 15:54:13 +0530 Subject: [PATCH] Readme file for mepagent Fixed nodeport for kong Signed-off-by: khemendra kumar Change-Id: I1b135d30a3446e3a1716b4345b3105d21b16f246 --- mep/mepagent/README.md | 55 ++++++++++++++++++++++ mep/mepagent/SampleApp/conf/app_instance_info.yaml | 4 +- mep/mepagent/SampleApp/go.sum | 31 ------------ mep/mepagent/SampleApp/mepagent.yaml | 18 +++---- mep/mepserver/create_mep_secret.sh | 1 + mep/mepserver/kong-k8s.yaml | 20 ++++---- mep/mepserver/mep-k8s.yaml | 16 +++---- 7 files changed, 87 insertions(+), 58 deletions(-) delete mode 100644 mep/mepagent/SampleApp/go.sum diff --git a/mep/mepagent/README.md b/mep/mepagent/README.md index b50520e..f3ec851 100644 --- a/mep/mepagent/README.md +++ b/mep/mepagent/README.md @@ -1,2 +1,57 @@ # mep_agent_lib Agent lib for mep service regsitration API + + +## Introduction + +MEP agent library and sample application is provide for quickly develop applications on MEP platform. +Code is devided in 2 part. +- SampleApp +- Service registration pkg. +- config file for setting application configuration +- docker file , build and k8s yaml files + +* SampleApp + - sample application for service regsitration to MEP + - contains main function and call service registration function from provided pkg + - It has config file for setting application configuration + +* pkg for service registration + - pkg can be used to register developer applications to MEP. + - support http and https connection to MEP + - configuration can be enabled/disbaled in config files when start mep agent + +## Configuration +mainly below configuration supported + - MEP GW details + - IP: IP of MEP Gateway + - HTTPS port: GW HTTPS proxy port + - HTTP port: GW HTTP proxy port + - App instance ID + - service registration sample data as per ETSI mp1 interface. + +## Usages +Developer who develp applications for MEP, can leverage sample application and pkg freamework to support mp1 interface for service registration. +In future this library can be extened to support all mp1 interface like discovery, service avaiibilty. +MEP support mp1 interfaces as per ETSI compliant. + +* Steps + - configure MEP GW IP and port in path meagent/SampleApp/conf/app_instance_info.yaml + - based on deplyment mode(development/production) provide HTTP/HTTPS port + - kong API GW run as K8s service, check corresponding port and config accordingly + - Kong has admin and proxy port. + - use proxy port and configure + - Build go applicaion with below cmd: + - cd mepagent/SampleApp + - CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' src/main/main.go + - Build docker and push to docker + - sudo ./docker-build.sh + - Deploy Application + - In mep-k8s.yaml + - enable/disable ssl which is env. variable in k8s yaml file + - APP_SSL_MODE "1" to enable ssl. + - By default app run in normal mode. + - generate k8s secret with ca.crt file which is root CA used by MEP. + - MEP provide cert-manager and vault to automate it. Plz refer corresponding document. + + diff --git a/mep/mepagent/SampleApp/conf/app_instance_info.yaml b/mep/mepagent/SampleApp/conf/app_instance_info.yaml index 01be19c..c474af2 100644 --- a/mep/mepagent/SampleApp/conf/app_instance_info.yaml +++ b/mep/mepagent/SampleApp/conf/app_instance_info.yaml @@ -15,8 +15,8 @@ --- appInstanceId: id12345 mepGWIP: 192.168.0.102 -httpGWPORT: 31082 -httpsGWPORT: 30126 +httpGWPORT: 30010 +httpsGWPORT: 30011 mepGWROUTES: /mp1 serviceInfoPosts: - serName: ExampleService diff --git a/mep/mepagent/SampleApp/go.sum b/mep/mepagent/SampleApp/go.sum deleted file mode 100644 index 56020de..0000000 --- a/mep/mepagent/SampleApp/go.sum +++ /dev/null @@ -1,31 +0,0 @@ -github.com/agiledragon/gomonkey v2.0.1+incompatible h1:DIQT3ZshgGz9pTwBddRSZWDutIRPx2d7UzmjzgWo9q0= -github.com/agiledragon/gomonkey v2.0.1+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw= -github.com/akraino-edge-stack/ealt-edge v0.0.0-20200624134839-54b1432860d4 h1:tZj/guuIF0G7Rlt2F1k3uKh8yG41v3ufdJNzK8xtDaU= -github.com/akraino-edge-stack/ealt-edge v0.0.0-20200624134839-54b1432860d4/go.mod h1:zCoMyvp9bMihsTPz9O1ZHGmS9olzxkFPD+8Ib+EvdSU= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/khemendra0/mep_agent_lib v0.0.0-20200514200710-1e480711e278 h1:OlJt5hf1vSwZDsL5Er+dq7gaZFWGsO9xEHPhDeUhj58= -github.com/khemendra0/mep_agent_lib v0.0.0-20200514200710-1e480711e278/go.mod h1:R3E+++9kes5yTa/FOTigCbgESB89fxkV3fSNgaIZ+aw= -github.com/khemendra0/mep_agent_lib v0.0.0-20200514203355-fdf3ccdf5332 h1:u5H6Sng3lcaFDHGkS9oCpKYj4vg0KkQem3DwLIRa+Uk= -github.com/khemendra0/mep_agent_lib_2 v0.0.0-20200515044354-e1f42901419d h1:h4OImiHv7jng9JN7NENbHzMBZiqdKCyfOHrn8HB9lUo= -github.com/khemendra0/mep_agent_lib_2 v0.0.0-20200515044354-e1f42901419d/go.mod h1:cLt2kf1jVHS7gmHMHSFzGtWlD5ac16rMfsObbkY2RlU= -github.com/khemendra0/mep_agent_lib_3 v0.0.0-20200515181745-facda354cc2a h1:wvynPYD+6o9LMSkqFv4lDOseaOL91G50XTj4vdD4Ws8= -github.com/khemendra0/mep_agent_lib_3 v0.0.0-20200515181745-facda354cc2a/go.mod h1:BFDUBKoOuzZLmkOLHUv3GODCPbgd6jhJNruFLganZJI= -github.com/khemendra0/mep_agent_lib_4 v0.0.0-20200515185547-0c783f20e651 h1:wi75k+JXOA1K5H4s+GKIox6c0RPSfQ9VP7j2vJ2044M= -github.com/khemendra0/mep_agent_lib_5 v0.0.0-20200515190552-685e7af625aa h1:aKmYnfBgLdJ+fKS3MHE0ig8UiJuTdMqohCaas8hN/r4= -github.com/khemendra0/mep_agent_lib_5 v0.0.0-20200515190552-685e7af625aa/go.mod h1:Z90GKwOZ8xQuY9eLUKrgt5TvVBVQZbNRSzsbvbYCCmQ= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -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/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/mep/mepagent/SampleApp/mepagent.yaml b/mep/mepagent/SampleApp/mepagent.yaml index 2afbf46..7fcf9f0 100755 --- a/mep/mepagent/SampleApp/mepagent.yaml +++ b/mep/mepagent/SampleApp/mepagent.yaml @@ -31,16 +31,16 @@ spec: - name: CA_CERT_DOMAIN_NAME value: "www.ealtedge.com" - name: SSL_ROOT - value: "/etc/mepagent_ssl/ca.crt" + value: "/etc/mepagent_ssl/trust.cer" - name: APP_SSL_MODE value: "0" ports: - containerPort: 80 - volumeMounts: - - name: mepagentssl - mountPath: "/etc/mepagent_ssl" - readOnly: true - volumes: - - name: mepagentssl - secret: - secretName: mepagent-ssl + #volumeMounts: + #- name: mepagentssl + #mountPath: "/etc/mepagent_ssl" + #readOnly: true + #volumes: + #- name: mepagentssl + #secret: + #secretName: mepagentssl_secret diff --git a/mep/mepserver/create_mep_secret.sh b/mep/mepserver/create_mep_secret.sh index 34e0f55..d9500cb 100755 --- a/mep/mepserver/create_mep_secret.sh +++ b/mep/mepserver/create_mep_secret.sh @@ -16,3 +16,4 @@ 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 kubectl create secret --namespace mep generic kongssl-secret --from-file=server.cer --from-file=server_key.pem --from-file=trust.cer +kubectl create secret --namespace mep generic mepagentssl_secret --from-file=server.cer --from-file=server_key.pem --from-file=trust.cer diff --git a/mep/mepserver/kong-k8s.yaml b/mep/mepserver/kong-k8s.yaml index fffc87e..6a2f56f 100644 --- a/mep/mepserver/kong-k8s.yaml +++ b/mep/mepserver/kong-k8s.yaml @@ -88,14 +88,14 @@ spec: - containerPort: 8444 name: admin-api-ssl protocol: TCP - volumeMounts: - - name: kongssl - mountPath: "/run/kongssl" - readOnly: true - volumes: - - name: kongssl - secret: - secretName: kongssl-secret + #volumeMounts: + #- name: kongssl + #mountPath: "/run/kongssl" + #readOnly: true + #volumes: + #- name: kongssl + #secret: + #secretName: kongssl-secret # kong service @@ -112,9 +112,13 @@ spec: ports: - port: 8000 name: proxy + nodePort: 30010 - port: 8443 name: proxy-ssl + nodePort: 30011 - port: 8001 name: admin-api + nodePort: 30012 - port: 8444 name: admin-api-ssl + nodePort: 30013 diff --git a/mep/mepserver/mep-k8s.yaml b/mep/mepserver/mep-k8s.yaml index 69e8cca..b27b6bf 100755 --- a/mep/mepserver/mep-k8s.yaml +++ b/mep/mepserver/mep-k8s.yaml @@ -35,14 +35,14 @@ spec: value: "/etc/mepssl" - name: MEP_SSL_MODE value: "0" - volumeMounts: - - name: mepssl - mountPath: "/etc/mepssl" - readOnly: true - volumes: - - name: mepssl - secret: - secretName: mepssl-secret + #volumeMounts: + #- name: mepssl + #mountPath: "/etc/mepssl" + #readOnly: true + #volumes: + #- name: mepssl + #secret: + #secretName: mepssl-secret # mep service -- 2.16.6