summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kud/deployment_infra/playbooks/configure-virtlet.yml2
-rw-r--r--kud/hosting_providers/vagrant/Vagrantfile8
-rw-r--r--kud/hosting_providers/vagrant/config/default.yml2
-rw-r--r--kud/hosting_providers/vagrant/config/samples/pdf.yml.aio2
-rw-r--r--src/dcm/api/api.go22
-rw-r--r--src/dcm/api/logicalCloudHandler.go37
-rw-r--r--src/dcm/cmd/main.go9
-rw-r--r--src/dcm/go.mod23
-rw-r--r--src/dcm/go.sum182
-rw-r--r--src/dcm/pkg/module/apply.go451
-rwxr-xr-xsrc/dcm/test/dcm_call_api.sh147
-rw-r--r--src/ncm/api/api.go3
-rw-r--r--src/ncm/api/clusterhandler.go30
-rw-r--r--src/ncm/api/clusterhandler_test.go18
-rw-r--r--src/ncm/api/netcontrolintenthandler.go32
-rw-r--r--src/ncm/go.mod15
-rw-r--r--src/ncm/pkg/module/cluster.go223
-rw-r--r--src/ncm/pkg/module/module_definitions.go30
-rw-r--r--src/ncm/pkg/module/netcontrolintent.go133
-rw-r--r--src/ncm/pkg/module/network.go14
-rw-r--r--src/ncm/pkg/module/providernet.go18
-rw-r--r--src/ncm/pkg/module/resources.go273
-rw-r--r--src/orchestrator/api/api.go3
-rw-r--r--src/orchestrator/api/controllerhandler.go106
-rw-r--r--src/orchestrator/api/controllerhandler_test.go57
-rw-r--r--src/orchestrator/pkg/appcontext/appcontext.go32
-rw-r--r--src/orchestrator/pkg/infra/validation/validation.go23
-rw-r--r--src/orchestrator/pkg/module/controller.go75
-rw-r--r--src/orchestrator/pkg/module/controller_test.go39
-rw-r--r--src/orchestrator/pkg/module/module.go41
30 files changed, 1906 insertions, 144 deletions
diff --git a/kud/deployment_infra/playbooks/configure-virtlet.yml b/kud/deployment_infra/playbooks/configure-virtlet.yml
index 18d3740a..c400cab0 100644
--- a/kud/deployment_infra/playbooks/configure-virtlet.yml
+++ b/kud/deployment_infra/playbooks/configure-virtlet.yml
@@ -40,7 +40,7 @@
- regexp: 'centos/(\d+)-(\d+)'
url: 'https://cloud.centos.org/centos/$1/images/CentOS-$1-x86_64-GenericCloud-$2.qcow2'
- name: fedora
- url: https://dl.fedoraproject.org/pub/fedora/linux/releases/29/Cloud/x86_64/images/Fedora-Cloud-Base-29-1.2.x86_64.qcow2
+ url: https://dl.fedoraproject.org/pub/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-31-1.9.x86_64.qcow2
{% if lookup('env','http_proxy') != "" %}
transports:
"":
diff --git a/kud/hosting_providers/vagrant/Vagrantfile b/kud/hosting_providers/vagrant/Vagrantfile
index 2d1b5ab4..eb5e5cdc 100644
--- a/kud/hosting_providers/vagrant/Vagrantfile
+++ b/kud/hosting_providers/vagrant/Vagrantfile
@@ -10,8 +10,8 @@
##############################################################################
box = {
- :virtualbox => { :name => 'elastic/ubuntu-16.04-x86_64', :version => '20180708.0.0' },
- :libvirt => { :name => 'elastic/ubuntu-16.04-x86_64', :version=> '20180210.0.0'}
+ :virtualbox => { :name => 'elastic/ubuntu-18.04-x86_64', :version => '20191013.0.0'},
+ :libvirt => { :name => 'intergratedcloudnative/ubuntu1804', :version => '1.0.0'}
}
require 'yaml'
@@ -122,8 +122,8 @@ Vagrant.configure("2") do |config|
installer.vm.provision 'shell', privileged: false do |sh|
sh.env = {'KUD_PLUGIN_ENABLED': 'false', 'OVN_CENTRAL_INTERFACE': 'eth1'}
sh.inline = <<-SHELL
- cp /vagrant/insecure_keys/key.pub /home/vagrant/.ssh/id_rsa.pub
- cp /vagrant/insecure_keys/key /home/vagrant/.ssh/id_rsa
+ cp /home/vagrant/multicloud-k8s/kud/hosting_providers/vagrant/insecure_keys/key.pub /home/vagrant/.ssh/id_rsa.pub
+ cp /home/vagrant/multicloud-k8s/kud/hosting_providers/vagrant/insecure_keys/key /home/vagrant/.ssh/id_rsa
chown vagrant /home/vagrant/.ssh/id_rsa
chmod 400 /home/vagrant/.ssh/id_rsa
cd /home/vagrant/multicloud-k8s/kud/hosting_providers/vagrant/ && ./installer.sh | tee kud_installer.log
diff --git a/kud/hosting_providers/vagrant/config/default.yml b/kud/hosting_providers/vagrant/config/default.yml
index 10b93663..094c3594 100644
--- a/kud/hosting_providers/vagrant/config/default.yml
+++ b/kud/hosting_providers/vagrant/config/default.yml
@@ -37,7 +37,7 @@
memory: 32768
cpus: 16
volumes:
- - name: sda
+ - name: sdb
size: 50
mount: /var/lib/docker/
roles:
diff --git a/kud/hosting_providers/vagrant/config/samples/pdf.yml.aio b/kud/hosting_providers/vagrant/config/samples/pdf.yml.aio
index 48a3c938..a87f967e 100644
--- a/kud/hosting_providers/vagrant/config/samples/pdf.yml.aio
+++ b/kud/hosting_providers/vagrant/config/samples/pdf.yml.aio
@@ -13,7 +13,7 @@
memory: 32768
cpus: 16
volumes:
- - name: sda
+ - name: sdb
size: 50
mount: /var/lib/docker/
roles:
diff --git a/src/dcm/api/api.go b/src/dcm/api/api.go
index d050a5ba..87ad77b5 100644
--- a/src/dcm/api/api.go
+++ b/src/dcm/api/api.go
@@ -36,7 +36,19 @@ func NewRouter(
if logicalCloudClient == nil {
logicalCloudClient = module.NewLogicalCloudClient()
}
- logicalCloudHandler := logicalCloudHandler{client: logicalCloudClient}
+
+ if clusterClient == nil {
+ clusterClient = module.NewClusterClient()
+ }
+
+ if quotaClient == nil {
+ quotaClient = module.NewQuotaClient()
+ }
+
+ logicalCloudHandler := logicalCloudHandler{client: logicalCloudClient,
+ clusterClient: clusterClient,
+ quotaClient: quotaClient,
+ }
lcRouter := router.PathPrefix("/v2/projects/{project-name}").Subrouter()
lcRouter.HandleFunc(
"/logical-clouds",
@@ -67,9 +79,7 @@ func NewRouter(
logicalCloudHandler.associateHandler).Methods("GET")*/
// Set up Cluster API
- if clusterClient == nil {
- clusterClient = module.NewClusterClient()
- }
+
clusterHandler := clusterHandler{client: clusterClient}
clusterRouter := router.PathPrefix("/v2/projects/{project-name}").Subrouter()
clusterRouter.HandleFunc(
@@ -108,9 +118,7 @@ func NewRouter(
userPermissionHandler.deleteHandler).Methods("DELETE")
// Set up Quota API
- if quotaClient == nil {
- quotaClient = module.NewQuotaClient()
- }
+
quotaHandler := quotaHandler{client: quotaClient}
quotaRouter := router.PathPrefix("/v2/projects/{project-name}").Subrouter()
quotaRouter.HandleFunc(
diff --git a/src/dcm/api/logicalCloudHandler.go b/src/dcm/api/logicalCloudHandler.go
index 7df0ae2e..d8fcf268 100644
--- a/src/dcm/api/logicalCloudHandler.go
+++ b/src/dcm/api/logicalCloudHandler.go
@@ -30,6 +30,8 @@ import (
// logicalCloudHandler is used to store backend implementations objects
type logicalCloudHandler struct {
client module.LogicalCloudManager
+ clusterClient module.ClusterManager
+ quotaClient module.QuotaManager
}
// CreateHandler handles creation of the logical cloud entry in the database
@@ -156,15 +158,38 @@ func (h logicalCloudHandler) deleteHandler(w http.ResponseWriter, r *http.Reques
}
func (h logicalCloudHandler) applyHandler(w http.ResponseWriter, r *http.Request) {
- /*vars := mux.Vars(r)
+ vars := mux.Vars(r)
project := vars["project-name"]
- name := vars["logical-cloud-name"]*/
- /*ret, err := h.client.Get(project, name)
+ name := vars["logical-cloud-name"]
+
+ // Get logical cloud
+ lc, err := h.client.Get(project, name)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
- }*/
+ }
+
+ // Get Clusters
+ clusters, err := h.clusterClient.GetAllClusters(project, name)
+
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+
+ //Get Quotas
+ quotas, err := h.quotaClient.GetAllQuotas(project, name)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ err = module.CreateEtcdContext(lc, clusters, quotas)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
- // Do Some Work
- // someApplyFunction(project, name, ret)
+ return
}
diff --git a/src/dcm/cmd/main.go b/src/dcm/cmd/main.go
index d8c13d2e..77d5348b 100644
--- a/src/dcm/cmd/main.go
+++ b/src/dcm/cmd/main.go
@@ -26,7 +26,7 @@ import (
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/auth"
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/config"
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db"
-
+ contextDb "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/contextdb"
"github.com/gorilla/handlers"
)
@@ -41,6 +41,13 @@ func main() {
log.Fatalln("Exiting...")
}
+ err = contextDb.InitializeContextDatabase()
+ if err != nil {
+ log.Println("Unable to initialize database connection...")
+ log.Println(err)
+ log.Fatalln("Exiting...")
+ }
+
httpRouter := api.NewRouter(nil, nil, nil, nil, nil)
loggedRouter := handlers.LoggingHandler(os.Stdout, httpRouter)
log.Println("Starting Distributed Cloud Manager API")
diff --git a/src/dcm/go.mod b/src/dcm/go.mod
index 994f919a..4d73085d 100644
--- a/src/dcm/go.mod
+++ b/src/dcm/go.mod
@@ -1,11 +1,22 @@
module github.com/onap/multicloud-k8s/src/dcm
-go 1.12
-
require (
- github.com/gorilla/handlers v1.4.2
- github.com/gorilla/mux v1.7.4
- github.com/onap/multicloud-k8s/src/orchestrator v0.0.0-20200309182120-42c5cef605d1
- github.com/pkg/errors v0.9.1
+ github.com/gorilla/handlers v1.3.0
+ github.com/gorilla/mux v1.6.2
+ github.com/onap/multicloud-k8s/src/orchestrator v0.0.0-20200413204718-f853b30cdc26
+ github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.4.0
+ gopkg.in/yaml.v2 v2.2.2
+)
+
+replace (
+ k8s.io/api => k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
+ k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190409022649-727a075fdec8
+ k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
+ k8s.io/apiserver => k8s.io/apiserver v0.0.0-20190409021813-1ec86e4da56c
+ k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190409023024-d644b00f3b79
+ k8s.io/client-go => k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
+ k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20190409023720-1bc0c81fa51d
)
+
+go 1.13
diff --git a/src/dcm/go.sum b/src/dcm/go.sum
index e09ed0e2..aa3a769e 100644
--- a/src/dcm/go.sum
+++ b/src/dcm/go.sum
@@ -1,128 +1,159 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
+github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
-github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
-github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
-github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
-github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
-github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
-github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
-github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
+github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e h1:eb0Pzkt15Bm7f2FFYv7sjY7NPFi3cPkS3tv1CcrFBWA=
github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E=
+github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc=
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
+github.com/Masterminds/sprig v2.17.1+incompatible h1:PChbxFGKTWsg9IWh+pSZRCSj3zQkVpL6Hd9uWsFwxtc=
github.com/Masterminds/sprig v2.17.1+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
+github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
+github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
+github.com/aokoli/goutils v1.1.0 h1:jy4ghdcYvs5EIoGssZNslIASX5m+KNMfyyKvRQ0TEVE=
github.com/aokoli/goutils v1.1.0/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
+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/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1 h1:HD4PLRzjuCVW79mQ0/pdsalOLHJ+FaEoqJLxfltpb2U=
github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/coreos/bbolt v1.3.3 h1:n6AiVyVRKQFNb6mJlwESEvvLoDyiTzXX7ORAUlkeBdY=
github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/etcd v3.3.12+incompatible h1:pAWNwdf7QiT1zfaWyqCtNZQWCLByQyA3JrSQyuYAqnQ=
github.com/coreos/etcd v3.3.12+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f h1:JOrtw2xFKzlg+cbHpyrpLDmnN1HqhBfnX7WDiW7eG2c=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
+github.com/cyphar/filepath-securejoin v0.2.2 h1:jCwT2GTP+PY5nBz3c/YL5PAIbusElVrPujOBSCj8xRg=
github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4=
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/docker/distribution v2.7.0+incompatible h1:neUDAlf3wX6Ml4HdqTrbcOHXtfRN0TFIwt6YFL7N9RU=
github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
+github.com/docker/docker v0.7.3-0.20190912223608-ad718029b705 h1:up4REDeXtcm77SlkowEGUuakgjpdNR2N9TkGTZSL4rM=
github.com/docker/docker v0.7.3-0.20190912223608-ad718029b705/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/engine v0.0.0-20190620014054-c513a4c6c298/go.mod h1:3CPr2caMgTHxxIAZgEMd3uLYPDlRvPqCpyeRf6ncPcY=
-github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
+github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c h1:ZfSZ3P3BedhKGUhzj7BQlPSU4OvT6tfOKe3DVHzOA7s=
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
-github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
+github.com/elazarl/goproxy v0.0.0-20190911111923-ecfe977594f1 h1:yY9rWGoXv1U5pl4gxqlULARMQD7x0QG85lqEXTWysik=
github.com/elazarl/goproxy v0.0.0-20190911111923-ecfe977594f1/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
+github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2 h1:dWB6v3RcOy03t/bUadywsbyrQwCqZeNIEX6M1OtSZOM=
github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8=
+github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
-github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
-github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
+github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M=
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
+github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM=
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4=
+github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
+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 v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
-github.com/ghodss/yaml v0.0.0-20180820084758-c7ce16629ff4/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
+github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
+github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w=
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
-github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY=
+github.com/go-openapi/spec v0.19.3 h1:0XRyw8kguri6Yw4SxhsQA/atC88yqrk0+G4YhI2wabc=
github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
+github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
+github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU=
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
+github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4=
github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
+github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg=
github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk=
github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw=
+github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
-github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
+github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
-github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff h1:kOkM9whyQYodu09SJ6W3NCsHG7crFaJILQ22Gozp3lg=
github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+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-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
-github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
+github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
+github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g=
github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
-github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
+github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
+github.com/gorilla/handlers v1.3.0 h1:tsg9qP3mjt1h4Roxp+M1paRjrVBfPSOpBuVclh6YluI=
github.com/gorilla/handlers v1.3.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
-github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=
-github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
+github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
-github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
-github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
+github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
-github.com/gregjones/httpcache v0.0.0-20170728041850-787624de3eb7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
+github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f h1:ShTPMJQes6tubcjzGMODIVG5hlrCeImaBnZzKF2N8SM=
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
+github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 h1:THDBEeQ9xZ8JEaCLyLQqXMMdRqNr0QAUJTIkQAUtFjg=
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE=
+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.11.1 h1:/dBYI+n4xIL+Y9SKXQrjlKTmJJDwCSlNLRwZ5nBhIek=
github.com/grpc-ecosystem/grpc-gateway v1.11.1/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/consul v1.4.0/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -135,20 +166,28 @@ github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es
github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90/go.mod h1:o4zcYY1e0GEZI6eSEr+43QDYmuGglw1qSO6qdHUHCgg=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+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/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/memberlist v0.1.5/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.1/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE=
+github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0=
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
+github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
+github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
+github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
+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 v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
@@ -156,75 +195,98 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0=
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
+github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
+github.com/mattn/go-sqlite3 v1.9.0 h1:pDRiWfl+++eC2FEFRy6jXmQlvp4Yh3z1MJKg4UeYM/4=
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+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/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
+github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+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 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+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/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
-github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/onap/multicloud-k8s/src/k8splugin v0.0.0-20191115005109-f168ebb73d8d/go.mod h1:EnQd/vQGZR1/55IihaHxiux4ZUig/zfXZux7bfmU0S8=
-github.com/onap/multicloud-k8s/src/orchestrator v0.0.0-20200309182120-42c5cef605d1 h1:rhEsWSmTf0JF+U0xwI7KFnMnsU7IjMHN7JphRKpolhQ=
-github.com/onap/multicloud-k8s/src/orchestrator v0.0.0-20200309182120-42c5cef605d1/go.mod h1:tAKrUVGJa0hwzIcE1e09B5CtcI9ZXlL7ZMQiw4dXEhQ=
+github.com/onap/multicloud-k8s/src/orchestrator v0.0.0-20200413204718-f853b30cdc26 h1:78c4pv5dNEraV53mNIPJAbO3IElR5Ulgfj83WOFq5kY=
+github.com/onap/multicloud-k8s/src/orchestrator v0.0.0-20200413204718-f853b30cdc26/go.mod h1:l+McjmNmpsgUku+EAqVvrHnsnwBOytDVlskzkAA7LK8=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
-github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
-github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
-github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
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/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
+github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc=
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/rubenv/sql-migrate v0.0.0-20190902133344-8926f37f0bc1 h1:G7j/gxkXAL80NMLOWi6EEctDET1Iuxl3sBMJXDnu2z0=
github.com/rubenv/sql-migrate v0.0.0-20190902133344-8926f37f0bc1/go.mod h1:WS0rl9eEliYI8DPnr3TOwz4439pay+qNgzJoVya/DmY=
+github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
+github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
+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/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
+github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
+github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -236,32 +298,44 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/technosophos/moniker v0.0.0-20180509230615-a5dbd03a2245 h1:DNVk+NIkGS0RbLkjQOLCJb/759yfCysThkMbl7EXxyY=
github.com/technosophos/moniker v0.0.0-20180509230615-a5dbd03a2245/go.mod h1:O1c8HleITsZqzNZDjSNzirUGsMT0oGu9LhHKoJrqO+A=
+github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51 h1:BP2bjP495BBPaBcS5rmqviTfrOkN5rO5ceKAMRZCRFc=
github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
+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/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
+github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
+github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c h1:u40Z8hqBAAQyv+vATcGgV0YCnDjqSL7/q/JyPhhJSPk=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v1.0.0 h1:d9X0esnoa3dFsV0FG35rAT0RIhYFlPq7MiP+DW89La0=
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
+github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
+github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1 h1:j2hhcujLRHAg872RWAV5yaUrEjHEObwDv3aImCaNLek=
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
+github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
+go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
+go.etcd.io/etcd v3.3.12+incompatible h1:V6PRYRGpU4k5EajJaaj/GL3hqIdzyPnBU8aPUp+35yw=
go.etcd.io/etcd v3.3.12+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI=
go.mongodb.org/mongo-driver v1.0.0 h1:KxPRDyfB2xXnDE2My8acoOWBQkfv3tz0SaWTRZjJR0c=
go.mongodb.org/mongo-driver v1.0.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
+go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/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=
+go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A=
@@ -282,11 +356,11 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20190812203447-cdfb69ac37fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -301,17 +375,18 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f h1:25KHgbfyiSm6vwQLbM3zZIe1v9p/3ea4Rz+nnM5K/i4=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -325,48 +400,69 @@ golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgw
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/gorp.v1 v1.7.2 h1:j3DWlAyGVv8whO7AcIWznQ2Yj7yJkn34B8s63GViAAw=
gopkg.in/gorp.v1 v1.7.2/go.mod h1:Wo3h+DBQZIxATwftsglhdD/62zRFPhGhTiu5jUJmCaw=
-gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
+gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
+gopkg.in/square/go-jose.v2 v2.2.2 h1:orlkJ3myw8CN1nVQHBFfloD+L3egixIa4FvUP6RosSA=
gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
+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.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
-k8s.io/api v0.0.0-20190831074750-7364b6bdad65/go.mod h1:u09ZxrpPFcoUNEQM2GsqT/KpglKAtXdEcK+tSMilQ3Q=
+k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b h1:aBGgKJUM9Hk/3AE8WaZIApnTxG35kbuQba2w+SXqezo=
+k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
+k8s.io/apiextensions-apiserver v0.0.0-20190409022649-727a075fdec8 h1:q1Qvjzs/iEdXF6A1a8H3AKVFDzJNcJn3nXMs6R6qFtA=
k8s.io/apiextensions-apiserver v0.0.0-20190409022649-727a075fdec8/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE=
-k8s.io/apimachinery v0.0.0-20190831074630-461753078381/go.mod h1:nL6pwRT8NgfF8TT68DBI8uEePRt89cSvoXUVqbkWHq4=
+k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d h1:Jmdtdt1ZnoGfWWIIik61Z7nKYgO3J+swQJtPYsP9wHA=
+k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
+k8s.io/apiserver v0.0.0-20190409021813-1ec86e4da56c h1:k7ALUVzrOEgz4hOF+pr4pePn7TqZ9lB/8Z8ndMSsWSU=
k8s.io/apiserver v0.0.0-20190409021813-1ec86e4da56c/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w=
-k8s.io/cli-runtime v0.0.0-20190913085402-777c64e2902f/go.mod h1:TtjkdmxYMLASzYbE8E7AUr/ZrXMcmXLnDLRY4sVWspw=
-k8s.io/client-go v0.0.0-20190831074946-3fe2abece89e/go.mod h1:hAiMqq+tCk9hxFvWr2DoRiVyCYEGpni4eOcGCQLOEfM=
+k8s.io/cli-runtime v0.0.0-20190409023024-d644b00f3b79 h1:bZyxc0wzVA5KgUfAXZA6z872zDWmyslwfvrr175VF68=
+k8s.io/cli-runtime v0.0.0-20190409023024-d644b00f3b79/go.mod h1:qWnH3/b8sp/l7EvlDh7ulDU3UWA4P4N1NFbEEP791tM=
+k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible h1:U5Bt+dab9K8qaUmXINrkXO135kA11/i5Kg1RUydgaMQ=
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
+k8s.io/cloud-provider v0.0.0-20190409023720-1bc0c81fa51d h1:ad7UpNUGRx6FbYoK4+xIYyeS2CUShjNKY45YN1ipjLI=
k8s.io/cloud-provider v0.0.0-20190409023720-1bc0c81fa51d/go.mod h1:LlIffnLBu+GG7d4ppPzC8UnA1Ex8S+ntmSRVsnr7Xy4=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
+k8s.io/helm v2.14.3+incompatible h1:uzotTcZXa/b2SWVoUzM1xiCXVjI38TuxMujS/1s+3Gw=
k8s.io/helm v2.14.3+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
-k8s.io/klog v0.4.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
+k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
+k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf h1:EYm5AW/UUDbnmnI+gK0TJDVK9qPLhM+sRHYanNKw0EQ=
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
+k8s.io/kubernetes v1.14.1 h1:I9F52h5sqVxBmoSsBlNQ0YygNcukDilkpGxUbJRoBoY=
k8s.io/kubernetes v1.14.1/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
-k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
+k8s.io/utils v0.0.0-20190907131718-3d4f5b7dea0b h1:eMM0sTvh3KBVGwJfuNcU86P38TJhlVMAICbFPDG3t0M=
k8s.io/utils v0.0.0-20190907131718-3d4f5b7dea0b/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
+sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
+sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
+vbom.ml/util v0.0.0-20180919145318-efcd4e0f9787 h1:O69FD9pJA4WUZlEwYatBEEkRWKQ5cKodWpdKTrCS/iQ=
vbom.ml/util v0.0.0-20180919145318-efcd4e0f9787/go.mod h1:so/NYdZXCz+E3ZpW0uAoCj6uzU2+8OWDFv/HxUSs7kI=
diff --git a/src/dcm/pkg/module/apply.go b/src/dcm/pkg/module/apply.go
new file mode 100644
index 00000000..c918f749
--- /dev/null
+++ b/src/dcm/pkg/module/apply.go
@@ -0,0 +1,451 @@
+/*
+* Copyright 2020 Intel Corporation, Inc
+*
+* 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 module
+
+import (
+ "strings"
+ "fmt"
+ "crypto/rsa"
+ "crypto/rand"
+ "crypto/x509"
+ "crypto/x509/pkix"
+ "encoding/json"
+ "encoding/pem"
+ "encoding/base64"
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/appcontext"
+ log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
+ "gopkg.in/yaml.v2"
+ pkgerrors "github.com/pkg/errors"
+
+)
+
+type Resource struct {
+ ApiVersion string `yaml:"apiVersion"`
+ Kind string `yaml:"kind"`
+ MetaData MetaDatas `yaml:"metadata"`
+ Specification Specs `yaml:"spec,omitempty"`
+ Rules []RoleRules `yaml:"rules,omitempty"`
+ Subjects []RoleSubjects `yaml:"subjects,omitempty"`
+ RoleRefs RoleRef `yaml:"roleRef,omitempty"`
+}
+
+type MetaDatas struct {
+ Name string `yaml:"name"`
+ Namespace string `yaml:"namespace,omitempty"`
+}
+
+type Specs struct {
+ Request string `yaml:"request,omitempty"`
+ Usages []string `yaml:"usages,omitempty"`
+ //Hard logicalcloud.QSpec `yaml:"hard,omitempty"`
+ Hard QSpec `yaml:"hard,omitempty"`
+}
+
+type RoleRules struct {
+ ApiGroups []string `yaml:"apiGroups"`
+ Resources []string `yaml:"resources"`
+ Verbs []string `yaml:"verbs"`
+}
+
+type RoleSubjects struct {
+ Kind string `yaml:"kind"`
+ Name string `yaml:"name"`
+ ApiGroup string `yaml:"apiGroup"`
+}
+
+type RoleRef struct {
+ Kind string `yaml:"kind"`
+ Name string `yaml:"name"`
+ ApiGroup string `yaml:"apiGroup"`
+}
+
+
+func createNamespace(logicalcloud LogicalCloud) (string, error) {
+
+ namespace := Resource{
+ ApiVersion: "v1",
+ Kind: "Namespace",
+ MetaData: MetaDatas{
+ Name: logicalcloud.Specification.NameSpace,
+ },
+ }
+
+ nsData, err := yaml.Marshal(&namespace)
+ if err != nil {
+ return "", err
+ }
+
+
+ return string(nsData), nil
+}
+
+func createRole(logicalcloud LogicalCloud) (string, error) {
+
+ userPermissions := logicalcloud.Specification.User.UserPermissions[0]
+
+ role := Resource{
+ ApiVersion: "rbac.authorization.k8s.io/v1beta1",
+ Kind: "Role",
+ MetaData: MetaDatas{
+ Name: strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "-role"}, ""),
+ Namespace: logicalcloud.Specification.NameSpace,
+ },
+ Rules: []RoleRules{ RoleRules{
+ ApiGroups: userPermissions.APIGroups,
+ Resources: userPermissions.Resources,
+ Verbs: userPermissions.Verbs,
+ },
+ },
+
+ }
+
+ roleData, err := yaml.Marshal(&role)
+ if err != nil {
+ return "", err
+ }
+
+ return string(roleData), nil
+}
+
+func createRoleBinding(logicalcloud LogicalCloud) (string, error) {
+
+ roleBinding := Resource{
+ ApiVersion: "rbac.authorization.k8s.io/v1beta1",
+ Kind: "RoleBinding",
+ MetaData: MetaDatas{
+ Name: strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "-roleBinding"}, ""),
+ Namespace: logicalcloud.Specification.NameSpace,
+ },
+ Subjects: []RoleSubjects{ RoleSubjects{
+ Kind: "User",
+ Name: logicalcloud.Specification.User.UserName,
+ ApiGroup: "",
+ },
+ },
+
+ RoleRefs: RoleRef{
+ Kind: "Role",
+ Name: strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "-role"}, ""),
+ ApiGroup: "",
+ },
+ }
+
+ rBData, err := yaml.Marshal(&roleBinding)
+ if err != nil {
+ return "", err
+ }
+
+
+ return string(rBData), nil
+
+}
+
+func createQuota(quota []Quota, namespace string) (string, error) {
+ lcQuota := quota[0]
+
+ q := Resource{
+ ApiVersion: "v1",
+ Kind: "ResourceQuota",
+ MetaData: MetaDatas{
+ Name: lcQuota.MetaData.QuotaName,
+ Namespace: namespace,
+ },
+ Specification: Specs{
+ Hard: lcQuota.Specification,
+ },
+ }
+
+ qData, err := yaml.Marshal(&q)
+ if err != nil {
+ return "", err
+ }
+
+
+
+ return string(qData), nil
+
+}
+
+func createUserCSR(logicalcloud LogicalCloud) (string, error) {
+ KEYSIZE := 4096
+ userName := logicalcloud.Specification.User.UserName
+
+ key, err := rsa.GenerateKey(rand.Reader, KEYSIZE)
+ if err != nil {
+ return "", err
+ }
+
+ csrTemplate := x509.CertificateRequest{Subject: pkix.Name{CommonName: userName,},
+ }
+
+ csrCert, err := x509.CreateCertificateRequest(rand.Reader, &csrTemplate, key)
+ if err != nil {
+ return "", err
+ }
+
+ //Encode csr
+ csr := pem.EncodeToMemory(&pem.Block{
+ Type: "CERTIFICATE REQUEST",
+ Bytes: csrCert,
+ })
+
+ csrObj := Resource{
+ ApiVersion: "certificates.k8s.io/v1beta1",
+ Kind: "CertificateSigningRequest",
+ MetaData: MetaDatas{
+ Name: strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "-user-csr"}, ""),
+ Namespace: logicalcloud.Specification.NameSpace,
+ },
+ Specification: Specs{
+ Request: base64.StdEncoding.EncodeToString(csr),
+ Usages: []string{"digital signature", "key encipherment"},
+ },
+ }
+
+ csrData, err := yaml.Marshal(&csrObj)
+ if err != nil {
+ return "", err
+ }
+
+
+ return string(csrData), nil
+
+
+}
+
+// TODO:
+// Install istio
+// Store user key for user creation
+// Code to run kubectl commands for user
+// kubectl certificate approve lc1-user-cert
+// kubectl get csr lc1-user-cert -o jsonpath='{.status.certificate}' | base64 --decode > user.crt
+// kubectl config set-credentials user --client-certificate=<user.crt> --client-key=<user.key>
+// kubectl config set-context user-context --cluster=cluster-name --namespace=lc1 --user=user
+
+
+func CreateEtcdContext(logicalcloud LogicalCloud, clusterList []Cluster,
+ quotaList []Quota ) error {
+
+ APP := "logical-cloud"
+ logicalCloudName := logicalcloud.MetaData.LogicalCloudName
+
+
+ //Resource Names
+ namespaceName := strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "+namespace"}, "")
+ roleName := strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "+role"}, "")
+ roleBindingName := strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "+roleBinding"}, "")
+ quotaName := strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "+quota"}, "")
+ csrName := strings.Join([]string{logicalcloud.MetaData.LogicalCloudName, "+CertificateSigningRequest"}, "")
+
+ // Get resources to be added
+ namespace, err := createNamespace(logicalcloud)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error Creating Namespace YAML for logical cloud")
+ }
+
+ role, err := createRole(logicalcloud)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error Creating Role YAML for logical cloud")
+ }
+
+ roleBinding, err := createRoleBinding(logicalcloud)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error Creating RoleBinding YAML for logical cloud")
+ }
+
+ quota, err := createQuota(quotaList, logicalcloud.Specification.NameSpace)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error Creating Quota YAML for logical cloud")
+ }
+
+ csr, err := createUserCSR(logicalcloud)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error Creating User CSR for logical cloud")
+ }
+
+
+ context := appcontext.AppContext{}
+ ctxVal, err := context.InitAppContext()
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error creating AppContext")
+ }
+
+ fmt.Printf("%v\n", ctxVal)
+
+ handle, err := context.CreateCompositeApp()
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error creating AppContext CompositeApp")
+ }
+
+
+ appHandle, err := context.AddApp(handle, APP)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext CompositeApp create failure", log.Fields{
+ "logical-cloud": logicalCloudName,
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding App to AppContext")
+ }
+
+
+ // Iterate through cluster list and add all the clusters
+ for _, cluster:= range clusterList {
+ clusterName := strings.Join([]string{cluster.Specification.ClusterProvider, "+", cluster.Specification.ClusterName, }, "")
+ clusterHandle, err := context.AddCluster(appHandle, clusterName)
+
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add cluster failure", log.Fields{
+ "cluster-provider": cluster.Specification.ClusterProvider,
+ "cluster": cluster.Specification.ClusterName,
+ "logical-cloud": logicalCloudName,
+
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding Cluster to AppContext")
+ }
+
+ // Add namespace resource to each cluster
+ _, err = context.AddResource(clusterHandle, namespaceName, namespace)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add namespace resource failure", log.Fields{
+ "cluster-provider": cluster.Specification.ClusterProvider,
+ "cluster": cluster.Specification.ClusterName,
+ "logical-cloud": logicalCloudName,
+
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding Namespace Resource to AppContext")
+ }
+
+ // Add csr resource to each cluster
+ _, err = context.AddResource(clusterHandle, csrName, csr)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add CSR resource failure", log.Fields{
+ "cluster-provider": cluster.Specification.ClusterProvider,
+ "cluster": cluster.Specification.ClusterName,
+ "logical-cloud": logicalCloudName,
+
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding CSR Resource to AppContext")
+ }
+
+
+
+ // Add Role resource to each cluster
+ _, err = context.AddResource(clusterHandle, roleName, role)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add role resource failure", log.Fields{
+ "cluster-provider": cluster.Specification.ClusterProvider,
+ "cluster": cluster.Specification.ClusterName,
+ "logical-cloud": logicalCloudName,
+
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding role Resource to AppContext")
+ }
+
+ // Add RoleBinding resource to each cluster
+ _, err = context.AddResource(clusterHandle, roleBindingName, roleBinding)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add roleBinding resource failure", log.Fields{
+ "cluster-provider": cluster.Specification.ClusterProvider,
+ "cluster": cluster.Specification.ClusterName,
+ "logical-cloud": logicalCloudName,
+
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding roleBinding Resource to AppContext")
+ }
+
+ // Add quota resource to each cluster
+ _, err = context.AddResource(clusterHandle, quotaName, quota)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add quota resource failure", log.Fields{
+ "cluster-provider": cluster.Specification.ClusterProvider,
+ "cluster": cluster.Specification.ClusterName,
+ "logical-cloud": logicalCloudName,
+
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding quota Resource to AppContext")
+ }
+
+ // Add Resource Order and Resource Dependency
+ resOrder, err := json.Marshal(map[string][]string{"resorder" : []string{namespaceName, quotaName, csrName, roleName, roleBindingName}})
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error creating resource order JSON")
+ }
+
+ resDependency, err := json.Marshal(map[string]map[string]string{"resdependency" : map[string]string{namespaceName : "go",
+ quotaName : strings.Join([]string{"wait on ", namespaceName}, ""), csrName: strings.Join([]string{"wait on ", quotaName}, ""),
+ roleName : strings.Join([]string{"wait on ", csrName}, ""), roleBindingName: strings.Join([]string{"wait on ", roleName}, ""),}})
+
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error creating resource dependency JSON")
+ }
+
+ _, err = context.AddInstruction(clusterHandle, "resource", "order", string(resOrder))
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add instruction failure", log.Fields{
+ "cluster-provider": cluster.Specification.ClusterProvider,
+ "cluster": cluster.Specification.ClusterName,
+ "logical-cloud": logicalCloudName,
+
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding instruction order to AppContext")
+ }
+
+ _, err = context.AddInstruction(clusterHandle, "resource", "dependency", string(resDependency))
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add instruction failure", log.Fields{
+ "cluster-provider": cluster.Specification.ClusterProvider,
+ "cluster": cluster.Specification.ClusterName,
+ "logical-cloud": logicalCloudName,
+
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding instruction dependency to AppContext")
+ }
+
+
+
+ }
+
+ return nil
+
+
+}
diff --git a/src/dcm/test/dcm_call_api.sh b/src/dcm/test/dcm_call_api.sh
new file mode 100755
index 00000000..3bf27524
--- /dev/null
+++ b/src/dcm/test/dcm_call_api.sh
@@ -0,0 +1,147 @@
+# /*
+# * Copyright 2020 Intel Corporation, Inc
+# *
+# * 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.
+# */
+
+
+project="test-project"
+description="test-description"
+logical_cloud_name="lc1"
+logical_cloud_url="http://localhost:9015/v2/projects/${project}/logical-clouds"
+quota_name="quota-1"
+quota_url="${logical_cloud_url}/${logical_cloud_name}/cluster-quotas"
+cluster_url="${logical_cloud_url}/${logical_cloud_name}/cluster-references"
+
+
+logical_cloud_data="$(cat << EOF
+{
+ "metadata" : {
+ "name": "${logical_cloud_name}",
+ "description": "${test-description}",
+ "userData1":"<user data>",
+ "userData2":"<user data>"
+ },
+ "spec" : {
+ "namespace" : "ns-1",
+ "user" : {
+ "user-name" : "user-1",
+ "type" : "certificate",
+ "user-permissions" : [
+ { "permission-name" : "permission-1",
+ "apiGroups" : ["stable.example.com"],
+ "resources" : ["secrets", "pods"],
+ "verbs" : ["get", "watch", "list", "create"]
+ }
+ ]
+ }
+ }
+}
+EOF
+)"
+
+cluster_1_data="$(cat << EOF
+{
+ "metadata" : {
+ "name": "lc-cl-1",
+ "description": "${test-description}",
+ "userData1":"<user data>",
+ "userData2":"<user data>"
+ },
+
+ "spec" : {
+ "cluster-provider": "cp-1",
+ "cluster-name": "c1",
+ "loadbalancer-ip" : "0.0.0.0"
+ }
+}
+EOF
+)"
+
+cluster_2_data="$(cat << EOF
+{
+ "metadata" : {
+ "name": "lc-cl-2",
+ "description": "${test-description}",
+ "userData1":"<user data>",
+ "userData2":"<user data>"
+ },
+
+ "spec" : {
+ "cluster-provider": "cp-1",
+ "cluster-name": "c2",
+ "loadbalancer-ip" : "0.0.0.1"
+ }
+}
+EOF
+)"
+
+quota_data="$(cat << EOF
+{
+ "metadata" : {
+ "name" : "${quota_name}",
+ "description": "${test-description}"
+ },
+ "spec" : {
+ "limits.cpu": "400",
+ "limits.memory": "1000Gi",
+ "requests.cpu": "300",
+ "requests.memory": "900Gi",
+ "requests.storage" : "500Gi",
+ "requests.ephemeral-storage": "",
+ "limits.ephemeral-storage": "",
+ "persistentvolumeclaims" : " ",
+ "pods": "500",
+ "configmaps" : "",
+ "replicationcontrollers": "",
+ "resourcequotas" : "",
+ "services": "",
+ "services.loadbalancers" : "",
+ "services.nodeports" : "",
+ "secrets" : "",
+ "count/replicationcontrollers" : "",
+ "count/deployments.apps" : "",
+ "count/replicasets.apps" : "",
+ "count/statefulsets.apps" : "",
+ "count/jobs.batch" : "",
+ "count/cronjobs.batch" : "",
+ "count/deployments.extensions" : ""
+ }
+}
+EOF
+)"
+
+
+# Create logical cloud
+printf "\n\nCreating logical cloud data\n\n"
+curl -d "${logical_cloud_data}" -X POST ${logical_cloud_url}
+
+# Associate two clusters with the logical cloud
+printf "\n\nAdding two clusters to logical cloud\n\n"
+curl -d "${cluster_1_data}" -X POST ${cluster_url}
+curl -d "${cluster_2_data}" -X POST ${cluster_url}
+
+# Add resource quota for the logical cloud
+printf "\n\nAdding resource quota for the logical cloud\n\n"
+curl -d "${quota_data}" -X POST ${quota_url}
+
+
+# Get logical cloud data
+printf "\n\nGetting logical cloud\n\n"
+curl -X GET "${logical_cloud_url}/${logical_cloud_name}"
+
+printf "\n\nGetting clusters info for logical cloud\n\n"
+curl -X GET ${cluster_url}
+
+printf "\n\nGetting Quota info for the logical cloud\n\n"
+curl -X GET "${quota_url}/${quota_name}" \ No newline at end of file
diff --git a/src/ncm/api/api.go b/src/ncm/api/api.go
index fcef7b43..2b105716 100644
--- a/src/ncm/api/api.go
+++ b/src/ncm/api/api.go
@@ -98,6 +98,8 @@ func NewRouter(testClient interface{}) *mux.Router {
router.HandleFunc("/cluster-providers/{provider-name}/clusters", clusterHandler.getClusterHandler).Queries("label", "{label}")
router.HandleFunc("/cluster-providers/{provider-name}/clusters/{name}", clusterHandler.getClusterHandler).Methods("GET")
router.HandleFunc("/cluster-providers/{provider-name}/clusters/{name}", clusterHandler.deleteClusterHandler).Methods("DELETE")
+ router.HandleFunc("/cluster-providers/{provider-name}/clusters/{name}/apply", clusterHandler.applyClusterHandler).Methods("POST")
+ router.HandleFunc("/cluster-providers/{provider-name}/clusters/{name}/terminate", clusterHandler.terminateClusterHandler).Methods("POST")
router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/labels", clusterHandler.createClusterLabelHandler).Methods("POST")
router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/labels", clusterHandler.getClusterLabelHandler).Methods("GET")
router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/labels/{label}", clusterHandler.getClusterLabelHandler).Methods("GET")
@@ -133,6 +135,7 @@ func NewRouter(testClient interface{}) *mux.Router {
router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{name}", netcontrolintentHandler.putHandler).Methods("PUT")
router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{name}", netcontrolintentHandler.getHandler).Methods("GET")
router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{name}", netcontrolintentHandler.deleteHandler).Methods("DELETE")
+ router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{name}/apply", netcontrolintentHandler.applyHandler).Methods("POST")
workloadintentHandler := workloadintentHandler{
client: setClient(moduleClient.WorkloadIntent, testClient).(moduleLib.WorkloadIntentManager),
diff --git a/src/ncm/api/clusterhandler.go b/src/ncm/api/clusterhandler.go
index 8c50f720..78453aa8 100644
--- a/src/ncm/api/clusterhandler.go
+++ b/src/ncm/api/clusterhandler.go
@@ -324,6 +324,36 @@ func (h clusterHandler) deleteClusterHandler(w http.ResponseWriter, r *http.Requ
w.WriteHeader(http.StatusNoContent)
}
+// apply network intents associated with the cluster
+func (h clusterHandler) applyClusterHandler(w http.ResponseWriter, r *http.Request) {
+ vars := mux.Vars(r)
+ provider := vars["provider-name"]
+ name := vars["name"]
+
+ err := h.client.ApplyNetworkIntents(provider, name)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.WriteHeader(http.StatusNoContent)
+}
+
+// terminate network intents associated with the cluster
+func (h clusterHandler) terminateClusterHandler(w http.ResponseWriter, r *http.Request) {
+ vars := mux.Vars(r)
+ provider := vars["provider-name"]
+ name := vars["name"]
+
+ err := h.client.TerminateNetworkIntents(provider, name)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.WriteHeader(http.StatusNoContent)
+}
+
// Create handles creation of the ClusterLabel entry in the database
func (h clusterHandler) createClusterLabelHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
diff --git a/src/ncm/api/clusterhandler_test.go b/src/ncm/api/clusterhandler_test.go
index a26c41bd..b32df527 100644
--- a/src/ncm/api/clusterhandler_test.go
+++ b/src/ncm/api/clusterhandler_test.go
@@ -28,6 +28,7 @@ import (
"testing"
moduleLib "github.com/onap/multicloud-k8s/src/ncm/pkg/module"
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/appcontext"
pkgerrors "github.com/pkg/errors"
)
@@ -41,6 +42,7 @@ type mockClusterManager struct {
ClusterProviderItems []moduleLib.ClusterProvider
ClusterItems []moduleLib.Cluster
ClusterContentItems []moduleLib.ClusterContent
+ ClusterContextItems []appcontext.AppContext
ClusterLabelItems []moduleLib.ClusterLabel
ClusterKvPairsItems []moduleLib.ClusterKvPairs
ClusterList []string
@@ -99,6 +101,14 @@ func (m *mockClusterManager) GetClusterContent(provider, name string) (moduleLib
return m.ClusterContentItems[0], nil
}
+func (m *mockClusterManager) GetClusterContext(provider, name string) (appcontext.AppContext, error) {
+ if m.Err != nil {
+ return appcontext.AppContext{}, m.Err
+ }
+
+ return m.ClusterContextItems[0], nil
+}
+
func (m *mockClusterManager) GetClusters(provider string) ([]moduleLib.Cluster, error) {
if m.Err != nil {
return []moduleLib.Cluster{}, m.Err
@@ -119,6 +129,14 @@ func (m *mockClusterManager) DeleteCluster(provider, name string) error {
return m.Err
}
+func (m *mockClusterManager) ApplyNetworkIntents(provider, name string) error {
+ return m.Err
+}
+
+func (m *mockClusterManager) TerminateNetworkIntents(provider, name string) error {
+ return m.Err
+}
+
func (m *mockClusterManager) CreateClusterLabel(provider, cluster string, inp moduleLib.ClusterLabel) (moduleLib.ClusterLabel, error) {
if m.Err != nil {
return moduleLib.ClusterLabel{}, m.Err
diff --git a/src/ncm/api/netcontrolintenthandler.go b/src/ncm/api/netcontrolintenthandler.go
index c59a389b..48ef1de2 100644
--- a/src/ncm/api/netcontrolintenthandler.go
+++ b/src/ncm/api/netcontrolintenthandler.go
@@ -196,3 +196,35 @@ func (h netcontrolintentHandler) deleteHandler(w http.ResponseWriter, r *http.Re
w.WriteHeader(http.StatusNoContent)
}
+
+// Apply handles POST operations to Apply a particular NetControlIntent to the App Context
+func (h netcontrolintentHandler) applyHandler(w http.ResponseWriter, r *http.Request) {
+ vars := mux.Vars(r)
+ name := vars["name"]
+ project := vars["project"]
+ compositeApp := vars["composite-app-name"]
+ compositeAppVersion := vars["version"]
+
+ var aci struct {
+ AppContextId string `json:"appContextId"`
+ }
+
+ err := json.NewDecoder(r.Body).Decode(&aci)
+
+ switch {
+ case err == io.EOF:
+ http.Error(w, "Empty body", http.StatusBadRequest)
+ return
+ case err != nil:
+ http.Error(w, err.Error(), http.StatusUnprocessableEntity)
+ return
+ }
+
+ err = h.client.ApplyNetControlIntent(name, project, compositeApp, compositeAppVersion, aci.AppContextId)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.WriteHeader(http.StatusNoContent)
+}
diff --git a/src/ncm/go.mod b/src/ncm/go.mod
index 32ff481a..8b45298f 100644
--- a/src/ncm/go.mod
+++ b/src/ncm/go.mod
@@ -1,21 +1,26 @@
module github.com/onap/multicloud-k8s/src/ncm
require (
- github.com/coreos/etcd v3.3.12+incompatible
- github.com/docker/engine v0.0.0-20190620014054-c513a4c6c298
+ github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/ghodss/yaml v1.0.0
+ github.com/google/gofuzz v1.1.0 // indirect
github.com/gorilla/handlers v1.3.0
github.com/gorilla/mux v1.6.2
- github.com/hashicorp/consul v1.4.0
+ github.com/json-iterator/go v1.1.9 // indirect
+ github.com/k8snetworkplumbingwg/network-attachment-definition-client v0.0.0-20200127152046-0ee521d56061
github.com/pkg/errors v0.8.1
github.com/sirupsen/logrus v1.4.2
go.etcd.io/etcd v3.3.12+incompatible
go.mongodb.org/mongo-driver v1.0.0
- golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
+ golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3
+ gopkg.in/yaml.v2 v2.2.8
k8s.io/api v0.0.0-20190831074750-7364b6bdad65
k8s.io/apimachinery v0.0.0-20190831074630-461753078381
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
- k8s.io/helm v2.14.3+incompatible
+ k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a // indirect
+ k8s.io/kubernetes v1.14.1
+ k8s.io/utils v0.0.0-20200414100711-2df71ebbae66 // indirect
+ sigs.k8s.io/yaml v1.2.0 // indirect
)
replace (
diff --git a/src/ncm/pkg/module/cluster.go b/src/ncm/pkg/module/cluster.go
index 4ca4e7c8..2397a091 100644
--- a/src/ncm/pkg/module/cluster.go
+++ b/src/ncm/pkg/module/cluster.go
@@ -17,7 +17,10 @@
package module
import (
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/appcontext"
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db"
+ log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
+ "gopkg.in/yaml.v2"
pkgerrors "github.com/pkg/errors"
)
@@ -79,6 +82,10 @@ type ClusterKvPairsKey struct {
ClusterKvPairsName string `json:"kvname"`
}
+const SEPARATOR = "+"
+const CONTEXT_CLUSTER_APP = "network-intents"
+const CONTEXT_CLUSTER_RESOURCE = "network-intents"
+
// ClusterManager is an interface exposes the Cluster functionality
type ClusterManager interface {
CreateClusterProvider(pr ClusterProvider) (ClusterProvider, error)
@@ -88,9 +95,12 @@ type ClusterManager interface {
CreateCluster(provider string, pr Cluster, qr ClusterContent) (Cluster, error)
GetCluster(provider, name string) (Cluster, error)
GetClusterContent(provider, name string) (ClusterContent, error)
+ GetClusterContext(provider, name string) (appcontext.AppContext, error)
GetClusters(provider string) ([]Cluster, error)
GetClustersWithLabel(provider, label string) ([]string, error)
DeleteCluster(provider, name string) error
+ ApplyNetworkIntents(provider, name string) error
+ TerminateNetworkIntents(provider, name string) error
CreateClusterLabel(provider, cluster string, pr ClusterLabel) (ClusterLabel, error)
GetClusterLabel(provider, cluster, label string) (ClusterLabel, error)
GetClusterLabels(provider, cluster string) ([]ClusterLabel, error)
@@ -115,6 +125,7 @@ func NewClusterClient() *ClusterClient {
storeName: "cluster",
tagMeta: "clustermetadata",
tagContent: "clustercontent",
+ tagContext: "clustercontext",
},
}
}
@@ -294,6 +305,33 @@ func (v *ClusterClient) GetClusterContent(provider, name string) (ClusterContent
return ClusterContent{}, pkgerrors.New("Error getting Cluster Content")
}
+// GetClusterContext returns the AppContext for corresponding provider and name
+func (v *ClusterClient) GetClusterContext(provider, name string) (appcontext.AppContext, error) {
+ //Construct key and tag to select the entry
+ key := ClusterKey{
+ ClusterProviderName: provider,
+ ClusterName: name,
+ }
+
+ value, err := db.DBconn.Find(v.db.storeName, key, v.db.tagContext)
+ if err != nil {
+ return appcontext.AppContext{}, pkgerrors.Wrap(err, "Get Cluster Context")
+ }
+
+ //value is a byte array
+ if value != nil {
+ ctxVal := string(value[0])
+ var cc appcontext.AppContext
+ _, err = cc.LoadAppContext(ctxVal)
+ if err != nil {
+ return appcontext.AppContext{}, pkgerrors.Wrap(err, "Reinitializing Cluster AppContext")
+ }
+ return cc, nil
+ }
+
+ return appcontext.AppContext{}, pkgerrors.New("Error getting Cluster AppContext")
+}
+
// GetClusters returns all the Clusters for corresponding provider
func (v *ClusterClient) GetClusters(provider string) ([]Cluster, error) {
//Construct key and tag to select the entry
@@ -351,8 +389,12 @@ func (v *ClusterClient) DeleteCluster(provider, name string) error {
ClusterProviderName: provider,
ClusterName: name,
}
+ _, err := v.GetClusterContext(provider, name)
+ if err == nil {
+ return pkgerrors.Errorf("Cannot delete cluster until context is deleted: %v, %v", provider, name)
+ }
- err := db.DBconn.Remove(v.db.storeName, key)
+ err = db.DBconn.Remove(v.db.storeName, key)
if err != nil {
return pkgerrors.Wrap(err, "Delete Cluster Entry;")
}
@@ -360,6 +402,185 @@ func (v *ClusterClient) DeleteCluster(provider, name string) error {
return nil
}
+// Apply Network Intents associated with a cluster
+func (v *ClusterClient) ApplyNetworkIntents(provider, name string) error {
+
+ _, err := v.GetClusterContext(provider, name)
+ if err == nil {
+ return pkgerrors.Errorf("Cluster network intents have already been applied: %v, %v", provider, name)
+ }
+
+ type resource struct {
+ name string
+ value string
+ }
+
+ var resources []resource
+
+ // Find all Network Intents for this cluster
+ networkIntents, err := NewNetworkClient().GetNetworks(provider, name)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error finding Network Intents")
+ }
+ for _, intent := range networkIntents {
+ var crNetwork = CrNetwork{
+ ApiVersion: NETWORK_APIVERSION,
+ Kind: NETWORK_KIND,
+ }
+ crNetwork.Network = intent
+ // Produce the yaml CR document for each intent
+ y, err := yaml.Marshal(&crNetwork)
+ if err != nil {
+ log.Info("Error marshalling network intent to yaml", log.Fields{
+ "error": err,
+ "intent": intent,
+ })
+ continue
+ }
+ resources = append(resources, resource{
+ name: intent.Metadata.Name + SEPARATOR + NETWORK_KIND,
+ value: string(y),
+ })
+ }
+
+ // Find all Provider Network Intents for this cluster
+ providerNetworkIntents, err := NewProviderNetClient().GetProviderNets(provider, name)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error finding Provider Network Intents")
+ }
+ for _, intent := range providerNetworkIntents {
+ var crProviderNet = CrProviderNet{
+ ApiVersion: PROVIDER_NETWORK_APIVERSION,
+ Kind: PROVIDER_NETWORK_KIND,
+ }
+ crProviderNet.ProviderNet = intent
+ // Produce the yaml CR document for each intent
+ y, err := yaml.Marshal(&crProviderNet)
+ if err != nil {
+ log.Info("Error marshalling provider network intent to yaml", log.Fields{
+ "error": err,
+ "intent": intent,
+ })
+ continue
+ }
+ resources = append(resources, resource{
+ name: intent.Metadata.Name + SEPARATOR + PROVIDER_NETWORK_KIND,
+ value: string(y),
+ })
+ }
+
+ if len(resources) == 0 {
+ return nil
+ }
+
+ // Make an app context for the network intent resources
+ context := appcontext.AppContext{}
+ ctxVal, err := context.InitAppContext()
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error creating AppContext")
+ }
+ handle, err := context.CreateCompositeApp()
+ if err != nil {
+ return pkgerrors.Wrap(err, "Error creating AppContext CompositeApp")
+ }
+
+ // Add an app (fixed value) to the app context
+ apphandle, err := context.AddApp(handle, CONTEXT_CLUSTER_APP)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext CompositeApp create failure", log.Fields{
+ "cluster-provider": provider,
+ "cluster": name,
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding App to AppContext")
+ }
+
+ // Add a cluster to the app
+ clusterhandle, err := context.AddCluster(apphandle, provider+SEPARATOR+name)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add cluster failure", log.Fields{
+ "cluster-provider": provider,
+ "cluster": name,
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding Cluster to AppContext")
+ }
+
+ // add the resources to the app context
+ for _, resource := range resources {
+ _, err = context.AddResource(clusterhandle, resource.name, resource.value)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after add resource failure", log.Fields{
+ "cluster-provider": provider,
+ "cluster": name,
+ "resource": resource.name,
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding Resource to AppContext")
+ }
+ }
+
+ // save the context in the cluster db record
+ key := ClusterKey{
+ ClusterProviderName: provider,
+ ClusterName: name,
+ }
+ err = db.DBconn.Insert(v.db.storeName, key, nil, v.db.tagContext, ctxVal)
+ if err != nil {
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error cleaning AppContext after DB insert failure", log.Fields{
+ "cluster-provider": provider,
+ "cluster": name,
+ })
+ }
+ return pkgerrors.Wrap(err, "Error adding AppContext to DB")
+ }
+
+ // TODO: call resource synchronizer to instantiate the CRs in the cluster
+
+ return nil
+}
+
+// Terminate Network Intents associated with a cluster
+func (v *ClusterClient) TerminateNetworkIntents(provider, name string) error {
+ context, err := v.GetClusterContext(provider, name)
+ if err != nil {
+ return pkgerrors.Wrapf(err, "Error finding AppContext for cluster: %v, %v", provider, name)
+ }
+
+ // TODO: call resource synchronizer to terminate the CRs in the cluster
+
+ // remove the app context
+ cleanuperr := context.DeleteCompositeApp()
+ if cleanuperr != nil {
+ log.Warn("Error deleted AppContext", log.Fields{
+ "cluster-provider": provider,
+ "cluster": name,
+ })
+ }
+
+ // remove the app context field from the cluster db record
+ key := ClusterKey{
+ ClusterProviderName: provider,
+ ClusterName: name,
+ }
+ err = db.DBconn.RemoveTag(v.db.storeName, key, v.db.tagContext)
+ if err != nil {
+ log.Warn("Error removing AppContext from Cluster document", log.Fields{
+ "cluster-provider": provider,
+ "cluster": name,
+ })
+ }
+ return nil
+}
+
// CreateClusterLabel - create a new Cluster Label mongo document for a cluster-provider/cluster
func (v *ClusterClient) CreateClusterLabel(provider string, cluster string, p ClusterLabel) (ClusterLabel, error) {
//Construct key and tag to select the entry
diff --git a/src/ncm/pkg/module/module_definitions.go b/src/ncm/pkg/module/module_definitions.go
index 729a9dbd..36c865a5 100644
--- a/src/ncm/pkg/module/module_definitions.go
+++ b/src/ncm/pkg/module/module_definitions.go
@@ -31,28 +31,32 @@ const CNI_TYPE_OVN4NFV string = "ovn4nfv"
var CNI_TYPES = [...]string{CNI_TYPE_OVN4NFV}
+const YAML_START = "---\n"
+const YAML_END = "...\n"
+
// It implements the interface for managing the ClusterProviders
const MAX_DESCRIPTION_LEN int = 1024
const MAX_USERDATA_LEN int = 4096
type Metadata struct {
- Name string `json:"name"`
- Description string `json:"description"`
- UserData1 string `json:"userData1"`
- UserData2 string `json:"userData2"`
+ Name string `json:"name" yaml:"name"`
+ Description string `json:"description" yaml:"-"`
+ UserData1 string `json:"userData1" yaml:"-"`
+ UserData2 string `json:"userData2" yaml:"-"`
}
type ClientDbInfo struct {
storeName string // name of the mongodb collection to use for client documents
tagMeta string // attribute key name for the json data of a client document
tagContent string // attribute key name for the file data of a client document
+ tagContext string // attribute key name for context object in App Context
}
type Ipv4Subnet struct {
- Subnet string `json:"subnet"` // CIDR notation, e.g. 172.16.33.0/24
- Name string `json:"name"`
- Gateway string `json:"gateway"` // IPv4 addre, e.g. 172.16.33.1/24
- Exclude string `json:"excludeIps"` // space separated list of single IPs or ranges e.g. "172.16.33.2 172.16.33.5..172.16.33.10"
+ Subnet string `json:"subnet" yaml:"subnet"` // CIDR notation, e.g. 172.16.33.0/24
+ Name string `json:"name" yaml:"name"`
+ Gateway string `json:"gateway" yaml:"gateway"` // IPv4 addre, e.g. 172.16.33.1/24
+ Exclude string `json:"excludeIps" yaml:"excludeIps"` // space separated list of single IPs or ranges e.g. "172.16.33.2 172.16.33.5..172.16.33.10"
}
const VLAN_NODE_ANY = "any"
@@ -61,11 +65,11 @@ const VLAN_NODE_SPECIFIC = "specific"
var VLAN_NODE_SELECTORS = [...]string{VLAN_NODE_ANY, VLAN_NODE_SPECIFIC}
type Vlan struct {
- VlanId int `json:"vlanID"`
- ProviderInterfaceName string `json:"providerInterfaceName"`
- LogicalInterfaceName string `json:"logicalInterfaceName"`
- VlanNodeSelector string `json:"vlanNodeSelector"`
- NodeLabelList []string `json:"nodeLabelList"`
+ VlanId int `json:"vlanID" yaml:"vlanId"`
+ ProviderInterfaceName string `json:"providerInterfaceName" yaml:"providerInterfaceName"`
+ LogicalInterfaceName string `json:"logicalInterfaceName" yaml:"logicalInterfaceName"`
+ VlanNodeSelector string `json:"vlanNodeSelector" yaml:"vlanNodeSelector"`
+ NodeLabelList []string `json:"nodeLabelList" yaml:"nodeLabelList"`
}
// Check for valid format Metadata
diff --git a/src/ncm/pkg/module/netcontrolintent.go b/src/ncm/pkg/module/netcontrolintent.go
index 5ef9dffe..c005a935 100644
--- a/src/ncm/pkg/module/netcontrolintent.go
+++ b/src/ncm/pkg/module/netcontrolintent.go
@@ -17,8 +17,17 @@
package module
import (
- "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db"
+ "encoding/json"
+ "strings"
+
+ jyaml "github.com/ghodss/yaml"
+ nettypes "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/appcontext"
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db"
+ log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/client-go/kubernetes/scheme"
pkgerrors "github.com/pkg/errors"
)
@@ -42,6 +51,7 @@ type NetControlIntentManager interface {
GetNetControlIntent(name, project, compositeapp, compositeappversion string) (NetControlIntent, error)
GetNetControlIntents(project, compositeapp, compositeappversion string) ([]NetControlIntent, error)
DeleteNetControlIntent(name, project, compositeapp, compositeappversion string) error
+ ApplyNetControlIntent(name, project, compositeapp, compositeappversion, appContextId string) error
}
// NetControlIntentClient implements the Manager
@@ -162,3 +172,124 @@ func (v *NetControlIntentClient) DeleteNetControlIntent(name, project, composite
return nil
}
+
+// (Test Routine) - Apply network-control-intent
+func (v *NetControlIntentClient) ApplyNetControlIntent(name, project, compositeapp, compositeappversion, appContextId string) error {
+ // TODO: Handle all Network Chain Intents for the Network Control Intent
+
+ // Handle all Workload Intents for the Network Control Intent
+ wis, err := NewWorkloadIntentClient().GetWorkloadIntents(project, compositeapp, compositeappversion, name)
+ if err != nil {
+ return pkgerrors.Wrapf(err, "Error getting Workload Intents for Network Control Intent %v for %v/%v%v not found", name, project, compositeapp, compositeappversion)
+ }
+
+ // Setup the AppContext
+ var context appcontext.AppContext
+ _, err = context.LoadAppContext(appContextId)
+ if err != nil {
+ return pkgerrors.Wrapf(err, "Error getting AppContext with Id: %v for %v/%v%v",
+ appContextId, project, compositeapp, compositeappversion)
+ }
+
+ // Handle all intents (currently just Interface intents) for each Workload Intent
+ for _, wi := range wis {
+ // The app/resource identified in the workload intent needs to be updated with two annotations.
+ // 1 - The "k8s.v1.cni.cncf.io/networks" annotation will have {"name": "ovn-networkobj", "namespace": "default"} added
+ // to it (preserving any existing values for this annotation.
+ // 2 - The "k8s.plugin.opnfv.org/nfn-network" annotation will add any network interfaces that are provided by the
+ // workload/interfaces intents.
+
+ // Prepare the list of interfaces from the workload intent
+ wifs, err := NewWorkloadIfIntentClient().GetWorkloadIfIntents(project,
+ compositeapp,
+ compositeappversion,
+ name,
+ wi.Metadata.Name)
+ if err != nil {
+ return pkgerrors.Wrapf(err,
+ "Error getting Workload Interface Intents for Workload Intent %v under Network Control Intent %v for %v/%v%v not found",
+ wi.Metadata.Name, name, project, compositeapp, compositeappversion)
+ }
+ if len(wifs) == 0 {
+ log.Warn("No interface intents provided for workload intent", log.Fields{
+ "project": project,
+ "composite app": compositeapp,
+ "composite app version": compositeappversion,
+ "network control intent": name,
+ "workload intent": wi.Metadata.Name,
+ })
+ continue
+ }
+
+ // Get all clusters for the current App from the AppContext
+ clusters, err := context.GetClusterNames(wi.Spec.AppName)
+ for _, c := range clusters {
+ rh, err := context.GetResourceHandle(wi.Spec.AppName, c,
+ strings.Join([]string{wi.Spec.WorkloadResource, wi.Spec.Type}, "+"))
+ if err != nil {
+ log.Warn("App Context resource handle not found", log.Fields{
+ "project": project,
+ "composite app": compositeapp,
+ "composite app version": compositeappversion,
+ "network control intent": name,
+ "workload name": wi.Metadata.Name,
+ "app": wi.Spec.AppName,
+ "resource": wi.Spec.WorkloadResource,
+ "resource type": wi.Spec.Type,
+ })
+ continue
+ }
+ r, err := context.GetValue(rh)
+ if err != nil {
+ log.Error("Error retrieving resource from App Context", log.Fields{
+ "error": err,
+ "resource handle": rh,
+ })
+ }
+
+ // Unmarshal resource to K8S object
+ robj, err := runtime.Decode(scheme.Codecs.UniversalDeserializer(), []byte(r.(string)))
+
+ // Add network annotation to object
+ netAnnot := nettypes.NetworkSelectionElement{
+ Name: "ovn-networkobj",
+ Namespace: "default",
+ }
+ AddNetworkAnnotation(robj, netAnnot)
+
+ // Add nfn interface annotations to object
+ var newNfnIfs []WorkloadIfIntentSpec
+ for _, i := range wifs {
+ newNfnIfs = append(newNfnIfs, i.Spec)
+ }
+ AddNfnAnnotation(robj, newNfnIfs)
+
+ // Marshal object back to yaml format (via json - seems to eliminate most clutter)
+ j, err := json.Marshal(robj)
+ if err != nil {
+ log.Error("Error marshalling resource to JSON", log.Fields{
+ "error": err,
+ })
+ continue
+ }
+ y, err := jyaml.JSONToYAML(j)
+ if err != nil {
+ log.Error("Error marshalling resource to YAML", log.Fields{
+ "error": err,
+ })
+ continue
+ }
+
+ // Update resource in AppContext
+ err = context.UpdateResourceValue(rh, string(y))
+ if err != nil {
+ log.Error("Network updating app context resource handle", log.Fields{
+ "error": err,
+ "resource handle": rh,
+ })
+ }
+ }
+ }
+
+ return nil
+}
diff --git a/src/ncm/pkg/module/network.go b/src/ncm/pkg/module/network.go
index 2d4121e9..cfb414c5 100644
--- a/src/ncm/pkg/module/network.go
+++ b/src/ncm/pkg/module/network.go
@@ -24,8 +24,8 @@ import (
// Network contains the parameters needed for dynamic networks
type Network struct {
- Metadata Metadata `json:"metadata"`
- Spec NetworkSpec `json:"spec"`
+ Metadata Metadata `json:"metadata" yaml:"metadata"`
+ Spec NetworkSpec `json:"spec" yaml:"spec"`
}
type NetworkSpec struct {
@@ -40,6 +40,16 @@ type NetworkKey struct {
NetworkName string `json:"network"`
}
+// structure for the Network Custom Resource
+type CrNetwork struct {
+ ApiVersion string `yaml:"apiVersion"`
+ Kind string `yaml:"kind"`
+ Network Network
+}
+
+const NETWORK_APIVERSION = "k8s.plugin.opnfv.org/v1alpha1"
+const NETWORK_KIND = "Network"
+
// Manager is an interface exposing the Network functionality
type NetworkManager interface {
CreateNetwork(pr Network, clusterProvider, cluster string, exists bool) (Network, error)
diff --git a/src/ncm/pkg/module/providernet.go b/src/ncm/pkg/module/providernet.go
index 5e2c0343..0435f2ba 100644
--- a/src/ncm/pkg/module/providernet.go
+++ b/src/ncm/pkg/module/providernet.go
@@ -29,12 +29,22 @@ type ProviderNet struct {
}
type ProviderNetSpec struct {
- CniType string `json:"cniType"`
- Ipv4Subnets []Ipv4Subnet `json:"ipv4Subnets"`
- ProviderNetType string `json:"providerNetType"`
- Vlan Vlan `json:"vlan"`
+ CniType string `json:"cniType" yaml:"cniType"`
+ Ipv4Subnets []Ipv4Subnet `json:"ipv4Subnets" yaml:"ipv4Subnets"`
+ ProviderNetType string `json:"providerNetType" yaml:"providerNetType"`
+ Vlan Vlan `json:"vlan" yaml:"vlan"`
}
+// structure for the Network Custom Resource
+type CrProviderNet struct {
+ ApiVersion string `yaml:"apiVersion"`
+ Kind string `yaml:"kind"`
+ ProviderNet ProviderNet
+}
+
+const PROVIDER_NETWORK_APIVERSION = "k8s.plugin.opnfv.org/v1alpha1"
+const PROVIDER_NETWORK_KIND = "ProviderNetwork"
+
// ProviderNetKey is the key structure that is used in the database
type ProviderNetKey struct {
ClusterProviderName string `json:"provider"`
diff --git a/src/ncm/pkg/module/resources.go b/src/ncm/pkg/module/resources.go
new file mode 100644
index 00000000..24c9833e
--- /dev/null
+++ b/src/ncm/pkg/module/resources.go
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2020 Intel Corporation, Inc
+ *
+ * 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 module
+
+import (
+ "encoding/json"
+ "fmt"
+
+ nettypes "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
+ netutils "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/utils"
+ log "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/logutils"
+ v1 "k8s.io/api/apps/v1"
+ batch "k8s.io/api/batch/v1"
+ batchv1beta1 "k8s.io/api/batch/v1beta1"
+ v1core "k8s.io/api/core/v1"
+ _ "k8s.io/kubernetes/pkg/apis/apps/install"
+ _ "k8s.io/kubernetes/pkg/apis/batch/install"
+ _ "k8s.io/kubernetes/pkg/apis/core/install"
+ _ "k8s.io/kubernetes/pkg/apis/extensions/install"
+
+ pkgerrors "github.com/pkg/errors"
+)
+
+type NfnAnnotation struct {
+ CniType string
+ Interface []WorkloadIfIntentSpec
+}
+
+const NfnAnnotationKey = "k8s.plugin.opnfv.org/nfn-network"
+
+// ParsePodTemplateNetworkAnnotation parses Pod annotation in PodTemplate
+func ParsePodTemplateNetworkAnnotation(pt *v1core.PodTemplateSpec) ([]*nettypes.NetworkSelectionElement, error) {
+ netAnnot := pt.Annotations[nettypes.NetworkAttachmentAnnot]
+ defaultNamespace := pt.Namespace
+
+ if len(netAnnot) == 0 {
+ return nil, pkgerrors.Errorf("No kubernetes network annotation found")
+ }
+
+ networks, err := netutils.ParseNetworkAnnotation(netAnnot, defaultNamespace)
+ if err != nil {
+ return nil, err
+ }
+ return networks, nil
+}
+
+// GetPodTemplateNetworkAnnotation gets Pod Nfn annotation in PodTemplate
+func GetPodTemplateNfnAnnotation(pt *v1core.PodTemplateSpec) NfnAnnotation {
+ var nfn NfnAnnotation
+
+ nfnAnnot := pt.Annotations[NfnAnnotationKey]
+ if len(nfnAnnot) == 0 {
+ return nfn
+ }
+
+ err := json.Unmarshal([]byte(nfnAnnot), &nfn)
+ if err != nil {
+ log.Warn("Error unmarshalling nfn annotation", log.Fields{
+ "annotation": nfnAnnot,
+ })
+ }
+ return nfn
+}
+
+// GetPodNetworkAnnotation gets Pod Nfn annotation in PodTemplate
+func GetPodNfnAnnotation(p *v1core.Pod) NfnAnnotation {
+ var nfn NfnAnnotation
+
+ nfnAnnot := p.Annotations[NfnAnnotationKey]
+ if len(nfnAnnot) == 0 {
+ return nfn
+ }
+
+ err := json.Unmarshal([]byte(nfnAnnot), &nfn)
+ if err != nil {
+ log.Warn("Error unmarshalling nfn annotation", log.Fields{
+ "annotation": nfnAnnot,
+ })
+ }
+ return nfn
+}
+
+func addNetworkAnnotation(a nettypes.NetworkSelectionElement, as []*nettypes.NetworkSelectionElement) []*nettypes.NetworkSelectionElement {
+ var netElements []*nettypes.NetworkSelectionElement
+
+ found := false
+ for _, e := range as {
+ if e.Name == a.Name {
+ found = true
+ }
+ netElements = append(netElements, e)
+ }
+ if !found {
+ netElements = append(netElements, &a)
+ }
+
+ return netElements
+}
+
+// Add the interfaces in the 'new' parameter to the nfn annotation
+func newNfnIfs(nfn NfnAnnotation, new []WorkloadIfIntentSpec) NfnAnnotation {
+ // Prepare a new interface list - combining the original plus new ones
+ var newNfn NfnAnnotation
+
+ if nfn.CniType != CNI_TYPE_OVN4NFV {
+ if len(nfn.CniType) > 0 {
+ log.Warn("Error existing nfn cnitype is invalid", log.Fields{
+ "existing cnitype": nfn.CniType,
+ "using cnitype": CNI_TYPE_OVN4NFV,
+ })
+ }
+ }
+ newNfn.CniType = CNI_TYPE_OVN4NFV
+
+ // update any interfaces already in the list with the updated interface
+ for _, i := range nfn.Interface {
+ for _, j := range new {
+ if i.NetworkName == j.NetworkName && i.IfName == j.IfName {
+ i.DefaultGateway = j.DefaultGateway
+ i.IpAddr = j.IpAddr
+ i.MacAddr = j.MacAddr
+ break
+ }
+ }
+ newNfn.Interface = append(newNfn.Interface, i)
+ }
+
+ // add new interfaces not present in original list
+ for _, j := range new {
+ found := false
+ for _, i := range nfn.Interface {
+ if i.NetworkName == j.NetworkName && i.IfName == j.IfName {
+ found = true
+ break
+ }
+ }
+ if !found {
+ newNfn.Interface = append(newNfn.Interface, j)
+ }
+ }
+ return newNfn
+}
+
+func updatePodTemplateNetworkAnnotation(pt *v1core.PodTemplateSpec, a nettypes.NetworkSelectionElement) {
+ netAnnotation, _ := ParsePodTemplateNetworkAnnotation(pt)
+ elements := addNetworkAnnotation(a, netAnnotation)
+ j, err := json.Marshal(elements)
+ if err != nil {
+ log.Error("Existing network annotation has invalid format", log.Fields{
+ "error": err,
+ })
+ return
+ }
+ if pt.Annotations == nil {
+ pt.Annotations = make(map[string]string)
+ }
+ pt.Annotations[nettypes.NetworkAttachmentAnnot] = string(j)
+}
+
+// Add a network annotation to the resource
+func AddNetworkAnnotation(r interface{}, a nettypes.NetworkSelectionElement) {
+
+ switch o := r.(type) {
+ case *batch.Job:
+ updatePodTemplateNetworkAnnotation(&o.Spec.Template, a)
+ case *batchv1beta1.CronJob:
+ updatePodTemplateNetworkAnnotation(&o.Spec.JobTemplate.Spec.Template, a)
+ case *v1.DaemonSet:
+ updatePodTemplateNetworkAnnotation(&o.Spec.Template, a)
+ case *v1.Deployment:
+ updatePodTemplateNetworkAnnotation(&o.Spec.Template, a)
+ case *v1.ReplicaSet:
+ updatePodTemplateNetworkAnnotation(&o.Spec.Template, a)
+ case *v1.StatefulSet:
+ updatePodTemplateNetworkAnnotation(&o.Spec.Template, a)
+ case *v1core.Pod:
+ netAnnotation, _ := netutils.ParsePodNetworkAnnotation(o)
+ elements := addNetworkAnnotation(a, netAnnotation)
+ j, err := json.Marshal(elements)
+ if err != nil {
+ log.Error("Existing network annotation has invalid format", log.Fields{
+ "error": err,
+ })
+ break
+ }
+ if o.Annotations == nil {
+ o.Annotations = make(map[string]string)
+ }
+ o.Annotations[nettypes.NetworkAttachmentAnnot] = string(j)
+ return
+ case *v1core.ReplicationController:
+ updatePodTemplateNetworkAnnotation(o.Spec.Template, a)
+ default:
+ typeStr := fmt.Sprintf("%T", o)
+ log.Warn("Network annotations not supported for resource type", log.Fields{
+ "resource type": typeStr,
+ })
+ }
+}
+
+func updatePodTemplateNfnAnnotation(pt *v1core.PodTemplateSpec, new []WorkloadIfIntentSpec) {
+ nfnAnnotation := GetPodTemplateNfnAnnotation(pt)
+ newNfnAnnotation := newNfnIfs(nfnAnnotation, new)
+ j, err := json.Marshal(newNfnAnnotation)
+ if err != nil {
+ log.Error("Network nfn annotation has invalid format", log.Fields{
+ "error": err,
+ })
+ return
+ }
+ if pt.Annotations == nil {
+ pt.Annotations = make(map[string]string)
+ }
+ pt.Annotations[NfnAnnotationKey] = string(j)
+}
+
+// Add an nfn annotation to the resource
+func AddNfnAnnotation(r interface{}, new []WorkloadIfIntentSpec) {
+
+ switch o := r.(type) {
+ case *batch.Job:
+ updatePodTemplateNfnAnnotation(&o.Spec.Template, new)
+ case *batchv1beta1.CronJob:
+ updatePodTemplateNfnAnnotation(&o.Spec.JobTemplate.Spec.Template, new)
+ case *v1.DaemonSet:
+ updatePodTemplateNfnAnnotation(&o.Spec.Template, new)
+ return
+ case *v1.Deployment:
+ updatePodTemplateNfnAnnotation(&o.Spec.Template, new)
+ return
+ case *v1.ReplicaSet:
+ updatePodTemplateNfnAnnotation(&o.Spec.Template, new)
+ case *v1.StatefulSet:
+ updatePodTemplateNfnAnnotation(&o.Spec.Template, new)
+ case *v1core.Pod:
+ nfnAnnotation := GetPodNfnAnnotation(o)
+ newNfnAnnotation := newNfnIfs(nfnAnnotation, new)
+ j, err := json.Marshal(newNfnAnnotation)
+ if err != nil {
+ log.Error("Network nfn annotation has invalid format", log.Fields{
+ "error": err,
+ })
+ break
+ }
+ if o.Annotations == nil {
+ o.Annotations = make(map[string]string)
+ }
+ o.Annotations[NfnAnnotationKey] = string(j)
+ return
+ case *v1core.ReplicationController:
+ updatePodTemplateNfnAnnotation(o.Spec.Template, new)
+ return
+ default:
+ typeStr := fmt.Sprintf("%T", o)
+ log.Warn("Network nfn annotations not supported for resource type", log.Fields{
+ "resource type": typeStr,
+ })
+ }
+}
diff --git a/src/orchestrator/api/api.go b/src/orchestrator/api/api.go
index 6277d994..8b4b91a1 100644
--- a/src/orchestrator/api/api.go
+++ b/src/orchestrator/api/api.go
@@ -111,7 +111,8 @@ func NewRouter(projectClient moduleLib.ProjectManager,
router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles/{app-profile}", appProfileHandler.deleteAppProfileHandler).Methods("DELETE")
router.HandleFunc("/controllers", controlHandler.createHandler).Methods("POST")
- router.HandleFunc("/controllers", controlHandler.createHandler).Methods("PUT")
+ router.HandleFunc("/controllers", controlHandler.getHandler).Methods("GET")
+ router.HandleFunc("/controllers/{controller-name}", controlHandler.putHandler).Methods("PUT")
router.HandleFunc("/controllers/{controller-name}", controlHandler.getHandler).Methods("GET")
router.HandleFunc("/controllers/{controller-name}", controlHandler.deleteHandler).Methods("DELETE")
//setting routes for genericPlacementIntent
diff --git a/src/orchestrator/api/controllerhandler.go b/src/orchestrator/api/controllerhandler.go
index 4f98c023..1dad2bf8 100644
--- a/src/orchestrator/api/controllerhandler.go
+++ b/src/orchestrator/api/controllerhandler.go
@@ -22,7 +22,9 @@ import (
"net/http"
"github.com/gorilla/mux"
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/validation"
moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module"
+ pkgerrors "github.com/pkg/errors"
)
// Used to store backend implementations objects
@@ -33,6 +35,43 @@ type controllerHandler struct {
client moduleLib.ControllerManager
}
+// Check for valid format of input parameters
+func validateControllerInputs(c moduleLib.Controller) error {
+ // validate metadata
+ err := moduleLib.IsValidMetadata(c.Metadata)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Invalid controller metadata")
+ }
+
+ errs := validation.IsValidName(c.Spec.Host)
+ if len(errs) > 0 {
+ return pkgerrors.Errorf("Invalid host name for controller %v, errors: %v", c.Spec.Host, errs)
+ }
+
+ errs = validation.IsValidNumber(c.Spec.Port, 0, 65535)
+ if len(errs) > 0 {
+ return pkgerrors.Errorf("Invalid controller port [%v], errors: %v", c.Spec.Port, errs)
+ }
+
+ found := false
+ for _, val := range moduleLib.CONTROLLER_TYPES {
+ if c.Spec.Type == val {
+ found = true
+ break
+ }
+ }
+ if !found {
+ return pkgerrors.Errorf("Invalid controller type: %v", c.Spec.Type)
+ }
+
+ errs = validation.IsValidNumber(c.Spec.Priority, moduleLib.MinControllerPriority, moduleLib.MaxControllerPriority)
+ if len(errs) > 0 {
+ return pkgerrors.Errorf("Invalid controller priority = [%v], errors: %v", c.Spec.Priority, errs)
+ }
+
+ return nil
+}
+
// Create handles creation of the controller entry in the database
func (h controllerHandler) createHandler(w http.ResponseWriter, r *http.Request) {
var m moduleLib.Controller
@@ -48,12 +87,12 @@ func (h controllerHandler) createHandler(w http.ResponseWriter, r *http.Request)
}
// Name is required.
- if m.Name == "" {
+ if m.Metadata.Name == "" {
http.Error(w, "Missing name in POST request", http.StatusBadRequest)
return
}
- ret, err := h.client.CreateController(m)
+ ret, err := h.client.CreateController(m, false)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -68,19 +107,74 @@ func (h controllerHandler) createHandler(w http.ResponseWriter, r *http.Request)
}
}
-// Get handles GET operations on a particular controller Name
-// Returns a controller
-func (h controllerHandler) getHandler(w http.ResponseWriter, r *http.Request) {
+// Put handles creation or update of the controller entry in the database
+func (h controllerHandler) putHandler(w http.ResponseWriter, r *http.Request) {
+ var m moduleLib.Controller
vars := mux.Vars(r)
name := vars["controller-name"]
- ret, err := h.client.GetController(name)
+ err := json.NewDecoder(r.Body).Decode(&m)
+ switch {
+ case err == io.EOF:
+ http.Error(w, "Empty body", http.StatusBadRequest)
+ return
+ case err != nil:
+ http.Error(w, err.Error(), http.StatusUnprocessableEntity)
+ return
+ }
+
+ // Name is required.
+ if m.Metadata.Name == "" {
+ http.Error(w, "Missing name in POST request", http.StatusBadRequest)
+ return
+ }
+
+ // name in URL should match name in body
+ if m.Metadata.Name != name {
+ http.Error(w, "Mismatched name in PUT request", http.StatusBadRequest)
+ return
+ }
+
+ ret, err := h.client.CreateController(m, true)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusCreated)
+ err = json.NewEncoder(w).Encode(ret)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+}
+
+// Get handles GET operations on a particular controller Name
+// Returns a controller
+func (h controllerHandler) getHandler(w http.ResponseWriter, r *http.Request) {
+ vars := mux.Vars(r)
+ name := vars["controller-name"]
+ var ret interface{}
+ var err error
+
+ // handle the get all controllers case
+ if len(name) == 0 {
+ ret, err = h.client.GetControllers()
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ } else {
+
+ ret, err = h.client.GetController(name)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ }
+
+ w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
err = json.NewEncoder(w).Encode(ret)
if err != nil {
diff --git a/src/orchestrator/api/controllerhandler_test.go b/src/orchestrator/api/controllerhandler_test.go
index 3c543cb8..a2f93ea7 100644
--- a/src/orchestrator/api/controllerhandler_test.go
+++ b/src/orchestrator/api/controllerhandler_test.go
@@ -40,7 +40,7 @@ type mockControllerManager struct {
Err error
}
-func (m *mockControllerManager) CreateController(inp moduleLib.Controller) (moduleLib.Controller, error) {
+func (m *mockControllerManager) CreateController(inp moduleLib.Controller, mayExist bool) (moduleLib.Controller, error) {
if m.Err != nil {
return moduleLib.Controller{}, m.Err
}
@@ -56,6 +56,14 @@ func (m *mockControllerManager) GetController(name string) (moduleLib.Controller
return m.Items[0], nil
}
+func (m *mockControllerManager) GetControllers() ([]moduleLib.Controller, error) {
+ if m.Err != nil {
+ return []moduleLib.Controller{}, m.Err
+ }
+
+ return m.Items, nil
+}
+
func (m *mockControllerManager) DeleteController(name string) error {
return m.Err
}
@@ -77,22 +85,33 @@ func TestControllerCreateHandler(t *testing.T) {
label: "Create Controller",
expectedCode: http.StatusCreated,
reader: bytes.NewBuffer([]byte(`{
- "name":"testController",
+ "metadata": {
+ "name":"testController"
+ },
+ "spec": {
"ip-address":"10.188.234.1",
- "port":8080
+ "port":8080 }
}`)),
expected: moduleLib.Controller{
- Name: "testController",
- Host: "10.188.234.1",
- Port: 8080,
+ Metadata: moduleLib.Metadata{
+ Name: "testController",
+ },
+ Spec: moduleLib.ControllerSpec{
+ Host: "10.188.234.1",
+ Port: 8080,
+ },
},
controllerClient: &mockControllerManager{
//Items that will be returned by the mocked Client
Items: []moduleLib.Controller{
{
- Name: "testController",
- Host: "10.188.234.1",
- Port: 8080,
+ Metadata: moduleLib.Metadata{
+ Name: "testController",
+ },
+ Spec: moduleLib.ControllerSpec{
+ Host: "10.188.234.1",
+ Port: 8080,
+ },
},
},
},
@@ -144,17 +163,25 @@ func TestControllerGetHandler(t *testing.T) {
label: "Get Controller",
expectedCode: http.StatusOK,
expected: moduleLib.Controller{
- Name: "testController",
- Host: "10.188.234.1",
- Port: 8080,
+ Metadata: moduleLib.Metadata{
+ Name: "testController",
+ },
+ Spec: moduleLib.ControllerSpec{
+ Host: "10.188.234.1",
+ Port: 8080,
+ },
},
name: "testController",
controllerClient: &mockControllerManager{
Items: []moduleLib.Controller{
{
- Name: "testController",
- Host: "10.188.234.1",
- Port: 8080,
+ Metadata: moduleLib.Metadata{
+ Name: "testController",
+ },
+ Spec: moduleLib.ControllerSpec{
+ Host: "10.188.234.1",
+ Port: 8080,
+ },
},
},
},
diff --git a/src/orchestrator/pkg/appcontext/appcontext.go b/src/orchestrator/pkg/appcontext/appcontext.go
index bad5fa47..17afda9e 100644
--- a/src/orchestrator/pkg/appcontext/appcontext.go
+++ b/src/orchestrator/pkg/appcontext/appcontext.go
@@ -18,6 +18,8 @@ package appcontext
import (
"fmt"
+ "strings"
+
"github.com/onap/multicloud-k8s/src/orchestrator/pkg/rtcontext"
pkgerrors "github.com/pkg/errors"
)
@@ -160,6 +162,36 @@ func (ac *AppContext) GetClusterHandle(appname string, clustername string) (inte
return nil, pkgerrors.Errorf("No handle was found for the given cluster")
}
+//Returns a list of all clusters for a given app
+func (ac *AppContext) GetClusterNames(appname string) ([]string, error) {
+ if appname == "" {
+ return nil, pkgerrors.Errorf("Not a valid run time context app name")
+ }
+
+ rh, err := ac.rtc.RtcGet()
+ if err != nil {
+ return nil, err
+ }
+
+ prefix := fmt.Sprintf("%v", rh) + "app/" + appname + "/cluster/"
+ hs, err := ac.rtc.RtcGetHandles(prefix)
+ if err != nil {
+ return nil, pkgerrors.Errorf("Error getting handles for %v", prefix)
+ }
+ var cs []string
+ for _, h := range hs {
+ hstr := fmt.Sprintf("%v", h)
+ ks := strings.Split(hstr, prefix)
+ for _, k := range ks {
+ ck := strings.Split(k, "/")
+ if len(ck) == 2 && ck[1] == "" {
+ cs = append(cs, ck[0])
+ }
+ }
+ }
+ return cs, nil
+}
+
//Add resource under app and cluster
func (ac *AppContext) AddResource(handle interface{}, resname string, value interface{}) (interface{}, error) {
h, err := ac.rtc.RtcAddResource(handle, resname, value)
diff --git a/src/orchestrator/pkg/infra/validation/validation.go b/src/orchestrator/pkg/infra/validation/validation.go
index 448ea5de..c43d29ec 100644
--- a/src/orchestrator/pkg/infra/validation/validation.go
+++ b/src/orchestrator/pkg/infra/validation/validation.go
@@ -23,6 +23,7 @@ import (
"io"
"net"
"regexp"
+ "strconv"
"strings"
pkgerrors "github.com/pkg/errors"
@@ -280,6 +281,28 @@ func IsValidNumber(value, min, max int) []string {
return errs
}
+func IsValidNumberStr(value string, min, max int) []string {
+ var errs []string
+
+ if min > max {
+ errs = append(errs, "invalid constraints")
+ return errs
+ }
+
+ n, err := strconv.Atoi(value)
+ if err != nil {
+ errs = append(errs, err.Error())
+ return errs
+ }
+ if n < min {
+ errs = append(errs, "value less than minimum")
+ }
+ if n > max {
+ errs = append(errs, "value greater than maximum")
+ }
+ return errs
+}
+
/*
IsValidParameterPresent method takes in a vars map and a array of string parameters
that you expect to be present in the GET request.
diff --git a/src/orchestrator/pkg/module/controller.go b/src/orchestrator/pkg/module/controller.go
index 35d6f892..976b8988 100644
--- a/src/orchestrator/pkg/module/controller.go
+++ b/src/orchestrator/pkg/module/controller.go
@@ -27,13 +27,24 @@ import (
// Controller contains the parameters needed for Controllers
// It implements the interface for managing the Controllers
type Controller struct {
- Name string `json:"name"`
-
- Host string `json:"host"`
+ Metadata Metadata `json:"metadata"`
+ Spec ControllerSpec `json:"spec"`
+}
- Port int64 `json:"port"`
+type ControllerSpec struct {
+ Host string `json:"host"`
+ Port int `json:"port"`
+ Type string `json:"type"`
+ Priority int `json:"priority"`
}
+const MinControllerPriority = 1
+const MaxControllerPriority = 1000000
+const CONTROLLER_TYPE_ACTION string = "action"
+const CONTROLLER_TYPE_PLACEMENT string = "placement"
+
+var CONTROLLER_TYPES = [...]string{CONTROLLER_TYPE_ACTION, CONTROLLER_TYPE_PLACEMENT}
+
// ControllerKey is the key structure that is used in the database
type ControllerKey struct {
ControllerName string `json:"controller-name"`
@@ -52,8 +63,9 @@ func (mk ControllerKey) String() string {
// ControllerManager is an interface exposes the Controller functionality
type ControllerManager interface {
- CreateController(ms Controller) (Controller, error)
+ CreateController(ms Controller, mayExist bool) (Controller, error)
GetController(name string) (Controller, error)
+ GetControllers() ([]Controller, error)
DeleteController(name string) error
}
@@ -74,20 +86,20 @@ func NewControllerClient() *ControllerClient {
}
// CreateController a new collection based on the Controller
-func (mc *ControllerClient) CreateController(m Controller) (Controller, error) {
+func (mc *ControllerClient) CreateController(m Controller, mayExist bool) (Controller, error) {
//Construct the composite key to select the entry
key := ControllerKey{
- ControllerName: m.Name,
+ ControllerName: m.Metadata.Name,
}
//Check if this Controller already exists
- _, err := mc.GetController(m.Name)
- if err == nil {
+ _, err := mc.GetController(m.Metadata.Name)
+ if err == nil && !mayExist {
return Controller{}, pkgerrors.New("Controller already exists")
}
- err = db.DBconn.Create(mc.collectionName, key, mc.tagMeta, m)
+ err = db.DBconn.Insert(mc.collectionName, key, nil, mc.tagMeta, m)
if err != nil {
return Controller{}, pkgerrors.Wrap(err, "Creating DB Entry")
}
@@ -102,15 +114,14 @@ func (mc *ControllerClient) GetController(name string) (Controller, error) {
key := ControllerKey{
ControllerName: name,
}
- value, err := db.DBconn.Read(mc.collectionName, key, mc.tagMeta)
+ value, err := db.DBconn.Find(mc.collectionName, key, mc.tagMeta)
if err != nil {
return Controller{}, pkgerrors.Wrap(err, "Get Controller")
}
- //value is a byte array
if value != nil {
microserv := Controller{}
- err = db.DBconn.Unmarshal(value, &microserv)
+ err = db.DBconn.Unmarshal(value[0], &microserv)
if err != nil {
return Controller{}, pkgerrors.Wrap(err, "Unmarshaling Value")
}
@@ -120,6 +131,42 @@ func (mc *ControllerClient) GetController(name string) (Controller, error) {
return Controller{}, pkgerrors.New("Error getting Controller")
}
+// GetControllers returns all the Controllers that are registered
+func (mc *ControllerClient) GetControllers() ([]Controller, error) {
+
+ //Construct the composite key to select the entry
+ key := ControllerKey{
+ ControllerName: "",
+ }
+
+ var resp []Controller
+ values, err := db.DBconn.Find(mc.collectionName, key, mc.tagMeta)
+ if err != nil {
+ return []Controller{}, pkgerrors.Wrap(err, "Get Controller")
+ }
+
+ for _, value := range values {
+ microserv := Controller{}
+ err = db.DBconn.Unmarshal(value, &microserv)
+ if err != nil {
+ return []Controller{}, pkgerrors.Wrap(err, "Unmarshaling Value")
+ }
+
+ // run healthcheck
+ /*
+ err = mc.HealthCheck(microserv.Name)
+ if err != nil {
+ log.Warn("HealthCheck Failed", log.Fields{
+ "Controller": microserv.Name,
+ })
+ }
+ */
+ resp = append(resp, microserv)
+ }
+
+ return resp, nil
+}
+
// DeleteController the Controller from database
func (mc *ControllerClient) DeleteController(name string) error {
@@ -127,7 +174,7 @@ func (mc *ControllerClient) DeleteController(name string) error {
key := ControllerKey{
ControllerName: name,
}
- err := db.DBconn.Delete(name, key, mc.tagMeta)
+ err := db.DBconn.Remove(mc.collectionName, key)
if err != nil {
return pkgerrors.Wrap(err, "Delete Controller Entry;")
}
diff --git a/src/orchestrator/pkg/module/controller_test.go b/src/orchestrator/pkg/module/controller_test.go
index 2e783c13..a13f43a5 100644
--- a/src/orchestrator/pkg/module/controller_test.go
+++ b/src/orchestrator/pkg/module/controller_test.go
@@ -37,14 +37,22 @@ func TestCreateController(t *testing.T) {
{
label: "Create Controller",
inp: Controller{
- Name: "testController",
- Host: "132.156.0.10",
- Port: 8080,
+ Metadata: Metadata{
+ Name: "testController",
+ },
+ Spec: ControllerSpec{
+ Host: "132.156.0.10",
+ Port: 8080,
+ },
},
expected: Controller{
- Name: "testController",
- Host: "132.156.0.10",
- Port: 8080,
+ Metadata: Metadata{
+ Name: "testController",
+ },
+ Spec: ControllerSpec{
+ Host: "132.156.0.10",
+ Port: 8080,
+ },
},
expectedError: "",
mockdb: &db.MockDB{},
@@ -62,7 +70,7 @@ func TestCreateController(t *testing.T) {
t.Run(testCase.label, func(t *testing.T) {
db.DBconn = testCase.mockdb
impl := NewControllerClient()
- got, err := impl.CreateController(testCase.inp)
+ got, err := impl.CreateController(testCase.inp, false)
if err != nil {
if testCase.expectedError == "" {
t.Fatalf("Create returned an unexpected error %s", err)
@@ -94,18 +102,25 @@ func TestGetController(t *testing.T) {
label: "Get Controller",
name: "testController",
expected: Controller{
- Name: "testController",
- Host: "132.156.0.10",
- Port: 8080,
+ Metadata: Metadata{
+ Name: "testController",
+ },
+ Spec: ControllerSpec{
+ Host: "132.156.0.10",
+ Port: 8080,
+ },
},
expectedError: "",
mockdb: &db.MockDB{
Items: map[string]map[string][]byte{
ControllerKey{ControllerName: "testController"}.String(): {
"controllermetadata": []byte(
- "{\"name\":\"testController\"," +
+ "{\"metadata\":{" +
+ "\"name\":\"testController\"" +
+ "}," +
+ "\"spec\":{" +
"\"host\":\"132.156.0.10\"," +
- "\"port\":8080}"),
+ "\"port\": 8080 }}"),
},
},
},
diff --git a/src/orchestrator/pkg/module/module.go b/src/orchestrator/pkg/module/module.go
index e05b8753..463a55b3 100644
--- a/src/orchestrator/pkg/module/module.go
+++ b/src/orchestrator/pkg/module/module.go
@@ -16,6 +16,11 @@
package module
+import (
+ "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/validation"
+ pkgerrors "github.com/pkg/errors"
+)
+
// Client for using the services in the orchestrator
type Client struct {
Project *ProjectClient
@@ -49,3 +54,39 @@ func NewClient() *Client {
c.Instantiation = NewInstantiationClient()
return c
}
+
+// It implements the interface for managing the ClusterProviders
+const MAX_DESCRIPTION_LEN int = 1024
+const MAX_USERDATA_LEN int = 4096
+
+type Metadata struct {
+ Name string `json:"name" yaml:"name"`
+ Description string `json:"description" yaml:"-"`
+ UserData1 string `json:"userData1" yaml:"-"`
+ UserData2 string `json:"userData2" yaml:"-"`
+}
+
+// Check for valid format Metadata
+func IsValidMetadata(metadata Metadata) error {
+ errs := validation.IsValidName(metadata.Name)
+ if len(errs) > 0 {
+ return pkgerrors.Errorf("Invalid Metadata name=[%v], errors: %v", metadata.Name, errs)
+ }
+
+ errs = validation.IsValidString(metadata.Description, 0, MAX_DESCRIPTION_LEN, validation.VALID_ANY_STR)
+ if len(errs) > 0 {
+ return pkgerrors.Errorf("Invalid Metadata description=[%v], errors: %v", metadata.Description, errs)
+ }
+
+ errs = validation.IsValidString(metadata.UserData1, 0, MAX_DESCRIPTION_LEN, validation.VALID_ANY_STR)
+ if len(errs) > 0 {
+ return pkgerrors.Errorf("Invalid Metadata description=[%v], errors: %v", metadata.UserData1, errs)
+ }
+
+ errs = validation.IsValidString(metadata.UserData2, 0, MAX_DESCRIPTION_LEN, validation.VALID_ANY_STR)
+ if len(errs) > 0 {
+ return pkgerrors.Errorf("Invalid Metadata description=[%v], errors: %v", metadata.UserData2, errs)
+ }
+
+ return nil
+}