aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/lib/files
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2017-12-18 09:56:13 -0800
committerVictor Morales <victor.morales@intel.com>2017-12-23 03:22:34 -0500
commitfa9eb9c5c50ca147504cb97226007b82f6909b8a (patch)
tree5a1b962e79074f796c441e37612d6a9587d47460 /bootstrap/vagrant-onap/lib/files
parentf1ffdbc27f2cd05b487c7857362bf2018a513b21 (diff)
Add OOM provisioning script
The instructions to provision a ONAP Operations Manager environment was included into the vagrant-onap tool. This script requires a specific docker version besides some tasks that wait for certain services. Change-Id: I39f0b7947e7c87d8aa44ffa93cdb414d700379bd Signed-off-by: Victor Morales <victor.morales@intel.com> Co-Authored-By: Shashank Kumar Shankar <shashank.kumar.shankar@intel.com> Issue-ID: INT-370
Diffstat (limited to 'bootstrap/vagrant-onap/lib/files')
-rw-r--r--bootstrap/vagrant-onap/lib/files/kubectl_config_generator.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/bootstrap/vagrant-onap/lib/files/kubectl_config_generator.py b/bootstrap/vagrant-onap/lib/files/kubectl_config_generator.py
new file mode 100644
index 000000000..6b5a6e9f6
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/files/kubectl_config_generator.py
@@ -0,0 +1,40 @@
+import requests
+import os
+import base64
+
+RANCHER_URL = str(os.environ['RANCHER_URL'])
+RANCHER_ENVIRONMENT_ID = str(os.environ['RANCHER_ENVIRONMENT'])
+data = requests.post(RANCHER_URL + '/v1/projects/' + RANCHER_ENVIRONMENT_ID + '/apikeys',
+ {"accountId": RANCHER_ENVIRONMENT_ID,
+ "description": "ONAP on Kubernetes",
+ "name": "ONAP on Kubernetes",
+ "publicValue": "string",
+ "secretValue": "password"})
+json_dct = data.json()
+access_key = json_dct['publicValue']
+secret_key = json_dct['secretValue']
+auth_header = 'Basic ' + base64.b64encode(access_key + ':' + secret_key)
+token = "\"" + str(base64.b64encode(auth_header)) + "\""
+dct = \
+"""
+apiVersion: v1
+kind: Config
+clusters:
+- cluster:
+ api-version: v1
+ insecure-skip-tls-verify: true
+ server: "{}/r/projects/{}/kubernetes:6443"
+ name: "onap_on_kubernetes"
+contexts:
+- context:
+ cluster: "onap_on_kubernetes"
+ user: "onap_on_kubernetes"
+ name: "onap_on_kubernetes"
+current-context: "onap_on_kubernetes"
+users:
+- name: "onap_on_kubernetes"
+ user:
+ token: {}
+""".format(RANCHER_URL, RANCHER_ENVIRONMENT_ID, token)
+with open("config", "w") as file:
+ file.write(dct)