You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/01/19 17:48:25 UTC
[17/26] stratos git commit: single-group-v1 - Kubernetes sample
application
single-group-v1 - Kubernetes sample application
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d6078529
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d6078529
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d6078529
Branch: refs/heads/master
Commit: d60785295a42833b7c4c5d14bc122dfe10210fe8
Parents: 0d80d6a
Author: Vishanth <vi...@gmail.com>
Authored: Mon Jan 19 13:47:35 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Mon Jan 19 22:17:18 2015 +0530
----------------------------------------------------------------------
.../kubernetes/artifacts/app_single_group.json | 55 +++++++++++++++++++
.../artifacts/app_single_group.json-para | 46 ++++++++++++++++
.../kubernetes/artifacts/autoscale-policy.json | 14 +++++
.../kubernetes/artifacts/dep_single_group.json | 57 ++++++++++++++++++++
.../kubernetes/artifacts/group6c.json | 11 ++++
.../artifacts/kubernetes-cluster.json | 55 +++++++++++++++++++
.../kubernetes/artifacts/tomcat.json | 34 ++++++++++++
.../kubernetes/artifacts/tomcat1.json | 34 ++++++++++++
.../kubernetes/artifacts/tomcat2.json | 34 ++++++++++++
samples/single-group-v1/kubernetes/deploy.sh | 16 ++++++
10 files changed, 356 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/artifacts/app_single_group.json
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/app_single_group.json b/samples/single-group-v1/kubernetes/artifacts/app_single_group.json
new file mode 100644
index 0000000..a635f49
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/app_single_group.json
@@ -0,0 +1,55 @@
+{
+ "applicationId": "app_group_v1",
+ "alias": "mytestapp1",
+ "components": {
+ "groups": [
+ {
+ "name": "group6",
+ "alias": "mygroup6",
+ "groupMinInstances": 2,
+ "groupMaxInstances": 3,
+ "cartridges": [
+ {
+ "type": "tomcat2",
+ "cartridgeMin": 1,
+ "cartridgeMax": 1,
+ "subscribableInfo": {
+ "alias": "tom2group6",
+ "autoscalingPolicy": "autoscale_policy_1"
+ "artifactRepository":{
+ "privateRepo":false,
+ "repoUrl":"https://github.com/imesh/stratos-tomcat2-applications.git",
+ "repoUsername":"",
+ "repoPassword":""
+ }
+ }
+ }
+ ]
+ }
+ ],
+ "cartridges": [
+ {
+ "type": "tomcat",
+ "cartridgeMin": 1,
+ "cartridgeMax": 1,
+ "subscribableInfo": {
+ "alias": "mytomcat",
+ "autoscalingPolicy": "autoscale_policy_1"
+ "artifactRepository":{
+ "privateRepo":false,
+ "repoUrl":"https://github.com/imesh/stratos-tomcat-applications.git",
+ "repoUsername":"",
+ "repoPassword":""
+ }
+ }
+ }
+ ],
+ "dependencies": {
+ "startupOrders": [
+ "group.group6,cartridge.tomcat"
+ ],
+ "terminationBehaviour": "terminate-none"
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/artifacts/app_single_group.json-para
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/app_single_group.json-para b/samples/single-group-v1/kubernetes/artifacts/app_single_group.json-para
new file mode 100644
index 0000000..3ca673d
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/app_single_group.json-para
@@ -0,0 +1,46 @@
+{
+ "applicationId": "app_group_v1",
+ "alias": "mytestapp1",
+ "components": {
+ "groups" : [
+ {
+ "name": "group6",
+ "alias" : "mygroup6",
+ "groupMinInstances":1,
+ "groupMaxInstances":1,
+ "cartridges": [
+ {
+ "type": "tomcat2",
+ "cartridgeMin": 1,
+ "cartridgeMax": 2,
+ "subscribableInfo": {
+ "alias": "tom2group6",
+ "autoscalingPolicy": "autoscale_policy_1"
+ }
+ },
+ {
+ "type": "tomcat1",
+ "cartridgeMin": 1,
+ "cartridgeMax": 2,
+ "subscribableInfo": {
+ "alias": "tom1group6",
+ "autoscalingPolicy": "autoscale_policy_1"
+ }
+ }
+ ]
+ }
+ ],
+ "cartridges": [
+ {
+ "type": "tomcat",
+ "cartridgeMin": 1,
+ "cartridgeMax": 2,
+ "subscribableInfo": {
+ "alias": "mytomcat",
+ "autoscalingPolicy": "autoscale_policy_1"
+ }
+ }
+ ]
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/artifacts/autoscale-policy.json
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/autoscale-policy.json b/samples/single-group-v1/kubernetes/artifacts/autoscale-policy.json
new file mode 100755
index 0000000..9e9ad99
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/autoscale-policy.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscale_policy_1",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 80
+ },
+ "memoryConsumption": {
+ "threshold": 90
+ },
+ "loadAverage": {
+ "threshold": 50
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/artifacts/dep_single_group.json
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/dep_single_group.json b/samples/single-group-v1/kubernetes/artifacts/dep_single_group.json
new file mode 100644
index 0000000..272b09a
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/dep_single_group.json
@@ -0,0 +1,57 @@
+{
+ "applicationId": "app_group_v1",
+ "applicationPolicy": {
+ "networkPartition": [
+ {
+ "id":"network-p1",
+ "kubernetesClusterId":"kubernetes-cluster-1",
+ "activeByDefault": "true",
+ "partitions": [
+ {
+ "id": "P1",
+ "provider": "kubernetes",
+ "property": [
+ {
+ "name": "region",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "childPolicies": [
+ {
+ "alias": "mytomcat",
+ "networkPartition": [
+ {
+ "id": "network-p1",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "P1",
+ "max": 5
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "alias": "mygroup6",
+ "networkPartition": [
+ {
+ "id": "network-p1",
+ "partitionAlgo": "one-after-another",
+ "partitions": [
+ {
+ "id": "P1",
+ "max": 5
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/artifacts/group6c.json
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/group6c.json b/samples/single-group-v1/kubernetes/artifacts/group6c.json
new file mode 100644
index 0000000..8b0cac7
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/group6c.json
@@ -0,0 +1,11 @@
+{
+ "name": "group6",
+ "groupScalingEnabled": "true",
+ "cartridges": [
+ "tomcat1"
+ ],
+ "dependencies": {
+ "terminationBehaviour": "terminate-all"
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/artifacts/kubernetes-cluster.json
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/kubernetes-cluster.json b/samples/single-group-v1/kubernetes/artifacts/kubernetes-cluster.json
new file mode 100644
index 0000000..228eeb3
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/kubernetes-cluster.json
@@ -0,0 +1,55 @@
+{
+ "clusterId": "kubernetes-cluster-1",
+ "description": "Kubernetes CoreOS cluster",
+ "kubernetesMaster": {
+ "hostId" : "KubHostMaster1",
+ "hostname" : "master.dev.kubernetes.example.org",
+ "hostIpAddress" : "172.17.8.100",
+ "property" : [
+ ]
+ },
+
+ "portRange" : {
+ "upper": "5000",
+ "lower": "4500"
+ },
+
+ "kubernetesHosts": [
+ {
+ "hostId" : "KubHostSlave1",
+ "hostname" : "slave1.dev.kubernetes.example.org",
+ "hostIpAddress" : "172.17.8.101",
+ "property" : [
+ ]
+ },
+ {
+ "hostId" : "KubHostSlave2",
+ "hostname" : "slave2.dev.kubernetes.example.org",
+ "hostIpAddress" : "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/d6078529/samples/single-group-v1/kubernetes/artifacts/tomcat.json
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/tomcat.json b/samples/single-group-v1/kubernetes/artifacts/tomcat.json
new file mode 100755
index 0000000..f97105a
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/tomcat.json
@@ -0,0 +1,34 @@
+{
+ "type": "tomcat",
+ "provider": "apache",
+ "category": "data",
+ "host": "isuruh.lk",
+ "displayName": "tomcat",
+ "description": "tomcat Cartridge",
+ "version": "7",
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "protocol": "http",
+ "port": "22",
+ "proxyPort": "8280"
+ }
+ ],
+ "deployment":{
+ "baseDir":"/var/www"
+ },
+ "iaasProvider":[
+ {
+ "type":"kubernetes",
+ "imageId":"stratos/cartridge:4.1.0-alpha",
+ "networkInterfaces":[
+ {
+ "name":"network-non-routable",
+ "networkUuid":""
+ }
+ ],
+ "property":[
+ ]
+ }
+ ],
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/artifacts/tomcat1.json
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/tomcat1.json b/samples/single-group-v1/kubernetes/artifacts/tomcat1.json
new file mode 100755
index 0000000..d34bc5f
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/tomcat1.json
@@ -0,0 +1,34 @@
+{
+ "type": "tomcat1",
+ "provider": "apache",
+ "category": "data",
+ "host": "isuruh.lk",
+ "displayName": "tomcat1",
+ "description": "tomcat1 Cartridge",
+ "version": "7",
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "protocol": "http",
+ "port": "22",
+ "proxyPort": "8280"
+ }
+ ],
+ "deployment":{
+ "baseDir":"/var/www"
+ },
+ "iaasProvider":[
+ {
+ "type":"kubernetes",
+ "imageId":"stratos/cartridge:4.1.0-alpha",
+ "networkInterfaces":[
+ {
+ "name":"network-non-routable",
+ "networkUuid":""
+ }
+ ],
+ "property":[
+ ]
+ }
+ ],
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/artifacts/tomcat2.json
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/artifacts/tomcat2.json b/samples/single-group-v1/kubernetes/artifacts/tomcat2.json
new file mode 100755
index 0000000..500d648
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/artifacts/tomcat2.json
@@ -0,0 +1,34 @@
+{
+ "type": "tomcat2",
+ "provider": "apache",
+ "category": "data",
+ "host": "isuruh.lk",
+ "displayName": "tomcat2",
+ "description": "tomcat2 Cartridge",
+ "version": "7",
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "protocol": "http",
+ "port": "22",
+ "proxyPort": "8280"
+ }
+ ],
+ "deployment":{
+ "baseDir":"/var/www"
+ },
+ "iaasProvider":[
+ {
+ "type":"kubernetes",
+ "imageId":"stratos/cartridge:4.1.0-alpha",
+ "networkInterfaces":[
+ {
+ "name":"network-non-routable",
+ "networkUuid":""
+ }
+ ],
+ "property":[
+ ]
+ }
+ ],
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d6078529/samples/single-group-v1/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/single-group-v1/kubernetes/deploy.sh b/samples/single-group-v1/kubernetes/deploy.sh
new file mode 100755
index 0000000..e3fc05c
--- /dev/null
+++ b/samples/single-group-v1/kubernetes/deploy.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/autoscale-policy.json' -k -v -u admin:admin https://localhost:9443/api/autoscalingPolicies
+
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/tomcat.json' -k -v -u admin:admin https://localhost:9443/api/cartridges
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/tomcat1.json' -k -v -u admin:admin https://localhost:9443/api/cartridges
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/tomcat2.json' -k -v -u admin:admin https://localhost:9443/api/cartridges
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/group6c.json' -k -v -u admin:admin https://localhost:9443/api/cartridgeGroups
+
+sleep 3
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/app_single_group.json' -k -v -u admin:admin https://localhost:9443/api/applications
+
+sleep 3
+curl -X POST -H "Content-Type: application/json" -d@'artifacts/dep_single_group.json' -k -v -u admin:admin https://localhost:9443/api/applications/app_group_v1/deploy
+