Install/uninstall helm chart 51/27751/7
authorJun Hu <jh245g@att.com>
Tue, 9 Jan 2018 20:11:05 +0000 (15:11 -0500)
committerJun (Nicolas) Hu <jh245g@att.com>
Thu, 15 Feb 2018 16:07:22 +0000 (16:07 +0000)
This TOSCA will deploy ONAP on the Kubernetes Cluster.

Issue-ID: OOM-46
Change-Id: I783a9fdec19b896470f61dd4ba13bbe0b2e01b0a
Signed-off-by: Nicolas Hu <jh245g@att.com>
TOSCA/Helm/helmdelete.sh [new file with mode: 0644]
TOSCA/Helm/helminstall.sh [new file with mode: 0644]
TOSCA/Helm/onap-blueprint.yaml [new file with mode: 0644]

diff --git a/TOSCA/Helm/helmdelete.sh b/TOSCA/Helm/helmdelete.sh
new file mode 100644 (file)
index 0000000..d3f342a
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T
+#
+# 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.
+#============LICENSE_END============================================
+
+helm delete $1-$2 --purge
+kubectl delete namespace $1-$2
+kubectl delete clusterrolebinding $1-$2-admin-binding
+
+
diff --git a/TOSCA/Helm/helminstall.sh b/TOSCA/Helm/helminstall.sh
new file mode 100644 (file)
index 0000000..96f38da
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T
+#
+# 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.
+#============LICENSE_END============================================
+
+printf "%s" "$*"
+printf `pwd`
+printf "%s" "---------------"
+kubectl create namespace $1-$2
+kubectl create clusterrolebinding $1-$2-admin-binding --clusterrole=cluster-admin --serviceaccount=$1-$2:default
+# assign default auth token
+if [[ -z $ONAP_DEFAULT_AUTH_TOKEN ]]; then
+  DEFAULT_SECRET=`kubectl get secrets -n $1-$2 | grep default-token |  awk '{ print $1}'`
+  ONAP_DEFAULT_AUTH_TOKEN=`kubectl get secrets $DEFAULT_SECRET -n $1-$2 -o yaml | grep  'token:'  | awk '{ print $2}' | base64 -d`
+fi
+kubectl --namespace $1-$2 create secret docker-registry $1-docker-registry-key --docker-server=nexus3.onap.org:10001 --docker-username=docker --docker-password=docker --docker-email=@
+helm install ../$2/ --name $1-$2 --namespace $1 --set nsPrefix=$1,nodePortPrefix=302,kubeMasterAuthToken=$ONAP_DEFAULT_AUTH_TOKEN
\ No newline at end of file
diff --git a/TOSCA/Helm/onap-blueprint.yaml b/TOSCA/Helm/onap-blueprint.yaml
new file mode 100644 (file)
index 0000000..092f743
--- /dev/null
@@ -0,0 +1,291 @@
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T
+#
+# 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.
+#============LICENSE_END============================================
+
+tosca_definitions_version: cloudify_dsl_1_3
+
+imports:
+  - http://www.getcloudify.org/spec/cloudify/3.4.2/types.yaml
+  - http://www.getcloudify.org/spec/fabric-plugin/1.5/plugin.yaml
+
+inputs:
+  # For agent, toggle to true.
+  install_method:
+    default: none # For fabric use false.
+  ip:
+  user:
+    default: centos
+  namespace_perfix:
+    default: onap
+
+node_types:
+  cloudify.nodes.Helm:
+    derived_from: cloudify.nodes.SoftwareComponent
+    properties:
+      cwd:
+        default: /home/centos/oom/kubernetes/oneclick
+      args:
+        default:
+        - onap
+        - mso
+    interfaces:
+      cloudify.interfaces.lifecycle:
+        # This is for fabric: # Run Anywhere.
+        start:
+          implementation: fabric.fabric_plugin.tasks.run_script
+          inputs:
+            script_path:
+              default: helminstall.sh # Relative to the blueprint file.
+            process:
+              default: &process_vars
+                cwd: { get_property: [ SELF, cwd ] }
+                args: { get_property: [ SELF, args ] }
+            fabric_env:
+              default: &fabric_env
+                user: { get_property: [ k8s_master, agent_config, user ] }
+                host_string: { get_property: [ k8s_master, ip ] }
+                key: { get_property: [ k8s_master, agent_config, key ] }
+        stop:
+          implementation: fabric.fabric_plugin.tasks.run_script
+          inputs:
+            script_path:
+              default: helmdelete.sh
+            process:
+              default: *process_vars
+            fabric_env:
+              default: *fabric_env
+
+node_templates:
+
+  k8s_master:
+     type: cloudify.nodes.Compute
+     properties:
+       ip: { get_input: ip }
+       agent_config:
+         install_method: { get_input: install_method } # False for Fabric.
+         key: { get_secret: agent_key_private }
+         user: { get_input: user }
+
+  consul:
+     type: cloudify.nodes.Helm
+     properties:
+       args:
+       - { get_input: namespace_perfix }
+       - consul
+     relationships:
+       - type: cloudify.relationships.connected_to
+         target: k8s_master
+
+  msb:
+     type: cloudify.nodes.Helm
+     properties:
+       args:
+       - { get_input: namespace_perfix }
+       - msb
+     relationships:
+       - type: cloudify.relationships.connected_to
+         target: k8s_master
+
+
+  mso:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - mso
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  appc:
+     type: cloudify.nodes.Helm
+     properties:
+       args:
+       - { get_input: namespace_perfix }
+       - appc
+     relationships:
+       - type: cloudify.relationships.connected_to
+         target: k8s_master
+
+  message-router:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - message-router
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  sdnc:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - sdnc
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  vid:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - vid
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  robot:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - robot
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  policy:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - policy
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  portal:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - portal
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  aai:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - aai
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  sdc:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - sdc
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  log:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - log
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  cli:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - cli
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  multicloud:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - multicloud
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  clamp:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - clamp
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  vnfsdk:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - vnfsdk
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  uui:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - uui
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  aaf:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - aaf
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  vfc:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - vfc
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
+  kube2msb:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace_perfix }
+      - kube2msb
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master