Enhanced OOM TOSCA solution 71/43971/2
authorHong Guan <hg4105@att.com>
Fri, 20 Apr 2018 17:49:23 +0000 (13:49 -0400)
committerHong Guan <hg4105@att.com>
Fri, 20 Apr 2018 18:11:29 +0000 (18:11 +0000)
Issue-ID: OOM-979

Change-Id: I946013a73e85434292880790e487883f3be63493
Signed-off-by: Hong Guan <hg4105@att.com>
TOSCA/Helm/helmdelete.sh
TOSCA/Helm/helminstall.sh
TOSCA/Helm/k8s_delete_env.sh [new file with mode: 0644]
TOSCA/Helm/k8s_setup_env.sh [new file with mode: 0644]
TOSCA/Helm/onap-blueprint.yaml

index e098fbb..201471b 100644 (file)
@@ -16,8 +16,6 @@
 # limitations under the License.
 #============LICENSE_END============================================
 
-helm delete $1-$2 --purge
-kubectl delete namespace $1-$2
-kubectl delete clusterrolebinding $1-$2-admin-binding
+helm delete $2 --purge
 
 
index a6e09c8..f108825 100644 (file)
 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
+
+helm install local/$2 --name $2 --namespace $1
\ No newline at end of file
diff --git a/TOSCA/Helm/k8s_delete_env.sh b/TOSCA/Helm/k8s_delete_env.sh
new file mode 100644 (file)
index 0000000..c715e22
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright (c) 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============================================
+
+kubectl delete secret $1-docker-registry-key
+kubectl delete clusterrolebinding $1-admin-binding
+kubectl delete namespace $1
+
+
+
diff --git a/TOSCA/Helm/k8s_setup_env.sh b/TOSCA/Helm/k8s_setup_env.sh
new file mode 100644 (file)
index 0000000..1e226f2
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright (c) 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
+kubectl create clusterrolebinding $1-admin-binding --clusterrole=cluster-admin --serviceaccount=$1:default
+kubectl --namespace $1 create secret docker-registry $1-docker-registry-key --docker-server=nexus3.onap.org:10001 --docker-username=docker --docker-password=docker --docker-email=@
\ No newline at end of file
index f86b590..d11597f 100644 (file)
@@ -28,7 +28,7 @@ inputs:
   ip:
   user:
     default: centos
-  namespace_perfix:
+  namespace:
     default: onap
 
 node_types:
@@ -36,7 +36,7 @@ node_types:
     derived_from: cloudify.nodes.SoftwareComponent
     properties:
       cwd:
-        default: /home/centos/oom/kubernetes/oneclick
+        default: /home/centos/oom/kubernetes
       args:
         default:
         - onap
@@ -79,203 +79,261 @@ node_templates:
          key: { get_secret: agent_key_private }
          user: { get_input: user }
 
+  k8s_env:
+    type: cloudify.nodes.SoftwareComponent
+    properties:
+    interfaces:
+      cloudify.interfaces.lifecycle:
+         start:
+          implementation: fabric.fabric_plugin.tasks.run_script
+          inputs:
+            script_path: k8s_setup_env.sh
+            process:
+              args:  [{ get_input: namespace }]
+            fabric_env:
+              host_string: { get_input: ip }
+              user: { get_input: user }
+              key: { get_secret: agent_key_private }
+         stop:
+          implementation: fabric.fabric_plugin.tasks.run_script
+          inputs:
+            script_path: k8s_delete_env.sh
+            process:
+              args:  [{ get_input: namespace }]
+            fabric_env:
+              host_string: { get_input: ip }
+              user: { get_input: user }
+              key: { get_secret: agent_key_private }
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_master
+
   consul:
      type: cloudify.nodes.Helm
      properties:
        args:
-       - { get_input: namespace_perfix }
+       - { get_input: namespace }
        - consul
      relationships:
        - type: cloudify.relationships.connected_to
-         target: k8s_master
+         target: k8s_env
 
   msb:
      type: cloudify.nodes.Helm
      properties:
        args:
-       - { get_input: namespace_perfix }
+       - { get_input: namespace }
        - msb
      relationships:
        - type: cloudify.relationships.connected_to
-         target: k8s_master
+         target: k8s_env
 
-
-  mso:
+  so:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
-      - mso
+      - { get_input: namespace }
+      - so
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   appc:
      type: cloudify.nodes.Helm
      properties:
        args:
-       - { get_input: namespace_perfix }
+       - { get_input: namespace }
        - appc
      relationships:
        - type: cloudify.relationships.connected_to
-         target: k8s_master
+         target: k8s_env
 
   message-router:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - message-router
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   sdnc:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - sdnc
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   vid:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - vid
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   robot:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - robot
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   policy:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - policy
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   portal:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - portal
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   aai:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - aai
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   sdc:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - sdc
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   log:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - log
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   cli:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - cli
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   multicloud:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - multicloud
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   clamp:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - clamp
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   vnfsdk:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - vnfsdk
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   uui:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - uui
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   aaf:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - aaf
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
 
   vfc:
     type: cloudify.nodes.Helm
     properties:
       args:
-      - { get_input: namespace_perfix }
+      - { get_input: namespace }
       - vfc
     relationships:
       - type: cloudify.relationships.connected_to
-        target: k8s_master
+        target: k8s_env
+
+  dcaegen2:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace }
+      - dcaegen2
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_env
+
+  esr:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace }
+      - esr
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_env
+
+  mock:
+    type: cloudify.nodes.Helm
+    properties:
+      args:
+      - { get_input: namespace }
+      - mock
+    relationships:
+      - type: cloudify.relationships.connected_to
+        target: k8s_env
\ No newline at end of file