summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Wolczanski <marek.wolczanski@cloudify.co>2017-10-03 14:55:19 +0200
committerMarek Wolczanski <marek.wolczanski@cloudify.co>2017-10-03 15:27:26 +0200
commit63f2cc936ed6e6790f287195694f6d067decdd89 (patch)
treee79b62b7fc3e099708b6707454b4c52ee3e581da
parentb9644b17f8545dedd3ede40f778b33f9b4ecf480 (diff)
Cloudify support for OOM
Issue-ID: OOM-106 Change-Id: Ie0a37ef378fd1907825da181c81502c6fbe9134c Signed-off-by: Marek Wolczanski <marek.wolczanski@cloudify.co>
-rw-r--r--cloudify-onap/blueprint.yaml188
-rw-r--r--cloudify-onap/docker-custom-readiness/Dockerfile21
-rw-r--r--cloudify-onap/docker-custom-readiness/ready.py85
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/__init__.py14
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/app.py47
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/__init__.py14
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/constants.py20
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/deployment_result.py27
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/helm.py62
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/init_pod.py63
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/namespace.py (renamed from cloudify/scripts/onap/create_namespace.py)106
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/resources_services.py230
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/workarounds.py67
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/environment.py58
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/k8s_installer/requirements.txt1
-rwxr-xr-xcloudify-onap/plugins/onap-installation-plugin/plugin.yaml87
-rw-r--r--cloudify-onap/plugins/onap-installation-plugin/requirements.txt1
-rwxr-xr-xcloudify-onap/plugins/onap-installation-plugin/setup.py40
-rw-r--r--cloudify/inputs/message-router-blueprint.yaml.example25
-rw-r--r--cloudify/scripts/configure_node.py49
-rw-r--r--cloudify/scripts/create.py72
-rw-r--r--cloudify/scripts/onap/configure_docker_secret_workaround.py40
-rw-r--r--cloudify/scripts/onap/create_init_pod.py65
-rw-r--r--cloudify/scripts/onap/create_resources_services.py131
-rw-r--r--cloudify/scripts/onap/delete_init_pod.py64
-rw-r--r--cloudify/scripts/onap/delete_namespace.py101
-rw-r--r--cloudify/scripts/onap/delete_resources_services.py132
-rw-r--r--cloudify/scripts/tasks.py24
-rw-r--r--cloudify/types/kubernetes.yaml91
-rw-r--r--cloudify/types/onap.yaml89
-rw-r--r--onap-blueprint.yaml223
31 files changed, 1078 insertions, 1159 deletions
diff --git a/cloudify-onap/blueprint.yaml b/cloudify-onap/blueprint.yaml
new file mode 100644
index 0000000000..96d297dbd3
--- /dev/null
+++ b/cloudify-onap/blueprint.yaml
@@ -0,0 +1,188 @@
+tosca_definitions_version: cloudify_dsl_1_3
+
+description: >
+ Blueprint deploys all ONAP kubernetes resources defined in YAML files on existing kubernetes cluster
+ The following pre-setup steps are assumed, but not required:
+ - Create Cloudify Example Environment: https://github.com/cloudify-examples/cloudify-environment-setup.
+ - Create Kubernetes Cluster: https://github.com/cloudify-examples/simple-kubernetes-blueprint.
+
+imports:
+ - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
+ # Plugin required: https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/releases/download/1.2.1rc1/cloudify_kubernetes_plugin-1.2.1rc1-py27-none-linux_x86_64-centos-Core.wgn
+ - https://raw.githubusercontent.com/cloudify-incubator/cloudify-kubernetes-plugin/1.2.1/plugin.yaml
+# - https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1.zip
+ - plugins/onap-installation-plugin/plugin.yaml
+
+inputs:
+ kubernetes_configuration_file_content:
+ description: >
+ File content of kubernetes master YAML configuration
+ default:
+ apiVersion: v1
+ clusters:
+ - cluster:
+ certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFM01UQXdNakV6TVRNeU4xb1hEVEkzTURrek1ERXpNVE15TjFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTDN4CnRqRllVd25GVmxnNFZhd3BNaFB1N2hDOXVNSEJmUU9JclIrU1B4TElaMUVjTERXdTBod1pWWloxSUF4K0NrQlcKU1BmVDdXSE5zNld4RHAyRUpoVlp2TEFBVW9nem5aSlJnU0Z2RW1NZWg4cXhTaSsrQmtNNmxvTytTTVE0eFJlVApFbTZpd3JrdFZNUXVocDhkVG01MGpIUjMyelBTQklZRGpQejYwWEpzNXp2MEJzL0VlSHRDS0RxV2ZoZWpYZjBECmhQNi9DSU45UjBwNk9UZTdSYUV6dUtlblRtTml0dzNJTkg4b3BhYlY2TW8ycEFvbVRRUG5pZTVZZ2EzNGNndXEKTXpYSmVQUE1CQSs4UDNmS3BFcDJQU3UzWUF3SGg4VWo0MlRDTjMxQ1BBM3F4dUxGejBwOGw5ckJ5WVh6amRybQpwNFZIV1FGOTh3eXBFUW0xNFdVQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFBS3Q2a2E2R04rWksveEx5Nk1tcWpSQTZpa2QKMjYwS3g0ak9FWUtrNWtTemlPOE5Iazhza3JNNzZSVksxdUwxZkFzU0N5SnYyOUJNb3NGQkhISDltOGNBbnFFcgowRGVvdDhHY0d6OWh6ZTlOcGhGNkFNNEhCZTFDbDhkME9vdm91K3dsYk1VTDN4M1hNUHZmMDRKajZsMUJMdEx2Cjh2Nk5Eb0lWdkppS1FLM0tuK3BHUVBZd2x1UEFoSEZQZUdlZ1gvTnBlNXJjMVZGRUtLUkRQRVFRS0xrcE5TZ2IKNzgwZ2ZMTkxJUTJsQnczZHRjazcyelkyK0dlWlp3MEM2ckk5QUhBekg3ZXpZY0pvT2VmVjArZE9zV2lJNVB4UgowZnNYSlNEOVR4SDVVMlRSQ25KZ214M1ZLTGl5OTZyOGsrOTdkWlAvN3h2Q3dGSU9wc2I2UGcxdjNxZz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
+ server: https://192.168.120.5:6443
+ name: kubernetes
+ contexts:
+ - context:
+ cluster: kubernetes
+ user: kubernetes-admin
+ name: kubernetes-admin@kubernetes
+ current-context: kubernetes-admin@kubernetes
+ kind: Config
+ preferences: {}
+ users:
+ - name: kubernetes-admin
+ user:
+ client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJRUFMaVFKV0d2ZmN3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB4TnpFd01ESXhNekV6TWpkYUZ3MHhPREV3TURJeE16RXpNamxhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXVOWFFJSlNzSmdtWndXMTEKcEtRZTV5TkQ1THBUdDY5dENKeEpoWXZPbElUOTRwVmdtVnBLNjhlMUNhQ2YxYkt0N2hCMUFOSVJHam8xMTYxNgpGUVRkaE5Z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PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
+
+ namespace_prefix:
+ type: string
+ description: >
+ Kubernetes namespace name prefix which will be uese for all ONAP apps
+ default: onap
+
+dsl_definitions:
+ options: &app_options
+ namespace:
+ concat: [{ get_input: namespace_prefix }, '-', { get_property: [SELF, name] }]
+
+node_templates:
+ kubernetes_master:
+ type: cloudify.kubernetes.nodes.Master
+ properties:
+ configuration:
+ file_content: { get_input: kubernetes_configuration_file_content }
+
+ onap_environment:
+ type: cloudify.onap.kubernetes.Environment
+ properties:
+ namespace: { get_input: namespace_prefix }
+ init_pod: kubernetes/config
+ options:
+ namespace: { get_input: namespace_prefix }
+ relationships:
+ - type: cloudify.kubernetes.relationships.managed_by_master
+ target: kubernetes_master
+
+# mso_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: mso
+# path: kubernetes/mso
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
+#
+ message_router_app:
+ type: cloudify.onap.kubernetes.App
+ properties:
+ name: message-router
+ path: kubernetes/message-router
+ options: *app_options
+ relationships:
+ - type: cloudify.kubernetes.relationships.managed_by_master
+ target: kubernetes_master
+ - type: cloudify.relationships.depends_on
+ target: onap_environment
+#
+# sdc_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: sdc
+# path: kubernetes/sdc
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
+#
+# aai_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: aai
+# path: kubernetes/aai
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
+#
+# robot_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: robot
+# path: kubernetes/robot
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
+#
+# vid_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: vid
+# path: kubernetes/vid
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
+#
+# sdnc_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: sdnc
+# path: kubernetes/sdnc
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
+#
+# portal_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: portal
+# path: kubernetes/portal
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
+#
+# policy_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: policy
+# path: kubernetes/policy
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
+#
+# appc_app:
+# type: cloudify.onap.kubernetes.App
+# properties:
+# name: appc
+# path: kubernetes/appc
+# options: *app_options
+# relationships:
+# - type: cloudify.kubernetes.relationships.managed_by_master
+# target: kubernetes_master
+# - type: cloudify.relationships.depends_on
+# target: onap_environment
diff --git a/cloudify-onap/docker-custom-readiness/Dockerfile b/cloudify-onap/docker-custom-readiness/Dockerfile
new file mode 100644
index 0000000000..d42456d336
--- /dev/null
+++ b/cloudify-onap/docker-custom-readiness/Dockerfile
@@ -0,0 +1,21 @@
+from ubuntu:16.04
+
+ENV no_proxy "localhost,127.0.0.1,.cluster.local,$KUBERNETES_SERVICE_HOST"
+# Setup Corporate proxy
+ENV https_proxy ${HTTPS_PROXY}
+ENV http_proxy ${HTTP_PROXY}
+
+# Additional packages
+RUN apt-get update
+RUN apt-get install -y apt-utils git wget curl dnsutils python python-pip jq net-tools coreutils vim
+
+RUN pip install requests pyyaml kubernetes==1.0.2
+
+
+ENV CERT="/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
+ENV TOKEN="/var/run/secrets/kubernetes.io/serviceaccount/token"
+
+COPY ready.py /root/ready.py
+RUN chmod a+x /root/ready.py
+#ENTRYPOINT /root/ready.py
+
diff --git a/cloudify-onap/docker-custom-readiness/ready.py b/cloudify-onap/docker-custom-readiness/ready.py
new file mode 100644
index 0000000000..22b24d345d
--- /dev/null
+++ b/cloudify-onap/docker-custom-readiness/ready.py
@@ -0,0 +1,85 @@
+#!/usr/bin/python
+#from kubernetes import client, config
+import kubernetes
+import time, argparse, logging, sys, os, base64
+import yaml
+
+#setup logging
+log = logging.getLogger(__name__)
+handler = logging.StreamHandler(sys.stdout)
+handler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s'))
+handler.setLevel(logging.DEBUG)
+log.addHandler(handler)
+log.setLevel(logging.DEBUG)
+
+
+def is_ready(container_name):
+ log.info( "Checking if " + container_name + " is ready")
+
+ kubernetes.config.kube_config.KubeConfigLoader(config_dict=get_k8s_config_env()).load_and_set()
+ client = kubernetes.client
+ namespace = get_namespace_env()
+ v1 = client.CoreV1Api()
+
+ ready = False
+
+ try:
+ response = v1.list_namespaced_pod(namespace=namespace, watch=False)
+ for i in response.items:
+ for s in i.status.container_statuses:
+ if s.name == container_name:
+ log.debug ( "response %s" % response )
+ ready = s.ready
+ if not ready:
+ log.info( container_name + " is not ready.")
+ else:
+ log.info( container_name + " is ready!")
+ else:
+ continue
+ return ready
+ except Exception as e:
+ log.error("Exception when calling list_namespaced_pod: %s\n" % e)
+
+
+def get_k8s_config_env():
+ try:
+ k8s_config_env = os.environ.get("K8S_CONFIG_B64")
+ decoded = base64.b64decode(k8s_config_env)
+ return yaml.load(decoded)
+ except KeyError as ke:
+ raise Exception("K8S_CONFIG_B64 variable is not set.")
+
+
+def get_namespace_env():
+ try:
+ namespace_env = os.environ.get("NAMESPACE")
+ return namespace_env
+ except KeyError as ke:
+ raise Exception("NAMESPACE variable is not set.")
+
+
+def main(args):#from kubernetes import client, config
+
+ # args are a list of container names
+ for container_name in args:
+ # 5 min, TODO: make configurable
+ timeout = time.time() + 60 * 10
+ while True:
+ ready = is_ready(container_name)
+ if ready is True:
+ break
+ elif time.time() > timeout:
+ log.warning( "timed out waiting for '" + container_name + "' to be ready")
+ exit(1)
+ else:
+ time.sleep(5)
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description='Process some names.')
+ parser.add_argument('--container-name', action='append', required=True, help='A container name')
+ args = parser.parse_args()
+ arg_dict = vars(args)
+
+ for arg in arg_dict.itervalues():
+ main(arg)
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/__init__.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/__init__.py
new file mode 100644
index 0000000000..19a30ba43d
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/__init__.py
@@ -0,0 +1,14 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/app.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/app.py
new file mode 100644
index 0000000000..fc8af2eea4
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/app.py
@@ -0,0 +1,47 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+
+
+from cloudify.decorators import operation
+
+from common import namespace
+from common import resources_services
+from common import workarounds
+
+
+@operation
+def configure_docker_secret(**kwargs):
+ workarounds.configure_secret()
+
+
+@operation
+def create_namespace(**kwargs):
+ namespace.do_create_namespace()
+
+
+@operation
+def create_resources_services(**kwargs):
+ resources_services.create_resoruces()
+
+
+@operation
+def delete_namespace(**kwargs):
+ namespace.do_delete_namespace()
+
+
+@operation
+def delete_resources_services(**kwargs):
+ resources_services.delete_resoruces()
+
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/__init__.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/__init__.py
new file mode 100644
index 0000000000..19a30ba43d
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/__init__.py
@@ -0,0 +1,14 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/constants.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/constants.py
new file mode 100644
index 0000000000..493a44f16f
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/constants.py
@@ -0,0 +1,20 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# 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.
+
+HELM_URL = 'https://kubernetes-helm.storage.googleapis.com/helm-canary-linux-amd64.tar.gz'
+OOM_GIT_URL = 'https://gerrit.onap.org/r/oom.git'
+
+RT_HELM_CLI_PATH = "helm_cli_path"
+RT_APPS_ROOT_PATH = "app_root_path"
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/deployment_result.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/deployment_result.py
new file mode 100644
index 0000000000..48d49e0403
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/deployment_result.py
@@ -0,0 +1,27 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+
+from cloudify import ctx
+
+
+def save_deployment_result(key):
+ result = ctx.instance.runtime_properties['kubernetes']
+ ctx.instance.runtime_properties[key] = result
+ ctx.instance.runtime_properties['kubernetes'] = {}
+
+
+def set_deployment_result(key):
+ result = ctx.instance.runtime_properties.pop(key)
+ ctx.instance.runtime_properties['kubernetes'] = result \ No newline at end of file
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/helm.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/helm.py
new file mode 100644
index 0000000000..4404f6f832
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/helm.py
@@ -0,0 +1,62 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# 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.
+
+import urllib
+import tarfile
+import os
+import tempfile
+from git import Repo
+
+def get_helm_path(url):
+ tarball = _fetch_helm(url)
+ helm_dir = _get_tmp_file_name()
+ _untar_helm_archive(tarball, helm_dir)
+ helm_binary_path = _find_file('helm', helm_dir)
+ return helm_binary_path
+
+
+def get_apps_root_path(git_url):
+ dst_repo_path = _get_tmp_file_name()
+ Repo.clone_from(git_url, dst_repo_path)
+ apps_root = format(dst_repo_path)
+ return apps_root
+
+def _fetch_helm(url):
+ dst_tar_path = _get_tmp_file_name()
+
+ file = urllib.URLopener()
+ file.retrieve(url, dst_tar_path)
+
+ return dst_tar_path
+
+def _untar_helm_archive(tar_path, helm_dir):
+ helm_tar = tarfile.open(tar_path)
+ helm_tar.extractall(helm_dir)
+ helm_tar.close()
+
+
+def _find_file(filename, base_path):
+ for root, dirs, files in os.walk(base_path):
+ for name in files:
+ if name == filename:
+ return os.path.abspath(os.path.join(root, name))
+
+ raise Exception('Cannot find helm binary')
+
+
+def _get_tmp_file_name():
+ return '{}/{}'.format(tempfile._get_default_tempdir(), next(tempfile._get_candidate_names()))
+
+
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/init_pod.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/init_pod.py
new file mode 100644
index 0000000000..1376818b7b
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/init_pod.py
@@ -0,0 +1,63 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+
+from cloudify import ctx
+import yaml
+
+import constants
+import resources_services
+
+SERVICES_FILE_PARTS_SEPARATOR = '---'
+
+
+def do_create_init_pod():
+ ctx.logger.info('Creating init pod')
+
+ yaml_config = resources_services.render_chart(
+ ctx.node.properties["init_pod"],
+ _retrieve_root_path(),
+ _retrieve_helm_cli_path()
+ )
+ yaml_content_part = yaml_config.split(SERVICES_FILE_PARTS_SEPARATOR)[2]
+ enhanced_yaml = _add_openstack_envs(yaml_content_part)
+
+ resources_services.create_resource(enhanced_yaml)
+
+ ctx.logger.info('Init pod created successfully')
+
+
+def do_delete_init_pod():
+ ctx.logger.info('Deleting init pod')
+
+ ctx.logger.info('Init pod deleted successfully')
+
+def _add_openstack_envs(yaml_content):
+ input_dict = yaml.load(yaml_content)
+
+ container_dict = input_dict['spec']['containers'][0]
+ container_dict.pop('envFrom')
+
+ openstack_envs = ctx.node.properties["openstack_envs"]
+ for item in openstack_envs.items():
+ ctx.logger.debug("adding item = {}".format(item))
+ container_dict['env'].append(item)
+
+ return input_dict
+
+def _retrieve_root_path():
+ return ctx.instance.runtime_properties.get(constants.RT_APPS_ROOT_PATH, None)
+
+def _retrieve_helm_cli_path():
+ return ctx.instance.runtime_properties.get(constants.RT_HELM_CLI_PATH, None) \ No newline at end of file
diff --git a/cloudify/scripts/onap/create_namespace.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/namespace.py
index c0f1f19680..d1336768ac 100644
--- a/cloudify/scripts/onap/create_namespace.py
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/namespace.py
@@ -1,37 +1,67 @@
-import pip
-
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# 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.
+
+import cloudify_kubernetes.tasks as kubernetes_plugin
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
+import deployment_result
-def _import_or_install():
- try:
- import yaml
- except ImportError:
- pip.main(["install", "pyaml"])
- try:
- import cloudify_kubernetes.tasks as kubernetes_plugin
- except ImportError:
- pip.main([
- "install",
- "https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1rc1.zip"
- ])
+def do_create_namespace():
+ namespace = _retrieve_namespace()
+ ctx.logger.info('Creating namespace: {0}'.format(namespace))
- import yaml
- import cloudify_kubernetes.tasks as kubernetes_plugin
+ namespace_resource_template = _prepare_namespace_resource_template(
+ namespace
+ )
- return yaml, kubernetes_plugin
+ ctx.logger.debug(
+ 'Kubernetes object which will be deployed: {0}'
+ .format(namespace_resource_template)
+ )
+ kubernetes_plugin.custom_resource_create(**namespace_resource_template)
+ deployment_result.save_deployment_result('namespace')
+ ctx.logger.info('Namespace created successfully')
-def _retrieve_namespace():
- namespace = ctx.node.properties.get(
- 'namespace',
- ctx.node.properties
- .get('options', {})
- .get('namespace', None)
+
+def do_delete_namespace():
+ namespace = _retrieve_namespace()
+ ctx.logger.info('Deleting namespace: {0}'.format(namespace))
+
+ namespace_resource_template = _prepare_namespace_resource_template(
+ namespace
+ )
+
+ ctx.logger.debug(
+ 'Kubernetes object which will be deleted: {0}'
+ .format(namespace_resource_template)
)
+ deployment_result.set_deployment_result('namespace')
+ kubernetes_plugin.custom_resource_delete(**namespace_resource_template)
+ ctx.logger.info('Namespace deleted successfully')
+
+
+
+def _retrieve_namespace():
+
+ default_namespace = ctx.node.properties.get('options', {}).get('namespace')
+ namespace = ctx.node.properties.get('namespace', default_namespace)
+
if not namespace:
raise NonRecoverableError(
'Namespace is not defined (node={})'.format(ctx.node.name)
@@ -69,33 +99,3 @@ def _prepare_namespace_resource_template(name):
}
}
}
-
-
-def _save_deployment_result(key):
- result = ctx.instance.runtime_properties['kubernetes']
- ctx.instance.runtime_properties[key] = result
- ctx.instance.runtime_properties['kubernetes'] = {}
-
-
-def _do_create_namespace(kubernetes_plugin):
- namespace = _retrieve_namespace()
- ctx.logger.info('Creating namespace: {0}'.format(namespace))
-
- namespace_resource_template = _prepare_namespace_resource_template(
- namespace
- )
-
- ctx.logger.debug(
- 'Kubernetes object which will be deployed: {0}'
- .format(namespace_resource_template)
- )
-
- kubernetes_plugin.custom_resource_create(**namespace_resource_template)
- _save_deployment_result('namespace')
- ctx.logger.info('Namespace created successfully')
-
-
-if __name__ == '__main__':
- _, kubernetes_plugin = _import_or_install()
-
- _do_create_namespace(kubernetes_plugin)
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/resources_services.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/resources_services.py
new file mode 100644
index 0000000000..268068f00c
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/resources_services.py
@@ -0,0 +1,230 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# 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.
+
+import subprocess
+
+import cloudify_kubernetes.tasks as kubernetes_plugin
+import yaml
+from cloudify import ctx
+from cloudify.exceptions import NonRecoverableError
+
+import constants
+import deployment_result
+import time
+import ast
+import json
+import base64
+
+SERVICES_FILE_PARTS_SEPARATOR = '---'
+
+
+def create_resoruces():
+ ctx.logger.info('Creating resources')
+ apps_path = _retrieve_root_path()
+
+ if not apps_path:
+ ctx.logger.warn(
+ 'Apps dir is not defined. Skipping!'
+ )
+
+ return
+
+ helm_app = ctx.node.properties.get('path', None)
+
+ yaml_file = prepare_content(helm_app)
+
+ yaml_content_parts = yaml_file.split(SERVICES_FILE_PARTS_SEPARATOR)
+
+ for yaml_content_part in yaml_content_parts:
+ if yaml_content_part:
+ yaml_content = _apply_readiness_workaround(yaml_content_part)
+ if yaml_content:
+ create_resource(yaml_content)
+
+ ctx.logger.info('Resource created successfully')
+
+def delete_resoruces():
+
+ ctx.logger.info('Deleting resources')
+ apps_path = _retrieve_root_path()
+
+ if not apps_path:
+ ctx.logger.warn(
+ 'Apps dir is not defined. Skipping!'
+ )
+ return
+
+ helm_app = ctx.node.properties.get('path', None)
+
+ yaml_file = prepare_content(helm_app)
+
+ yaml_content_parts = yaml_file.split(SERVICES_FILE_PARTS_SEPARATOR)
+
+ for yaml_content_part in yaml_content_parts:
+ if yaml_content_part:
+ yaml_content = _apply_readiness_workaround(yaml_content_part)
+ if yaml_content:
+ delete_resource(yaml_content)
+
+ ctx.logger.info('Resources deleted successfully')
+
+
+def prepare_content(resource):
+ helm_path = _retrieve_helm_cli_path()
+ yaml_file = render_chart(resource, _retrieve_root_path(), helm_path)
+
+ return yaml_file
+
+
+def create_resource(yaml_content_dict):
+ ctx.logger.debug("Loading yaml: {}".format(yaml_content_dict))
+
+ if yaml_content_dict.get('kind', '') == 'PersistentVolumeClaim':
+ ctx.logger.debug("PersistentVolumeClaim custom handling")
+ kubernetes_plugin.custom_resource_create(definition=yaml_content_dict, api_mapping=_get_persistent_volume_mapping_claim_api())
+ else:
+ kubernetes_plugin.resource_create(definition=yaml_content_dict)
+
+ deployment_result.save_deployment_result('resource_{0}'.format(yaml_content_dict['metadata']['name']))
+
+def delete_resource(yaml_content_dict):
+ ctx.logger.debug("Loading yaml: {}".format(yaml_content_dict))
+
+ deployment_result.save_deployment_result('resource_{0}'.format(yaml_content_dict['metadata']['name']))
+ if yaml_content_dict.get('kind', '') == 'PersistentVolumeClaim':
+ ctx.logger.debug("PersistentVolumeClaim custom handling")
+ kubernetes_plugin.custom_resource_delete(definition=yaml_content_dict, api_mapping=_get_persistent_volume_mapping_claim_api())
+ else:
+ kubernetes_plugin.resource_delete(definition=yaml_content_dict)
+
+
+def render_chart(app, app_root_path, helm_cli_path):
+ app_chart_path = "{}/{}/".format(app_root_path, app)
+ ctx.logger.debug('App chart path = {}'.format(app_chart_path))
+ return _exec_helm_template(helm_cli_path, app_chart_path)
+
+
+def _exec_helm_template(helm_path, chart):
+ cmd = '{0} template {1}'.format(helm_path, chart)
+ ctx.logger.debug('Executing helm template cmd: {}'.format(cmd))
+ rendered = subprocess.Popen(cmd.split(" "), stdout=subprocess.PIPE).stdout.read().decode()
+
+ return rendered
+
+def _get_persistent_volume_mapping_claim_api():
+ api_mapping = {
+ 'create' : {
+ 'api': 'CoreV1Api',
+ 'method': 'create_namespaced_persistent_volume_claim',
+ 'payload': 'V1PersistentVolumeClaim'
+ },
+ 'read' : {
+ 'api': 'CoreV1Api',
+ 'method': 'read_namespaced_persistent_volume_claim',
+ },
+ 'delete': {
+ 'api': 'CoreV1Api',
+ 'method': 'delete_namespaced_persistent_volume_claim',
+ 'payload': 'V1DeleteOptions'
+ }
+ }
+
+ return api_mapping
+
+
+def _apply_readiness_workaround(yaml_file):
+ b64_env = _get_k8s_b64_env()
+
+ input_dict = yaml.load(yaml_file)
+
+ try:
+ init_containers = input_dict['spec']['template']['metadata']['annotations'][
+ 'pod.beta.kubernetes.io/init-containers']
+ init_cont_list = eval(init_containers)
+
+ new_init_cont_list = list()
+ new_cont = None
+ for init_cont in init_cont_list:
+ if "oomk8s/readiness-check" in init_cont['image']:
+ init_cont['image'] = "clfy/oomk8s-cfy-readiness-check:1.0.1"
+ #init_cont['imagePullPolicy'] = "IfNotPresent"
+ init_cont['env'].append(b64_env)
+ new_cont = init_cont
+ new_init_cont_list.append(json.dumps(init_cont))
+
+ new_payload = ",".join(new_init_cont_list)
+
+ if new_cont:
+ input_dict['spec']['template']['metadata']['annotations'].pop('pod.beta.kubernetes.io/init-containers')
+ input_dict['spec']['template']['metadata']['annotations']['pod.beta.kubernetes.io/init-containers'] = '[{}]'.format(new_payload)
+
+
+ except KeyError as ke:
+ ctx.logger.debug('Readiness section is not found.')
+
+ return input_dict
+
+
+def _get_k8s_b64():
+ target_relationship = _retrieve_managed_by_master()
+
+ k8s_config = target_relationship.node.properties.get('configuration').get('file_content')
+
+ if not k8s_config:
+ raise Exception("Cannot find kubernetes config")
+
+ k8s_config_plain = yaml.dump(k8s_config, allow_unicode=True)
+
+ k8s_config_b64 = base64.b64encode(k8s_config_plain)
+
+ return k8s_config_b64
+
+
+def _get_k8s_b64_env():
+ env = dict()
+ env['name'] = 'K8S_CONFIG_B64'
+ env['value'] = _get_k8s_b64()
+ return env
+
+
+def _retrieve_root_path():
+ target_relationship = _retrieve_depends_on()
+
+ apps_root_path = target_relationship.instance.runtime_properties.get(constants.RT_APPS_ROOT_PATH, None)
+
+ ctx.logger.debug("Retrived apps root path = {}".format(apps_root_path))
+
+ return apps_root_path
+
+def _retrieve_helm_cli_path():
+ target_relationship = _retrieve_depends_on()
+
+ helm_cli_path = target_relationship.instance.runtime_properties.get(constants.RT_HELM_CLI_PATH, None)
+
+ ctx.logger.debug("Retrived helm clis path = {}".format(helm_cli_path))
+
+ return helm_cli_path
+
+def _retrieve_depends_on():
+ result = None
+ for relationship in ctx.instance.relationships:
+ if relationship.type == 'cloudify.relationships.depends_on':
+ return relationship.target
+
+def _retrieve_managed_by_master():
+ result = None
+ for relationship in ctx.instance.relationships:
+ if relationship.type == 'cloudify.kubernetes.relationships.managed_by_master':
+ return relationship.target
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/workarounds.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/workarounds.py
new file mode 100644
index 0000000000..fe3e892c5b
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/common/workarounds.py
@@ -0,0 +1,67 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+
+from cloudify import ctx
+from cloudify.exceptions import NonRecoverableError
+
+from fabric import api as fabric_api
+
+def _retrieve_namespace():
+ namespace = ctx.node.properties.get(
+ 'namespace',
+ ctx.node.properties
+ .get('options', {})
+ .get('namespace', None)
+ )
+
+ if not namespace:
+ raise NonRecoverableError(
+ 'Namespace is not defined (node={})'.format(ctx.node.name)
+ )
+
+ return namespace
+
+
+def configure_secret():
+ namespace = _retrieve_namespace()
+ ctx.logger.info(
+ 'Configuring docker secrets for namespace: {0}'.format(namespace)
+ )
+
+ command = 'kubectl create secret ' \
+ 'docker-registry onap-docker-registry-key ' \
+ '--docker-server=nexus3.onap.org:10001 ' \
+ '--docker-username=docker ' \
+ '--docker-password=docker ' \
+ '--docker-email=email@email.com ' \
+ '--namespace={0}'.format(namespace)
+
+ ctx.logger.info('Command "{0}" will be executed'.format(command))
+
+ with fabric_api.settings(
+ **ctx.node.properties.get('ssh_credentials')):
+ fabric_api.run(command)
+
+ ctx.logger.info('Docker secrets configured successfully')
+
+
+def _get_fabric_env():
+ result = dict()
+
+ result['host_string'] = ctx.node.properties.get('ssh_credentials')['host_string']
+ result['user'] = ctx.node.properties.get('ssh_credentials')['user']
+ result['key'] = ctx.node.properties.get('ssh_credentials')['key']
+
+ return result
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/environment.py b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/environment.py
new file mode 100644
index 0000000000..741f28ec32
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/environment.py
@@ -0,0 +1,58 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+
+
+from cloudify import ctx
+from cloudify.decorators import operation
+
+from common import constants
+from common import helm
+from common import init_pod, namespace
+
+
+@operation
+def create_init_pod(**kwargs):
+ init_pod.do_create_init_pod()
+ pass
+
+
+@operation
+def create_namespace(**kwargs):
+ namespace.do_create_namespace()
+
+
+@operation
+def delete_init_pod(**kwargs):
+ init_pod.do_delete_init_pod()
+
+
+@operation
+def delete_namespace(**kwargs):
+ namespace.do_delete_namespace()
+
+
+@operation
+def setup_helm_templates(**kwargs):
+ helm_url = constants.HELM_URL
+ ctx.instance.runtime_properties[constants.RT_HELM_CLI_PATH] = helm.get_helm_path(helm_url)
+ ctx.logger.debug('Helm cli path = {}'.format(ctx.instance.runtime_properties[constants.RT_HELM_CLI_PATH]))
+
+ oom_git_url = constants.OOM_GIT_URL
+ ctx.instance.runtime_properties[constants.RT_APPS_ROOT_PATH] = helm.get_apps_root_path(oom_git_url)
+ ctx.logger.debug('Apps root path = {}'.format(ctx.instance.runtime_properties[constants.RT_APPS_ROOT_PATH]))
+
+
+
+
diff --git a/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/requirements.txt b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/requirements.txt
new file mode 100644
index 0000000000..9d8d880932
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/k8s_installer/requirements.txt
@@ -0,0 +1 @@
+https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1.zip \ No newline at end of file
diff --git a/cloudify-onap/plugins/onap-installation-plugin/plugin.yaml b/cloudify-onap/plugins/onap-installation-plugin/plugin.yaml
new file mode 100755
index 0000000000..f88b50bc78
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/plugin.yaml
@@ -0,0 +1,87 @@
+plugins:
+ onap:
+ executor: central_deployment_agent
+ package_name: onap-installation-plugin
+ package_version: '1.0.0'
+ source: onap-installation-plugin
+ # install_arguments: '--process-dependency-links'
+
+node_types:
+ cloudify.onap.kubernetes.Environment:
+ derived_from: cloudify.nodes.Root
+ properties:
+ namespace:
+ type: string
+ init_pod:
+ type: string
+ description: >
+ Path to init pod chart
+ openstack_envs:
+ description: >
+ ONAP parameters defined at the onap-parameters.yaml file
+ default: {}
+ options:
+ description: >
+ For compatibility with kubernetes plugin.
+ To be removed in the future.
+ default: {}
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ create:
+ implementation: onap.k8s_installer.environment.create_namespace
+ executor: central_deployment_agent
+ configure:
+ implementation: onap.k8s_installer.environment.setup_helm_templates
+ executor: central_deployment_agent
+ start:
+ implementation: onap.k8s_installer.environment.create_init_pod
+ executor: central_deployment_agent
+ stop:
+ implementation: onap.k8s_installer.environment.delete_init_pod
+ executor: central_deployment_agent
+ delete:
+ implementation: onap.k8s_installer.environment.delete_namespace
+ executor: central_deployment_agent
+
+ cloudify.onap.kubernetes.App:
+ derived_from: cloudify.nodes.Root
+ properties:
+ name:
+ type: string
+ description: >
+ Name of ONAP app
+ path:
+ type: string
+ description: >
+ Paths (relative, blueprint prespective) to app chart directory
+ required: false
+ options:
+ description: >
+ For compatibility with kubernetes plugin.
+ To be removed in the future.
+ default: {}
+ ssh_credentials:
+ description: >
+ Workaround for docker secret settings
+ via fabric plugin
+ default:
+ host_string: { get_secret: kubernetes_master_ip }
+ user: { get_secret: agent_user }
+ key: { get_secret: agent_key_private }
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ create:
+ implementation: onap.k8s_installer.app.create_namespace
+ executor: central_deployment_agent
+ configure:
+ implementation: onap.k8s_installer.app.configure_docker_secret
+ executor: central_deployment_agent
+ start:
+ implementation: onap.k8s_installer.app.create_resources_services
+ executor: central_deployment_agent
+ stop:
+ implementation: onap.k8s_installer.app.delete_resources_services
+ executor: central_deployment_agent
+ delete:
+ implementation: onap.k8s_installer.app.delete_namespace
+ executor: central_deployment_agent
diff --git a/cloudify-onap/plugins/onap-installation-plugin/requirements.txt b/cloudify-onap/plugins/onap-installation-plugin/requirements.txt
new file mode 100644
index 0000000000..9d8d880932
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/requirements.txt
@@ -0,0 +1 @@
+https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1.zip \ No newline at end of file
diff --git a/cloudify-onap/plugins/onap-installation-plugin/setup.py b/cloudify-onap/plugins/onap-installation-plugin/setup.py
new file mode 100755
index 0000000000..d413daa4ac
--- /dev/null
+++ b/cloudify-onap/plugins/onap-installation-plugin/setup.py
@@ -0,0 +1,40 @@
+########
+# Copyright (c) 2017 GigaSpaces Technologies Ltd. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+
+
+from setuptools import setup
+
+try:
+ import cloudify_kubernetes
+except ImportError:
+ import pip
+ pip.main(['install', 'https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1.zip'])
+
+setup(
+ name='onap-installation-plugin',
+ version='1.0.0',
+ author='',
+ author_email='',
+ packages=['k8s_installer', 'k8s_installer.common'],
+ install_requires=[
+ 'cloudify-plugins-common>=3.3.1',
+ 'cloudify-kubernetes-plugin==1.2.1',
+ #'/tmp/k8spl/cloudify-kubernetes-plugin'
+ 'pyyaml',
+ 'gitpython',
+ 'paramiko==1.18.3',
+ 'fabric==1.13.1'
+ ]
+)
diff --git a/cloudify/inputs/message-router-blueprint.yaml.example b/cloudify/inputs/message-router-blueprint.yaml.example
deleted file mode 100644
index ecab0eca2c..0000000000
--- a/cloudify/inputs/message-router-blueprint.yaml.example
+++ /dev/null
@@ -1,25 +0,0 @@
-join_command: kubeadm join --token f66aad.cb001cc90bd69b38 192.168.120.6:6443
-kubernetes_master_ip: 192.168.120.6
-flavor: 3
-configuration_file_content:
- apiVersion: v1
- clusters:
- - cluster:
- certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRFM01EZ3dNekEzTXpJek4xb1hEVEkzTURnd01UQTNNekl6TjFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTUF4Ckxzdmkyek1ZU0pjaG5QWjVDUkJQTnBLbklHTDlHY1FYRFZnQjNEc0FuaTVp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cluster: kubernetes
- user: kubernetes-admin
- name: kubernetes-admin@kubernetes
- current-context: kubernetes-admin@kubernetes
- kind: Config
- preferences: {}
- users:
- - name: kubernetes-admin
- user:
- client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJSm9EQWNpYWVkSVF3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB4TnpBNE1ETXdOek15TXpkYUZ3MHhPREE0TURNd056TXlNemxhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQW1xd3duNlU0TFVFQkphMWUKQzIrUjM0K0oyZ3BBYTJ0aDVOZXdnS2NhUWQwaE5BODNjNE1IMDFVUjU3b3ByNUNFczFQVmVwMkZtczlpaFRITwo0SUpINjkxUVQvTUVJZE5iWTl0RXdDV21ia1lMbFBjc09yclErYTl5VGdxYm5IWjBONnJOdUZ4dDB2alRPSUR1CmRDMnBQR3dFMW5kaHd1VVB3UUFxeS9SVjN6MTgzRnoyOWZuVHg3UXdWR0J4Rk84Z0JxRTFRYTVYenhIZ0lTQ2sKSkJka2FtRUFhSjl6NHgwZjFmbHQ4MG4wZ3RHRitkbUZuMThkbGwzZmoreGpNOGxqS21QZnRNdlc4MXF0bkVnZApoU1I3bWdMODlUckx3SmFtNkxmVmZhN29CWWJvWUMyT2gvKytZMkpwOXRpRkMyZ1ExeVBXSHJBMVZJTVBQUWdkCk8yTGNuUUlEQVFBQm95Y3dKVEFPQmdOVkhROEJBZjhFQkFNQ0JhQXdFd1lEVlIwbEJBd3dDZ1lJS3dZQkJRVUgKQXdJd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFIZ2Z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TXZwa1BBeVc3Vy9ocXZaQytCbWdZN1lzZkhXem5ZWnhmbWJoNlRmdEFyMWdoTjh2amxqVDhwdjBaCk45OTE2T2UrcHIxY0l1cTdxUitiMmJrQ2dZQUxMYlQvZnV1SzZ5dGw0NWZBK3JEZWY1S3o2WGd0cUsyOGFIdDYKcFE3RUdVOUJvUTdVRzhmRzFVQ3dGSERya2I3SkNLUHlDWGFWZzhmeTdSZEMwY3YxQlM4Tngzc20wMVlpTUQwdwpMRGdaV2dwcTUyRGRzc0R3bW4welF3SEhLYXB1MEsrYjRISk9oc0ZpM1FxcjF2WG5KQittWmJtZUxCaXM4TkE0ClNVQk9od0tCZ0drTkJhaTFWVU9RaGVYU3Mrb3JPVWxDNDNsenlBanJZa2dod0lRd25LTWpqK2lrak9oNmtqc3IKL1lDTHVRcWNBYWNKVEF2VmZOVGcyZldyUUJTODlwVjlFRVBnV0JIQmt4a1JsNnY0WTFQZVRqOVVzeVdzaHljYQpXRkFHSkpDMXg1NWg2OWdFWSsyR1NpUEQ0MzNrQUZUd3NBUEhPbmRwdmlOTVBLek9KTldnCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
-
-
diff --git a/cloudify/scripts/configure_node.py b/cloudify/scripts/configure_node.py
deleted file mode 100644
index 9cfa206b54..0000000000
--- a/cloudify/scripts/configure_node.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-
-import subprocess
-from cloudify import ctx
-from cloudify.state import ctx_parameters as inputs
-
-
-def execute_command(_command):
-
- ctx.logger.debug('_command {0}.'.format(_command))
-
- subprocess_args = {
- 'args': _command.split(),
- 'stdout': subprocess.PIPE,
- 'stderr': subprocess.PIPE
- }
-
- ctx.logger.debug('subprocess_args {0}.'.format(subprocess_args))
-
- process = subprocess.Popen(**subprocess_args)
- output, error = process.communicate()
-
- ctx.logger.debug('command: {0} '.format(_command))
- ctx.logger.debug('output: {0} '.format(output))
- ctx.logger.debug('error: {0} '.format(error))
- ctx.logger.debug('process.returncode: {0} '.format(process.returncode))
-
- if process.returncode:
- ctx.logger.error('Running `{0}` returns error.'.format(_command))
- return False
-
- return output
-
-
-if __name__ == '__main__':
-
- join_command = inputs['join_command']
- join_command = 'sudo {0} --skip-preflight-checks'.format(join_command)
- execute_command(join_command)
-
- # Install weave-related utils
- execute_command('sudo curl -L git.io/weave -o /usr/local/bin/weave')
- execute_command('sudo chmod a+x /usr/local/bin/weave')
- execute_command('sudo curl -L git.io/scope -o /usr/local/bin/scope')
- execute_command('sudo chmod a+x /usr/local/bin/scope')
- execute_command('/usr/local/bin/scope launch')
-
- hostname = execute_command('hostname')
- ctx.instance.runtime_properties['hostname'] = hostname.rstrip('\n')
diff --git a/cloudify/scripts/create.py b/cloudify/scripts/create.py
deleted file mode 100644
index eb362a4558..0000000000
--- a/cloudify/scripts/create.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-import subprocess
-from cloudify import ctx
-from cloudify.exceptions import OperationRetry
-
-
-def check_command(command):
-
- try:
- process = subprocess.Popen(
- command.split()
- )
- except OSError:
- return False
-
- output, error = process.communicate()
-
- ctx.logger.debug('command: {0} '.format(command))
- ctx.logger.debug('output: {0} '.format(output))
- ctx.logger.debug('error: {0} '.format(error))
- ctx.logger.debug('process.returncode: {0} '.format(process.returncode))
-
- if process.returncode:
- ctx.logger.error('Running `{0}` returns error.'.format(command))
- return False
-
- return True
-
-
-def execute_command(_command):
-
- ctx.logger.debug('_command {0}.'.format(_command))
-
- subprocess_args = {
- 'args': _command.split(),
- 'stdout': subprocess.PIPE,
- 'stderr': subprocess.PIPE
- }
-
- ctx.logger.debug('subprocess_args {0}.'.format(subprocess_args))
-
- process = subprocess.Popen(**subprocess_args)
- output, error = process.communicate()
-
- ctx.logger.debug('command: {0} '.format(_command))
- ctx.logger.debug('output: {0} '.format(output))
- ctx.logger.debug('error: {0} '.format(error))
- ctx.logger.debug('process.returncode: {0} '.format(process.returncode))
-
- if process.returncode:
- ctx.logger.error('Running `{0}` returns error.'.format(_command))
- return False
-
- return output
-
-
-if __name__ == '__main__':
-
- docker_command = 'docker ps'
-
- if not check_command(docker_command):
- raise OperationRetry('Waiting for docker to be installed.')
-
- finished = False
- ps = execute_command('ps -ef')
- for line in ps.split('\n'):
- if '/usr/bin/python /usr/bin/cloud-init modules' in line:
- ctx.logger.error('in line')
- raise OperationRetry('Waiting for Cloud Init to finish.')
-
- ctx.logger.info('Docker is ready and Cloud Init finished.')
diff --git a/cloudify/scripts/onap/configure_docker_secret_workaround.py b/cloudify/scripts/onap/configure_docker_secret_workaround.py
deleted file mode 100644
index 6e9deff059..0000000000
--- a/cloudify/scripts/onap/configure_docker_secret_workaround.py
+++ /dev/null
@@ -1,40 +0,0 @@
-from fabric.api import run
-
-from cloudify import ctx
-from cloudify.exceptions import NonRecoverableError
-
-
-def _retrieve_namespace():
- namespace = ctx.node.properties.get(
- 'namespace',
- ctx.node.properties
- .get('options', {})
- .get('namespace', None)
- )
-
- if not namespace:
- raise NonRecoverableError(
- 'Namespace is not defined (node={})'.format(ctx.node.name)
- )
-
- return namespace
-
-
-def configure_secret():
- namespace = _retrieve_namespace()
- ctx.logger.info(
- 'Configuring docker secrets for namespace: {0}'.format(namespace)
- )
-
- command = 'kubectl create secret ' \
- 'docker-registry onap-docker-registry-key ' \
- '--docker-server=nexus3.onap.org:10001 ' \
- '--docker-username=docker ' \
- '--docker-password=docker ' \
- '--docker-email=email@email.com ' \
- '--namespace={0}'.format(namespace)
-
- ctx.logger.info('Command "{0}" will be executed'.format(command))
- run(command)
-
- ctx.logger.info('Docker secrets configured successfully')
diff --git a/cloudify/scripts/onap/create_init_pod.py b/cloudify/scripts/onap/create_init_pod.py
deleted file mode 100644
index c82172d15f..0000000000
--- a/cloudify/scripts/onap/create_init_pod.py
+++ /dev/null
@@ -1,65 +0,0 @@
-import pip
-
-from cloudify import ctx
-from cloudify.exceptions import NonRecoverableError
-
-
-SERVICES_FILE_PARTS_SEPARATOR = '---'
-
-
-def _import_or_install():
- try:
- import yaml
- except ImportError:
- pip.main(["install", "pyaml"])
-
- try:
- import cloudify_kubernetes.tasks as kubernetes_plugin
- except ImportError:
- pip.main([
- "install",
- "https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1rc1.zip"
- ])
-
- import yaml
- import cloudify_kubernetes.tasks as kubernetes_plugin
-
- return yaml, kubernetes_plugin
-
-
-def _retrieve_path():
- return ctx.node.properties.get('init_pod', None)
-
-
-def _save_deployment_result(key):
- result = ctx.instance.runtime_properties['kubernetes']
- ctx.instance.runtime_properties[key] = result
- ctx.instance.runtime_properties['kubernetes'] = {}
-
-
-def _do_create_init_pod(kubernetes_plugin, yaml):
- ctx.logger.info('Creating init pod')
- init_pod_file_path = _retrieve_path()
-
- if not init_pod_file_path:
- raise NonRecoverableError('Init pod file is not defined.')
-
- temp_file_path = ctx.download_resource_and_render(
- init_pod_file_path
- )
-
- with open(temp_file_path) as temp_file:
- init_pod_file_content = temp_file.read()
- init_pod_yaml_content = yaml.load(init_pod_file_content)
-
- kubernetes_plugin.resource_create(definition=init_pod_yaml_content)
- _save_deployment_result('init_pod')
-
- ctx.logger.info('Init pod created successfully')
-
-
-if __name__ == '__main__':
- yaml, kubernetes_plugin = _import_or_install()
-
- _do_create_init_pod(kubernetes_plugin, yaml)
-
diff --git a/cloudify/scripts/onap/create_resources_services.py b/cloudify/scripts/onap/create_resources_services.py
deleted file mode 100644
index 8548e29b70..0000000000
--- a/cloudify/scripts/onap/create_resources_services.py
+++ /dev/null
@@ -1,131 +0,0 @@
-import pip
-
-from cloudify import ctx
-
-
-SERVICES_FILE_PARTS_SEPARATOR = '---'
-
-
-def _import_or_install():
- try:
- import yaml
- except ImportError:
- pip.main(["install", "pyaml"])
-
- try:
- import cloudify_kubernetes.tasks as kubernetes_plugin
- except ImportError:
- pip.main([
- "install",
- "https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1rc1.zip"
- ])
-
- try:
- import jinja2
- except ImportError:
- pip.main(["install", "jinja2"])
-
- import yaml
- import jinja2
- import cloudify_kubernetes.tasks as kubernetes_plugin
-
- return yaml, kubernetes_plugin, jinja2
-
-
-def _init_jinja(jinja2):
- return jinja2.Environment(
- loader=jinja2.BaseLoader()
- )
-
-
-def _render_template(jinja_env, template_content, values):
- template_content = template_content.replace('.Values', 'Values')
-
- template = jinja_env.from_string(template_content)
- rendered_template = template.render(Values=values)
- return rendered_template
-
-
-def _retrieve_resources_paths():
- return ctx.node.properties.get('resources', [])
-
-
-def _retrieve_services_paths():
- return ctx.node.properties.get('services', None)
-
-
-def _retrieve_values(yaml):
- values_file_path = ctx.node.properties.get('values', None)
-
- if values_file_path:
- return yaml.load(ctx.get_resource(values_file_path))
-
- ctx.logger.warn('Values file not found')
-
-
-def _save_deployment_result(key):
- result = ctx.instance.runtime_properties['kubernetes']
- ctx.instance.runtime_properties[key] = result
- ctx.instance.runtime_properties['kubernetes'] = {}
-
-
-def _do_create_resources(kubernetes_plugin, yaml, jinja_env, values):
- for path in _retrieve_resources_paths():
- ctx.logger.info('Creating resource defined in: {0}'.format(path))
-
- template_content = ctx.get_resource(path)
- yaml_content = _render_template(
- jinja_env,
- template_content,
- values
- )
- content = yaml.load(yaml_content)
-
- kubernetes_plugin.resource_create(definition=content)
- _save_deployment_result(
- 'resource_{0}'.format(content['metadata']['name'])
- )
-
- ctx.logger.info('Resources created successfully')
-
-
-def _do_create_services(kubernetes_plugin, yaml, jinja_env, values):
- ctx.logger.info('Creating services')
- services_file_path = _retrieve_services_paths()
-
- if not services_file_path:
- ctx.logger.warn(
- 'Service file is not defined. Skipping services provisioning !'
- )
-
- return
-
- template_content = ctx.get_resource(services_file_path)
- yaml_content = _render_template(
- jinja_env,
- template_content,
- values
- )
-
- yaml_content_parts = \
- yaml_content.split(SERVICES_FILE_PARTS_SEPARATOR)
-
- for yaml_content_part in yaml_content_parts:
- content = yaml.load(yaml_content_part)
-
- kubernetes_plugin.resource_create(definition=content)
- _save_deployment_result(
- 'service_{0}'.format(content['metadata']['name'])
- )
-
- ctx.logger.info('Services created successfully')
-
-
-if __name__ == '__main__':
- yaml, kubernetes_plugin, jinja2 = _import_or_install()
- jinja_env = _init_jinja(jinja2)
- values = _retrieve_values(yaml)
-
- _do_create_resources(kubernetes_plugin, yaml, jinja_env, values)
- _do_create_services(kubernetes_plugin, yaml, jinja_env, values)
-
diff --git a/cloudify/scripts/onap/delete_init_pod.py b/cloudify/scripts/onap/delete_init_pod.py
deleted file mode 100644
index 1da805b959..0000000000
--- a/cloudify/scripts/onap/delete_init_pod.py
+++ /dev/null
@@ -1,64 +0,0 @@
-import pip
-
-from cloudify import ctx
-from cloudify.exceptions import NonRecoverableError
-
-
-SERVICES_FILE_PARTS_SEPARATOR = '---'
-
-
-def _import_or_install():
- try:
- import yaml
- except ImportError:
- pip.main(["install", "pyaml"])
-
- try:
- import cloudify_kubernetes.tasks as kubernetes_plugin
- except ImportError:
- pip.main([
- "install",
- "https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1rc1.zip"
- ])
-
- import yaml
- import cloudify_kubernetes.tasks as kubernetes_plugin
-
- return yaml, kubernetes_plugin
-
-
-def _retrieve_path():
- return ctx.node.properties.get('init_pod', None)
-
-
-def _set_deployment_result(key):
- result = ctx.instance.runtime_properties.pop(key)
- ctx.instance.runtime_properties['kubernetes'] = result
-
-
-def _do_delete_init_pod(kubernetes_plugin, yaml):
- ctx.logger.info('Deleting init pod')
- init_pod_file_path = _retrieve_path()
-
- if not init_pod_file_path:
- raise NonRecoverableError('Init pod file is not defined.')
-
- temp_file_path = ctx.download_resource_and_render(
- init_pod_file_path
- )
-
- with open(temp_file_path) as temp_file:
- init_pod_file_content = temp_file.read()
- init_pod_yaml_content = yaml.load(init_pod_file_content)
-
- _set_deployment_result('init_pod')
- kubernetes_plugin.resource_delete(definition=init_pod_yaml_content)
-
- ctx.logger.info('Init pod deleted successfully')
-
-
-if __name__ == '__main__':
- yaml, kubernetes_plugin = _import_or_install()
-
- _do_delete_init_pod(kubernetes_plugin, yaml)
-
diff --git a/cloudify/scripts/onap/delete_namespace.py b/cloudify/scripts/onap/delete_namespace.py
deleted file mode 100644
index 6973e59944..0000000000
--- a/cloudify/scripts/onap/delete_namespace.py
+++ /dev/null
@@ -1,101 +0,0 @@
-import pip
-
-from cloudify import ctx
-from cloudify.exceptions import NonRecoverableError
-
-
-def _import_or_install():
- try:
- import yaml
- except ImportError:
- pip.main(["install", "pyaml"])
-
- try:
- import cloudify_kubernetes.tasks as kubernetes_plugin
- except ImportError:
- pip.main([
- "install",
- "https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1rc1.zip"
- ])
-
- import yaml
- import cloudify_kubernetes.tasks as kubernetes_plugin
-
- return yaml, kubernetes_plugin
-
-
-def _retrieve_namespace():
- namespace = ctx.node.properties.get(
- 'namespace',
- ctx.node.properties
- .get('options', {})
- .get('namespace', None)
- )
-
- if not namespace:
- raise NonRecoverableError(
- 'Namespace is not defined (node={})'.format(ctx.node.name)
- )
-
- return namespace
-
-
-def _prepare_namespace_resource_template(name):
- return {
- 'definition': {
- 'apiVersion': 'v1',
- 'kind': 'Namespace',
- 'metadata': {
- 'name': name,
- 'labels': {
- 'name': name
- },
- },
- },
- 'api_mapping': {
- 'create': {
- 'api': 'CoreV1Api',
- 'method': 'create_namespace',
- 'payload': 'V1Namespace'
- },
- 'read': {
- 'api': 'CoreV1Api',
- 'method': 'read_namespace',
- },
- 'delete': {
- 'api': 'CoreV1Api',
- 'method': 'delete_namespace',
- 'payload': 'V1DeleteOptions'
- }
- }
- }
-
-
-def _set_deployment_result(key):
- result = ctx.instance.runtime_properties.pop(key)
- ctx.instance.runtime_properties['kubernetes'] = result
-
-
-def _do_delete_namespace(kubernetes_plugin):
- namespace = _retrieve_namespace()
- ctx.logger.info('Deleting namespace: {0}'.format(namespace))
-
- namespace_resource_template = _prepare_namespace_resource_template(
- namespace
- )
-
- ctx.logger.debug(
- 'Kubernetes object which will be deleted: {0}'
- .format(namespace_resource_template)
- )
-
- _set_deployment_result('namespace')
- kubernetes_plugin.custom_resource_delete(**namespace_resource_template)
- ctx.logger.info('Namespace deleted successfully')
-
-
-if __name__ == '__main__':
- _, kubernetes_plugin = _import_or_install()
-
- _do_delete_namespace(kubernetes_plugin)
-
diff --git a/cloudify/scripts/onap/delete_resources_services.py b/cloudify/scripts/onap/delete_resources_services.py
deleted file mode 100644
index 305a7484bd..0000000000
--- a/cloudify/scripts/onap/delete_resources_services.py
+++ /dev/null
@@ -1,132 +0,0 @@
-import pip
-
-from cloudify import ctx
-from cloudify.exceptions import NonRecoverableError
-
-
-SERVICES_FILE_PARTS_SEPARATOR = '---'
-
-
-def _import_or_install():
- try:
- import yaml
- except ImportError:
- pip.main(["install", "pyaml"])
-
- try:
- import cloudify_kubernetes.tasks as kubernetes_plugin
- except ImportError:
- pip.main([
- "install",
- "https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/archive/1.2.1rc1.zip"
- ])
-
- try:
- import jinja2
- except ImportError:
- pip.main(["install", "jinja2"])
-
- import yaml
- import jinja2
- import cloudify_kubernetes.tasks as kubernetes_plugin
-
- return yaml, kubernetes_plugin, jinja2
-
-
-def _init_jinja(jinja2):
- return jinja2.Environment(
- loader=jinja2.BaseLoader()
- )
-
-
-def _render_template(jinja_env, template_content, values):
- template_content = template_content.replace('.Values', 'Values')
-
- template = jinja_env.from_string(template_content)
- rendered_template = template.render(Values=values)
- return rendered_template
-
-
-def _retrieve_resources_paths():
- return ctx.node.properties.get('resources', [])
-
-
-def _retrieve_services_paths():
- return ctx.node.properties.get('services', None)
-
-
-def _retrieve_values(yaml):
- values_file_path = ctx.node.properties.get('values', None)
-
- if values_file_path:
- return yaml.load(ctx.get_resource(values_file_path))
-
- ctx.logger.warn('Values file not found')
-
-
-def _set_deployment_result(key):
- result = ctx.instance.runtime_properties.pop(key)
- ctx.instance.runtime_properties['kubernetes'] = result
-
-
-def _do_delete_resources(kubernetes_plugin, yaml, jinja_env, values):
- for path in _retrieve_resources_paths():
- ctx.logger.info('Deleting resource defined in: {0}'.format(path))
-
- template_content = ctx.get_resource(path)
- yaml_content = _render_template(
- jinja_env,
- template_content,
- values
- )
- content = yaml.load(yaml_content)
-
- _set_deployment_result(
- 'resource_{0}'.format(content['metadata']['name'])
- )
- kubernetes_plugin.resource_delete(definition=content)
-
- ctx.logger.info('Resources deleted successfully')
-
-
-def _do_delete_services(kubernetes_plugin, yaml, jinja_env, values):
- ctx.logger.info('Deleting services')
- services_file_path = _retrieve_services_paths()
-
- if not services_file_path:
- ctx.logger.warn(
- 'Service file is not defined. Skipping services provisioning !'
- )
-
- return
-
- template_content = ctx.get_resource(services_file_path)
- yaml_content = _render_template(
- jinja_env,
- template_content,
- values
- )
-
- yaml_content_parts = \
- yaml_content.split(SERVICES_FILE_PARTS_SEPARATOR)
-
- for yaml_content_part in yaml_content_parts:
- content = yaml.load(yaml_content_part)
-
- _set_deployment_result(
- 'service_{0}'.format(content['metadata']['name'])
- )
- kubernetes_plugin.resource_delete(definition=content)
-
- ctx.logger.info('Services deleted successfully')
-
-
-if __name__ == '__main__':
- yaml, kubernetes_plugin, jinja2 = _import_or_install()
- jinja_env = _init_jinja(jinja2)
- values = _retrieve_values(yaml)
-
- _do_delete_services(kubernetes_plugin, yaml, jinja_env, values)
- _do_delete_resources(kubernetes_plugin, yaml, jinja_env, values)
-
-
diff --git a/cloudify/scripts/tasks.py b/cloudify/scripts/tasks.py
deleted file mode 100644
index 035a780cb3..0000000000
--- a/cloudify/scripts/tasks.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-
-from fabric.api import run
-
-
-def label_node(labels, hostname):
- if labels:
- label_list = []
- for key, value in labels.items():
- label_pair_string = '%s=%s' % (key, value)
- label_list.append(label_pair_string)
- label_string = ' '.join(label_list)
- command = 'kubectl label nodes %s %s' % (hostname, label_string)
- run(command)
-
-
-def stop_node(hostname):
- command = 'kubectl drain %s' % (hostname)
- run(command)
-
-
-def delete_node(hostname):
- command = 'kubectl delete no %s' % (hostname)
- run(command)
diff --git a/cloudify/types/kubernetes.yaml b/cloudify/types/kubernetes.yaml
deleted file mode 100644
index 1698aa210e..0000000000
--- a/cloudify/types/kubernetes.yaml
+++ /dev/null
@@ -1,91 +0,0 @@
-inputs:
-
- join_command:
- type: string
-
- labels:
- default:
- app: { get_input: app_name }
-
- kubernetes_master_ip:
- type: string
-
- kubernetes_master_agent_user:
- default: { get_input: agent_user }
-
-node_types:
-
- cloudify.nodes.Kubernetes.Node:
- derived_from: cloudify.nodes.Root
- interfaces:
- cloudify.interfaces.lifecycle:
- create:
- implementation: cloudify/scripts/create.py
- configure:
- implementation: cloudify/scripts/configure_node.py
- inputs:
- join_command:
- default: { get_input: join_command }
- start:
- implementation: fabric.fabric_plugin.tasks.run_task
- inputs:
- tasks_file:
- default: cloudify/scripts/tasks.py
- task_name:
- default: label_node
- task_properties:
- default:
- hostname: { get_attribute: [ SELF, hostname ] }
- labels: { get_input: labels }
- fabric_env:
- default:
- host_string: { get_input: kubernetes_master_ip }
- user: { get_input: kubernetes_master_agent_user }
- key: { get_secret: agent_key_private }
-# stop:
-# implementation: fabric.fabric_plugin.tasks.run_task
-# inputs:
-# tasks_file:
-# default: cloudify/scripts/tasks.py
-# task_name:
-# default: stop_node
-# task_properties:
-# default:
-# hostname: { get_attribute: [ SELF, hostname ] }
-# fabric_env:
-# default:
-# host_string: { get_input: kubernetes_master_ip }
-# user: { get_input: kubernetes_master_agent_user }
-# key: { get_secret: agent_key_private }
- delete:
- implementation: fabric.fabric_plugin.tasks.run_task
- inputs:
- tasks_file:
- default: cloudify/scripts/tasks.py
- task_name:
- default: delete_node
- task_properties:
- default:
- hostname: { get_attribute: [ SELF, hostname ] }
- fabric_env:
- default:
- host_string: { get_input: kubernetes_master_ip }
- user: { get_input: kubernetes_master_agent_user }
- key: { get_secret: agent_key_private }
-
- cloudify.kubernetes.resources.Namespace:
- derived_from: cloudify.kubernetes.resources.Main
- properties:
- _api_mapping:
- default:
- create:
- api: CoreV1Api
- method: create_namespace
- payload: V1Namespace
- read:
- api: CoreV1Api
- method: read_namespace
- delete:
- api: CoreV1Api
- method: delete_namespace
- payload: V1DeleteOptions
diff --git a/cloudify/types/onap.yaml b/cloudify/types/onap.yaml
deleted file mode 100644
index 7e9b83425e..0000000000
--- a/cloudify/types/onap.yaml
+++ /dev/null
@@ -1,89 +0,0 @@
-node_types:
- cloudify.onap.kubernetes.Environment:
- derived_from: cloudify.nodes.Root
- properties:
- namespace:
- type: string
- init_pod:
- type: string
- description: >
- Path to init pod YAML file
- options:
- description: >
- For compatibility with kubernetes plugin.
- To be removed in the future.
- default: {}
- interfaces:
- cloudify.interfaces.lifecycle:
- create:
- implementation: cloudify/scripts/onap/create_namespace.py
- executor: central_deployment_agent
- start:
- implementation: cloudify/scripts/onap/create_init_pod.py
- executor: central_deployment_agent
- stop:
- implementation: cloudify/scripts/onap/delete_init_pod.py
- executor: central_deployment_agent
- delete:
- implementation: cloudify/scripts/onap/delete_namespace.py
- executor: central_deployment_agent
-
- cloudify.onap.kubernetes.App:
- derived_from: cloudify.nodes.Root
- properties:
- name:
- type: string
- description: >
- Name of ONAP app
- values:
- type: string
- description: >
- Paths (relative, blueprint prespective) to values.yaml file
- required: false
- resources:
- description: >
- List of paths (relative, blueprint prespective)
- to all kubernetes resources YAML files definition
- default: []
- services:
- type: string
- description: >
- Path (relative, blueprint prespective)
- to kubernetes app services YAML file definition
- default: []
- inputs:
- description: >
- Parameters required to create kubernetes resources for each app
- default: {}
- options:
- description: >
- For compatibility with kubernetes plugin.
- To be removed in the future.
- default: {}
- interfaces:
- cloudify.interfaces.lifecycle:
- create:
- implementation: cloudify/scripts/onap/create_namespace.py
- executor: central_deployment_agent
- configure:
- implementation: fabric.fabric_plugin.tasks.run_task
- executor: central_deployment_agent
- inputs:
- tasks_file:
- default: cloudify/scripts/onap/configure_docker_secret_workaround.py
- task_name:
- default: configure_secret
- fabric_env:
- default:
- host_string: { get_secret: kubernetes_master_ip }
- user: { get_secret: agent_user }
- key: { get_secret: agent_key_private }
- start:
- implementation: cloudify/scripts/onap/create_resources_services.py
- executor: central_deployment_agent
- stop:
- implementation: cloudify/scripts/onap/delete_resources_services.py
- executor: central_deployment_agent
- delete:
- implementation: cloudify/scripts/onap/delete_namespace.py
- executor: central_deployment_agent
diff --git a/onap-blueprint.yaml b/onap-blueprint.yaml
deleted file mode 100644
index 699312bea8..0000000000
--- a/onap-blueprint.yaml
+++ /dev/null
@@ -1,223 +0,0 @@
-tosca_definitions_version: cloudify_dsl_1_3
-
-description: >
- Blueprint deploys all ONAP kubernetes resources defined in YAML files on existing kubernetes cluster
- The following pre-setup steps are assumed, but not required:
- - Create Cloudify Example Environment: https://github.com/cloudify-examples/cloudify-environment-setup.
- - Create Kubernetes Cluster: https://github.com/cloudify-examples/simple-kubernetes-blueprint.
-
-imports:
- - https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/4.1/resources/rest-service/cloudify/types/types.yaml
- # Plugin required: https://github.com/cloudify-incubator/cloudify-kubernetes-plugin/releases/download/1.2.1rc1/cloudify_kubernetes_plugin-1.2.1rc1-py27-none-linux_x86_64-centos-Core.wgn
- - https://raw.githubusercontent.com/cloudify-incubator/cloudify-kubernetes-plugin/1.2.1rc1/plugin.yaml
- # Plugin required: http://repository.cloudifysource.org/cloudify/wagons/cloudify-fabric-plugin/1.4.2/cloudify_fabric_plugin-1.4.2-py27-none-linux_x86_64-centos-Core.wgn
- - http://www.getcloudify.org/spec/fabric-plugin/1.4.2/plugin.yaml
- - cloudify/types/onap.yaml
-
-inputs:
- kubernetes_configuration_file_content:
- description: >
- File content of kubernetes master YAML configuration
-
- namespace_prefix:
- type: string
- description: >
- Kubernetes namespace name prefix which will be uese for all ONAP apps
- default: onap
-
-dsl_definitions:
- options: &app_options
- namespace:
- concat: [{ get_input: namespace_prefix }, '-', { get_property: [SELF, name] }]
-
-node_templates:
- kubernetes_master:
- type: cloudify.kubernetes.nodes.Master
- properties:
- configuration:
- file_content: { get_input: kubernetes_configuration_file_content }
-
- onap_environment:
- type: cloudify.onap.kubernetes.Environment
- properties:
- namespace: { get_input: namespace_prefix }
- init_pod: kubernetes/config/pod-config-init.yaml
- options:
- namespace: { get_input: namespace_prefix }
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
-
- mso_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: mso
- values: kubernetes/mso/values.yaml
- resources:
- - kubernetes/mso/templates/mso-deployment.yaml
- - kubernetes/mso/templates/db-deployment.yaml
- services: kubernetes/mso/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- message_router_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: message-router
- values: kubernetes/message-router/values.yaml
- resources:
- - kubernetes/message-router/templates/message-router-zookeeper.yaml
- - kubernetes/message-router/templates/message-router-dmaap.yaml
- - kubernetes/message-router/templates/message-router-kafka.yaml
- services: kubernetes/message-router/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- sdc_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: sdc
- values: kubernetes/sdc/values.yaml
- resources:
- - kubernetes/sdc/templates/sdc-es.yaml
- - kubernetes/sdc/templates/sdc-fe.yaml
- - kubernetes/sdc/templates/sdc-kb.yaml
- - kubernetes/sdc/templates/sdc-cs.yaml
- - kubernetes/sdc/templates/sdc-be.yaml
- services: kubernetes/sdc/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- aai_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: aai
- values: kubernetes/aai/values.yaml
- resources:
- - kubernetes/aai/templates/aai-deployment.yaml
- - kubernetes/aai/templates/modelloader-deployment.yaml
- - kubernetes/aai/templates/hbase-deployment.yaml
- services: kubernetes/aai/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- robot_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: robot
- values: kubernetes/robot/values.yaml
- resources:
- - kubernetes/robot/templates/robot-deployment.yaml
- services: kubernetes/robot/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- vid_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: vid
- values: kubernetes/vid/values.yaml
- resources:
- - kubernetes/templates/vid-mariadb-deployment.yaml
- - kubernetes/templates/vid-server-deployment.yaml
- services: kubernetes/vid/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- sdnc_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: sdnc
- values: kubernetes/sdnc/values.yaml
- resources:
- - kubernetes/sdnc/templates/web-deployment.yaml
- - kubernetes/sdnc/templates/sdnc-deployment.yaml
- - kubernetes/sdnc/templates/dgbuilder-deployment.yaml
- - kubernetes/sdnc/templates/db-deployment.yaml
- services: kubernetes/sdnc/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- portal_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: portal
- values: kubernetes/portal/values.yaml
- resources:
- - kubernetes/portal/templates/portal-widgets-deployment.yaml
- - kubernetes/portal/templates/portal-apps-deployment.yaml
- - kubernetes/portal/templates/portal-mariadb-deployment.yaml
- - kubernetes/portal/templates/portal-vnc-dep.yaml
- services: kubernetes/portal/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- policy_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: policy
- values: kubernetes/policy/values.yaml
- resources:
- - kubernetes/policy/templates/dep-drools.yaml
- - kubernetes/policy/templates/dep-nexus.yaml
- - kubernetes/policy/templates/dep-brmsgw.yaml
- - kubernetes/policy/templates/dep-pdp.yaml
- - kubernetes/policy/templates/dep-pap.yaml
- - kubernetes/policy/templates/dep-maria.yaml
- - kubernetes/policy/templates/dep-pypdp.yaml
- services: kubernetes/policy/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment
-
- appc_app:
- type: cloudify.onap.kubernetes.App
- properties:
- name: appc
- values: kubernetes/appc/values.yaml
- resources:
- - kubernetes/appc/templates/appc-deployment.yaml
- - kubernetes/appc/templates/dgbuilder-deployment.yaml
- - kubernetes/appc/templates/db-deployment.yaml
- services: kubernetes/appc/templates/all-services.yaml
- options: *app_options
- relationships:
- - type: cloudify.kubernetes.relationships.managed_by_master
- target: kubernetes_master
- - type: cloudify.relationships.depends_on
- target: onap_environment