You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/02/27 15:46:55 UTC

[32/50] [abbrv] stratos git commit: bringing deployment-policies, autoscaling-policies, network-partitions and kubernetes-clusters to global level in single-catridge application sample

bringing deployment-policies, autoscaling-policies, network-partitions and kubernetes-clusters to global level in single-catridge application sample


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d0ea5d85
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d0ea5d85
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d0ea5d85

Branch: refs/heads/master-deployment-policy-fix-merge
Commit: d0ea5d85ee6c140641a07a175b3cfbb6e9e663b8
Parents: a313172
Author: R-Rajkumar <rr...@gmail.com>
Authored: Thu Feb 26 18:52:44 2015 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Fri Feb 27 19:42:43 2015 +0530

----------------------------------------------------------------------
 .../single-cartridge/artifacts/application.json |  2 +-
 .../artifacts/autoscaling-policy.json           | 14 -----
 .../artifacts/deployment-policy.json            | 15 ------
 .../artifacts/ec2/deployment-policy.json        | 39 --------------
 .../artifacts/kubernetes/deployment-policy.json | 41 --------------
 .../kubernetes/kubernetes-cluster.json          | 56 --------------------
 .../artifacts/mock/deployment-policy.json       | 40 --------------
 .../artifacts/network-partition-2.json          | 15 ------
 .../artifacts/network-partition.json            | 15 ------
 .../artifacts/openstack/deployment-policy.json  | 40 --------------
 .../single-cartridge/scripts/common/deploy.sh   | 13 +++--
 .../single-cartridge/scripts/common/undeploy.sh |  9 +++-
 .../autoscaling-policy-1.json                   | 14 +++++
 .../deployment-policy-1.json                    | 15 ++++++
 .../kubernetes-cluster-1.json                   | 56 ++++++++++++++++++++
 .../mock/network-partition-1.json               | 15 ++++++
 .../mock/network-partition-2.json               | 15 ++++++
 17 files changed, 132 insertions(+), 282 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/application.json b/samples/applications/single-cartridge/artifacts/application.json
index d272c2b..5babe77 100644
--- a/samples/applications/single-cartridge/artifacts/application.json
+++ b/samples/applications/single-cartridge/artifacts/application.json
@@ -8,7 +8,7 @@
                 "type":"php",
                 "cartridgeMin": 1,
                 "cartridgeMax": 10,    
