From b2c9f4c61d00bf18e7a253c410479f8124640106 Mon Sep 17 00:00:00 2001 From: Rajamohan Raj Date: Wed, 26 Aug 2020 00:28:12 +0000 Subject: Adding validations for all JSON data across modules Issue-ID: MULTICLOUD-1198 Signed-off-by: Rajamohan Raj Change-Id: Idc2fbfd6e875bd7b662c7d60925aeb776b3f7bea --- src/tools/emcoctl/Readme.md | 131 +++++++++++++++++++++++++++++++ src/tools/emcoctl/examples/emco-cfg.yaml | 6 +- src/tools/emcoctl/examples/test.yaml | 17 ++-- src/tools/emcoctl/examples/vfw.yaml | 34 ++++---- 4 files changed, 161 insertions(+), 27 deletions(-) (limited to 'src/tools') diff --git a/src/tools/emcoctl/Readme.md b/src/tools/emcoctl/Readme.md index ecbcf4de..105398c1 100644 --- a/src/tools/emcoctl/Readme.md +++ b/src/tools/emcoctl/Readme.md @@ -84,3 +84,134 @@ For deleting one resource anchor can be provided as an arguement `$ emcoctl delete ` `$ emcoctl delete projects/testvfw/composite-apps/compositevfw/v1/deployment-intent-groups/vfw_deployment_intent_group` + + +## Using helm charts through emcoctl + +When you need to use emcoctl for deploying helm +charts the following steps are required. + +1. Make sure that the composite app which you are planning to deploy, the tree structure is as below + +``` + +$ tree collection/app1/ +collection/app1/ +├── helm +│   └── collectd +│   ├── Chart.yaml +│   ├── resources +│   │   └── collectd.conf +│   ├── templates +│   │   ├── configmap.yaml +│   │   ├── daemonset.yaml +│   │   ├── _helpers.tpl +│   │   ├── NOTES.txt +│   │   └── service.yaml +│   └── values.yaml +└── profile + ├── manifest.yaml + └── override_values.yaml + +5 directories, 10 files + +$ tree collection/m3db/ +collection/m3db/ +├── helm +│   └── m3db +│   ├── Chart.yaml +│   ├── del.yaml +│   ├── templates +│   │   └── m3dbcluster.yaml +│   └── values.yaml +└── profile + ├── manifest.yaml + └── override_values.yaml + +4 directories, 6 files + +``` + +### NOTE +``` +* In the above example, we have a composite app : collection +The collection composite-app shown has two apps : app1(collectd) +and m3db +* Each app has two dirs : a. HELM and b. PROFILE. +* Helm dir shall have the real helm charts of the app. +* profile shall have the two files - manifest.yaml and override_values.yaml for creating the customized profile. +``` + +### Commands for making the tar files from helm. + +``` + tar -czf collectd.tar.gz -C $test_folder/vnfs/comp-app/collection/app1/helm . + tar -czf collectd_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/app1/profile . + ---------------------------------------- + tar -czf m3db.tar.gz -C $test_folder/vnfs/comp-app/collection/m3db/helm . + tar -czf m3db_profile.tar.gz -C $test_folder/vnfs/comp-app/collection/m3db/profile . +``` + +Once you have generated the tar files, you need to give the path in file which you are applying using the emcoctl. For eg: + +``` +#adding collectd app to the composite app +version: emco/v2 +resourceContext: + anchor: projects/proj1/composite-apps/collection-composite-app/v1/apps +metadata : + name: collectd + description: "description for app" + userData1: test1 + userData2: test2 +file: + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/collectd.tar.gz + +``` + +``` +#adding collectd app profiles to the composite profile +version: emco/v2 +resourceContext: + anchor: projects/proj1/composite-apps/collection-composite-app/v1/composite-profiles/collection-composite-profile/profiles +metadata : + name: collectd-profile + description: test + userData1: test1 + userData2: test2 +spec: + app-name: collectd +file: + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/collectd_profile.tar.gz + +``` + +### Running the emcoctl + +``` +* Make sure that the emcoctl is build.You can build it by issuing the 'make' command. +Dir : $MULTICLOUD-K8s_HOME/src/tools/emcoctl +``` +* Then run the emcoctl by command: +``` +./emcoctl --config ./examples/emco-cfg.yaml apply -f ./examples/test.yaml + +``` + +Here, emco-cfg.yaml contains the config/port details of each of the microservices you are using. +A sample configuration is : + +``` + orchestrator: + host: localhost + port: 9015 + clm: + host: localhost + port: 9019 + ncm: + host: localhost + port: 9016 + ovnaction: + host: localhost + port: 9051 +``` diff --git a/src/tools/emcoctl/examples/emco-cfg.yaml b/src/tools/emcoctl/examples/emco-cfg.yaml index c1703def..a7e284ab 100644 --- a/src/tools/emcoctl/examples/emco-cfg.yaml +++ b/src/tools/emcoctl/examples/emco-cfg.yaml @@ -3,10 +3,10 @@ port: 9015 clm: host: localhost - port: 9061 + port: 9019 ncm: host: localhost - port: 9031 + port: 9016 ovnaction: host: localhost - port: 9051 \ No newline at end of file + port: 9018 diff --git a/src/tools/emcoctl/examples/test.yaml b/src/tools/emcoctl/examples/test.yaml index 924f7e55..e54ff36e 100644 --- a/src/tools/emcoctl/examples/test.yaml +++ b/src/tools/emcoctl/examples/test.yaml @@ -33,7 +33,7 @@ metadata : userData1: test1 userData2: test2 file: - kubeconfig + /home/otc/.kube/config --- #Add label cluster @@ -77,7 +77,7 @@ metadata : userData1: test1 userData2: test2 file: - prometheus-operator.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/prometheus-operator.tar.gz --- #adding collectd app to the composite app @@ -90,7 +90,7 @@ metadata : userData1: test1 userData2: test2 file: - collectd.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/collectd.tar.gz --- #creating collection composite profile entry @@ -116,7 +116,9 @@ metadata : spec: app-name: prometheus-operator file: - prometheus-operator_profile.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/prometheus-operator_profile.tar.gz + + --- #adding collectd app profiles to the composite profile @@ -131,7 +133,8 @@ metadata : spec: app-name: collectd file: - collectd_profile.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/collectd_profile.tar.gz + --- #create the generic placement intent @@ -160,7 +163,7 @@ spec: app-name: prometheus-operator intent: allOf: - - provider-name: cluster-provider1 + - provider-name: provider1 cluster-label-name: edge-cluster --- #add the prometheus app placement intent to the generic placement intent @@ -176,7 +179,7 @@ spec: app-name: collectd intent: allOf: - - provider-name: cluster-provider1 + - provider-name: provider1 cluster-label-name: edge-cluster --- diff --git a/src/tools/emcoctl/examples/vfw.yaml b/src/tools/emcoctl/examples/vfw.yaml index b5df4834..c84a1bab 100644 --- a/src/tools/emcoctl/examples/vfw.yaml +++ b/src/tools/emcoctl/examples/vfw.yaml @@ -38,7 +38,7 @@ resourceContext: metadata : name: edge01 file: - kubeconfig + /home/otc/.kube/config --- #Add label cluster @@ -89,7 +89,7 @@ spec: --- version: emco/v2 resourceContext: - anchor: cluster-providers/vfw-cluster-provider/clusters/edge01/apply + anchor: cluster-providers/vfw-cluster-provider/clusters/edge01/apply --- #create project @@ -100,7 +100,7 @@ metadata : name: testvfw --- -#creating collection composite app entry +#creating vfw composite app entry version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps @@ -110,37 +110,37 @@ spec: version: v1 --- -#adding prometheus app to the composite app +#adding packetgen app to the composite app version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps/compositevfw/v1/apps metadata : name: packetgen file: - /home/vagrant/multicloud-k8s/kud/demo/composite-firewall/packetgen.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/packetgen.tar.gz --- -#adding prometheus app to the composite app +#adding firewall app to the composite app version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps/compositevfw/v1/apps metadata : name: firewall file: - /home/vagrant/multicloud-k8s/kud/demo/composite-firewall/firewall.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/firewall.tar.gz --- -#adding collectd app to the composite app +#adding sink app to the composite app version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps/compositevfw/v1/apps metadata : name: sink file: - /home/vagrant/multicloud-k8s/kud/demo/composite-firewall/sink.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/sink.tar.gz --- -#creating collection composite profile entry +#creating vfw composite profile entry version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps/compositevfw/v1/composite-profiles @@ -148,7 +148,7 @@ metadata : name: vfw_composite-profile --- -#adding prometheus app profiles to the composite profile +#adding packetgen app profiles to the composite profile version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps/compositevfw/v1/composite-profiles/vfw_composite-profile/profiles @@ -157,7 +157,7 @@ metadata : spec: app-name: packetgen file: - /home/vagrant/multicloud-k8s/kud/demo/composite-firewall/profile.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/profile.tar.gz --- #adding firewall app profiles to the composite profile @@ -169,7 +169,7 @@ metadata : spec: app-name: firewall file: - /home/vagrant/multicloud-k8s/kud/demo/composite-firewall/profile.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/profile.tar.gz --- #adding firewall app profiles to the composite profile @@ -181,7 +181,7 @@ metadata : spec: app-name: sink file: - /home/vagrant/multicloud-k8s/kud/demo/composite-firewall/profile.tar.gz + /opt/csar/cb009bfe-bbee-11e8-9766-525400435678/profile.tar.gz --- #create the generic placement intent @@ -194,7 +194,7 @@ spec: logical-cloud: NA --- -#add the prometheus app placement intent to the generic placement intent +#add the packetgen app placement intent to the generic placement intent version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps/compositevfw/v1/generic-placement-intents/fw-placement-intent/app-intents @@ -207,7 +207,7 @@ spec: - provider-name: vfw-cluster-provider cluster-label-name: LabelA --- -#add the prometheus app placement intent to the generic placement intent +#add the firewall app placement intent to the generic placement intent version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps/compositevfw/v1/generic-placement-intents/fw-placement-intent/app-intents @@ -221,7 +221,7 @@ spec: cluster-label-name: LabelA --- -#add the prometheus app placement intent to the generic placement intent +#add the sink app placement intent to the generic placement intent version: emco/v2 resourceContext: anchor: projects/testvfw/composite-apps/compositevfw/v1/generic-placement-intents/fw-placement-intent/app-intents -- cgit 1.2.3-korg