-				"subscribableInfo":{  
+		"subscribableInfo":{  
                	"alias":"my-php",
                	"autoscalingPolicy":"autoscaling-policy-1",
                 "deploymentPolicy":"deployment-policy-1",

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/autoscaling-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/autoscaling-policy.json b/samples/applications/single-cartridge/artifacts/autoscaling-policy.json
deleted file mode 100644
index 9f6a370..0000000
--- a/samples/applications/single-cartridge/artifacts/autoscaling-policy.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-  "id": "autoscaling-policy-1",
-  "loadThresholds": {
-    "requestsInFlight": {
-      "threshold": 50
-    },
-    "memoryConsumption": {
-      "threshold": 40
-    },
-    "loadAverage": {
-      "threshold": 40
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/deployment-policy.json b/samples/applications/single-cartridge/artifacts/deployment-policy.json
deleted file mode 100644
index 666c299..0000000
--- a/samples/applications/single-cartridge/artifacts/deployment-policy.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-   "id": "deployment-policy-1",
-   "networkPartition": [
-      {
-         "id": "network-partition-1",
-         "partitionAlgo": "one-after-another",
-         "partitions": [
-            {
-               "id": "partition-1",
-               "max": 5
-            }
-         ]
-      }
-   ]
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/ec2/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/ec2/deployment-policy.json b/samples/applications/single-cartridge/artifacts/ec2/deployment-policy.json
deleted file mode 100644
index 1e6e017..0000000
--- a/samples/applications/single-cartridge/artifacts/ec2/deployment-policy.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
-    "applicationPolicy": {
-        "networkPartition": [
-            {
-                "id": "network-partition-1",
-                "activeByDefault": "true",
-                "partitions": [
-                    {
-                        "id": "partition-1",
-                        "provider": "ec2",
-                        "property": [
-                            {
-                                "name": "region",
-                                "value": "default"
-                            }
-                        ]
-                    }
-                ]
-            }
-        ]
-    },
-    "childPolicies": [
-        {
-            "alias": "my-php",
-            "networkPartition": [
-                {
-                    "id": "network-partition-1",
-                    "partitionAlgo": "one-after-another",
-                    "partitions": [
-                        {
-                            "id": "partition-1",
-                            "max": 5
-                        }
-                    ]
-                }
-            ]
-        }
-    ]
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/kubernetes/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/kubernetes/deployment-policy.json b/samples/applications/single-cartridge/artifacts/kubernetes/deployment-policy.json
deleted file mode 100644
index 5b91bfd..0000000
--- a/samples/applications/single-cartridge/artifacts/kubernetes/deployment-policy.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
-    "applicationPolicy": {
-        "networkPartition": [
-            {
-                "id": "network-partition-1",
-                "activeByDefault": "true",
-                "kubernetesClusterId": "kubernetes-cluster-1",
-                "partitions": [
-                    {
-                        "id": "partition-1",
-                        "provider": "kubernetes",
-                        "property": [
-                            {
-                                "name": "region",
-                                "value": "default"
-                            }
-                        ]
-                    }
-                ]
-            }
-        ]
-    },
-    "childPolicies": [
-        {
-            "alias": "my-php",
-            "networkPartition": [
-                {
-                    "id": "network-partition-1",
-                    "partitionAlgo": "one-after-another",
-                    "partitions": [
-                        {
-                            "id": "partition-1",
-                            "max": 5
-                        }
-                    ]
-                }
-            ]
-        }
-    ]
-}
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/kubernetes/kubernetes-cluster.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/kubernetes/kubernetes-cluster.json b/samples/applications/single-cartridge/artifacts/kubernetes/kubernetes-cluster.json
deleted file mode 100644
index 2988ed1..0000000
--- a/samples/applications/single-cartridge/artifacts/kubernetes/kubernetes-cluster.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
-    "clusterId": "kubernetes-cluster-1",
-    "description": "Kubernetes CoreOS cluster",
-    "kubernetesMaster": {
-        "hostId": "KubHostMaster1",
-        "hostname": "master.dev.kubernetes.example.org",
-        "privateIPAddress": "172.17.8.100",
-        "publicIPAddress": "172.17.8.100",
-        "property": [
-        ]
-    },
-    "portRange": {
-        "upper": "5000",
-        "lower": "4500"
-    },
-    "kubernetesHosts": [
-        {
-            "hostId": "KubHostSlave1",
-            "hostname": "slave1.dev.kubernetes.example.org",
-            "privateIPAddress": "172.17.8.101",
-            "publicIPAddress": "172.17.8.101",
-            "property": [
-            ]
-        },
-        {
-            "hostId": "KubHostSlave2",
-            "hostname": "slave2.dev.kubernetes.example.org",
-            "privateIPAddress": "172.17.8.102",
-            "publicIPAddress": "172.17.8.102",
-            "property": [
-            ]
-        }
-    ],
-    "property": [
-        {
-            "name": "payload_parameter.MB_IP",
-            "value": "172.17.8.1"
-        },
-        {
-            "name": "payload_parameter.MB_PORT",
-            "value": "1883"
-        },
-        {
-            "name": "payload_parameter.CEP_IP",
-            "value": "172.17.8.1"
-        },
-        {
-            "name": "payload_parameter.CEP_PORT",
-            "value": "7711"
-        },
-        {
-            "name": "payload_parameter.LOG_LEVEL",
-            "value": "DEBUG"
-        }
-    ]
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/mock/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/mock/deployment-policy.json b/samples/applications/single-cartridge/artifacts/mock/deployment-policy.json
deleted file mode 100644
index 328681e..0000000
--- a/samples/applications/single-cartridge/artifacts/mock/deployment-policy.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-    "applicationPolicy": {
-        "networkPartition": [
-            {
-                "id": "network-partition-1",
-                "activeByDefault": "true",
-                "partitions": [
-                    {
-                        "id": "partition-1",
-                        "provider": "mock",
-                        "property": [
-                            {
-                                "name": "region",
-                                "value": "default"
-                            }
-                        ]
-                    }
-                ]
-            }
-        ]
-    },
-    "childPolicies": [
-        {
-            "alias": "my-php",
-            "networkPartition": [
-                {
-                    "id": "network-partition-1",
-                    "partitionAlgo": "one-after-another",
-                    "partitions": [
-                        {
-                            "id": "partition-1",
-                            "max": 5
-                        }
-                    ]
-                }
-            ]
-        }
-    ]
-}
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/network-partition-2.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/network-partition-2.json b/samples/applications/single-cartridge/artifacts/network-partition-2.json
deleted file mode 100644
index 0d07838..0000000
--- a/samples/applications/single-cartridge/artifacts/network-partition-2.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "id": "network-partition-2",
-    "partitions": [
-        {
-            "id": "partition-2",
-            "provider": "mock",
-            "property": [
-                {
-                    "name": "region",
-                    "value": "default"
-                }
-            ]
-        }
-    ]
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/network-partition.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/network-partition.json b/samples/applications/single-cartridge/artifacts/network-partition.json
deleted file mode 100644
index 2a5b7ec..0000000
--- a/samples/applications/single-cartridge/artifacts/network-partition.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "id": "network-partition-1",
-    "partitions": [
-        {
-            "id": "partition-1",
-            "provider": "mock",
-            "property": [
-                {
-                    "name": "region",
-                    "value": "default"
-                }
-            ]
-        }
-    ]
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/artifacts/openstack/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/artifacts/openstack/deployment-policy.json b/samples/applications/single-cartridge/artifacts/openstack/deployment-policy.json
deleted file mode 100644
index d2a0ec8..0000000
--- a/samples/applications/single-cartridge/artifacts/openstack/deployment-policy.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-    "applicationPolicy": {
-        "networkPartition": [
-            {
-                "id": "network-partition-1",
-                "activeByDefault": "true",
-                "partitions": [
-                    {
-                        "id": "partition-1",
-                        "provider": "openstack",
-                        "property": [
-                            {
-                                "name": "region",
-                                "value": "RegionOne"
-                            }
-                        ]
-                    }
-                ]
-            }
-        ]
-    },
-    "childPolicies": [
-        {
-            "alias": "my-php",
-            "networkPartition": [
-                {
-                    "id": "network-partition-1",
-                    "partitionAlgo": "one-after-another",
-                    "partitions": [
-                        {
-                            "id": "partition-1",
-                            "max": 5
-                        }
-                    ]
-                }
-            ]
-        }
-    ]
-}
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/scripts/common/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/scripts/common/deploy.sh b/samples/applications/single-cartridge/scripts/common/deploy.sh
index baec996..7d4424e 100755
--- a/samples/applications/single-cartridge/scripts/common/deploy.sh
+++ b/samples/applications/single-cartridge/scripts/common/deploy.sh
@@ -11,6 +11,9 @@ artifacts_path=`cd "${script_path}/../../artifacts"; pwd`
 iaas_artifacts_path=`cd "${script_path}/../../artifacts/${iaas}"; pwd`
 iaas_cartridges_path=`cd "${script_path}/../../../../cartridges/${iaas}"; pwd`
 cartridges_groups_path=`cd "${script_path}/../../../../cartridges-groups"; pwd`
+autoscaling_policies_path=`cd "${script_path}/../../../../autoscaling-policies"; pwd`
+network_partitions_path=`cd "${script_path}/../../../../network-partitions/${iaas}"; pwd`
+deployment_policies_path=`cd "${script_path}/../../../../deployment-policies"; pwd`
 
 set -e
 
@@ -19,16 +22,16 @@ if [[ -z "${iaas}" ]]; then
     exit
 fi
 
-echo ${artifacts_path}/autoscaling-policy.json
+echo ${autoscaling_policies_path}/autoscaling-policy-1.json
 echo "Adding autoscale policy..."
-curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/autoscaling-policy.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies
+curl -X POST -H "Content-Type: application/json" -d "@${autoscaling_policies_path}/autoscaling-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies
 
 echo "Adding network partitions..."
-curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/network-partition.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions
-curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/network-partition-2.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-1.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions
+curl -X POST -H "Content-Type: application/json" -d "@${network_partitions_path}/network-partition-2.json" -k -v -u admin:admin https://${host_ip}:9443/api/networkPartitions
 
 echo "Adding deployment policy..."
-curl -X POST -H "Content-Type: application/json" -d "@${artifacts_path}/deployment-policy.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
+curl -X POST -H "Content-Type: application/json" -d "@${deployment_policies_path}/deployment-policy-1.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies
 
 echo "Adding php cartridge..."
 curl -X POST -H "Content-Type: application/json" -d "@${iaas_cartridges_path}/php.json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/applications/single-cartridge/scripts/common/undeploy.sh
----------------------------------------------------------------------
diff --git a/samples/applications/single-cartridge/scripts/common/undeploy.sh b/samples/applications/single-cartridge/scripts/common/undeploy.sh
index 11c3a49..65499db 100644
--- a/samples/applications/single-cartridge/scripts/common/undeploy.sh
+++ b/samples/applications/single-cartridge/scripts/common/undeploy.sh
@@ -17,4 +17,11 @@ echo "Removing cartridges..."
 curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/cartridges/php
 
 echo "Removing autoscale policies..."
-curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1
\ No newline at end of file
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/autoscalingPolicies/autoscaling-policy-1
+
+echo "Removing deployment policies..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/deploymentPolicies/deployment-policy-1
+
+echo "Removing network partitions..."
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-1
+curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin https://${host_ip}:${host_port}/api/networkPartitions/network-partition-2

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/autoscaling-policies/autoscaling-policy-1.json
----------------------------------------------------------------------
diff --git a/samples/autoscaling-policies/autoscaling-policy-1.json b/samples/autoscaling-policies/autoscaling-policy-1.json
new file mode 100644
index 0000000..9f6a370
--- /dev/null
+++ b/samples/autoscaling-policies/autoscaling-policy-1.json
@@ -0,0 +1,14 @@
+{
+  "id": "autoscaling-policy-1",
+  "loadThresholds": {
+    "requestsInFlight": {
+      "threshold": 50
+    },
+    "memoryConsumption": {
+      "threshold": 40
+    },
+    "loadAverage": {
+      "threshold": 40
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/deployment-policies/deployment-policy-1.json
----------------------------------------------------------------------
diff --git a/samples/deployment-policies/deployment-policy-1.json b/samples/deployment-policies/deployment-policy-1.json
new file mode 100644
index 0000000..666c299
--- /dev/null
+++ b/samples/deployment-policies/deployment-policy-1.json
@@ -0,0 +1,15 @@
+{
+   "id": "deployment-policy-1",
+   "networkPartition": [
+      {
+         "id": "network-partition-1",
+         "partitionAlgo": "one-after-another",
+         "partitions": [
+            {
+               "id": "partition-1",
+               "max": 5
+            }
+         ]
+      }
+   ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/kubernets-clusters/kubernetes-cluster-1.json
----------------------------------------------------------------------
diff --git a/samples/kubernets-clusters/kubernetes-cluster-1.json b/samples/kubernets-clusters/kubernetes-cluster-1.json
new file mode 100644
index 0000000..2988ed1
--- /dev/null
+++ b/samples/kubernets-clusters/kubernetes-cluster-1.json
@@ -0,0 +1,56 @@
+{
+    "clusterId": "kubernetes-cluster-1",
+    "description": "Kubernetes CoreOS cluster",
+    "kubernetesMaster": {
+        "hostId": "KubHostMaster1",
+        "hostname": "master.dev.kubernetes.example.org",
+        "privateIPAddress": "172.17.8.100",
+        "publicIPAddress": "172.17.8.100",
+        "property": [
+        ]
+    },
+    "portRange": {
+        "upper": "5000",
+        "lower": "4500"
+    },
+    "kubernetesHosts": [
+        {
+            "hostId": "KubHostSlave1",
+            "hostname": "slave1.dev.kubernetes.example.org",
+            "privateIPAddress": "172.17.8.101",
+            "publicIPAddress": "172.17.8.101",
+            "property": [
+            ]
+        },
+        {
+            "hostId": "KubHostSlave2",
+            "hostname": "slave2.dev.kubernetes.example.org",
+            "privateIPAddress": "172.17.8.102",
+            "publicIPAddress": "172.17.8.102",
+            "property": [
+            ]
+        }
+    ],
+    "property": [
+        {
+            "name": "payload_parameter.MB_IP",
+            "value": "172.17.8.1"
+        },
+        {
+            "name": "payload_parameter.MB_PORT",
+            "value": "1883"
+        },
+        {
+            "name": "payload_parameter.CEP_IP",
+            "value": "172.17.8.1"
+        },
+        {
+            "name": "payload_parameter.CEP_PORT",
+            "value": "7711"
+        },
+        {
+            "name": "payload_parameter.LOG_LEVEL",
+            "value": "DEBUG"
+        }
+    ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/network-partitions/mock/network-partition-1.json
----------------------------------------------------------------------
diff --git a/samples/network-partitions/mock/network-partition-1.json b/samples/network-partitions/mock/network-partition-1.json
new file mode 100644
index 0000000..2a5b7ec
--- /dev/null
+++ b/samples/network-partitions/mock/network-partition-1.json
@@ -0,0 +1,15 @@
+{
+    "id": "network-partition-1",
+    "partitions": [
+        {
+            "id": "partition-1",
+            "provider": "mock",
+            "property": [
+                {
+                    "name": "region",
+                    "value": "default"
+                }
+            ]
+        }
+    ]
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/d0ea5d85/samples/network-partitions/mock/network-partition-2.json
----------------------------------------------------------------------
diff --git a/samples/network-partitions/mock/network-partition-2.json b/samples/network-partitions/mock/network-partition-2.json
new file mode 100644
index 0000000..0d07838
--- /dev/null
+++ b/samples/network-partitions/mock/network-partition-2.json
@@ -0,0 +1,15 @@
+{
+    "id": "network-partition-2",
+    "partitions": [
+        {
+            "id": "partition-2",
+            "provider": "mock",
+            "property": [
+                {
+                    "name": "region",
+                    "value": "default"
+                }
+            ]
+        }
+    ]
+}