You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ma...@apache.org on 2015/01/13 11:43:11 UTC
stratos git commit: Add kubernetes artifacts to sample folder
Repository: stratos
Updated Branches:
refs/heads/master ebe197ff3 -> 05e20259a
Add kubernetes artifacts to sample folder
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/05e20259
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/05e20259
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/05e20259
Branch: refs/heads/master
Commit: 05e20259ad3251025f21320d6d33cf7d38ab4324
Parents: ebe197f
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Tue Jan 13 10:42:24 2015 +0000
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Tue Jan 13 10:42:24 2015 +0000
----------------------------------------------------------------------
.../kubernetes/artifacts/application.json | 23 ++++++++
.../kubernetes/artifacts/autoscale-policy.json | 14 +++++
.../kubernetes/artifacts/deployment-policy.json | 41 +++++++++++++++
.../artifacts/kubernetes-cluster.json | 55 ++++++++++++++++++++
.../kubernetes/artifacts/php-cartridge.json | 34 ++++++++++++
samples/single-cartridge/kubernetes/deploy.sh | 25 +++++++++
.../kubernetes/get-application.sh | 3 ++
.../kubernetes/get-deployment-policy.sh | 3 ++
.../kubernetes/list-applications.sh | 3 ++
9 files changed, 201 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/artifacts/application.json
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/artifacts/application.json b/samples/single-cartridge/kubernetes/artifacts/application.json
new file mode 100644
index 0000000..5ae8a70
--- /dev/null
+++ b/samples/single-cartridge/kubernetes/artifacts/application.json
@@ -0,0 +1,23 @@
+{
+ "applicationId":"single-cartridge-app",
+ "alias":"single-cartridge-app",
+ "components":{
+ "cartridges":[
+ {
+ "type":"php",
+ "cartridgeMin":1,
+ "cartridgeMax":10,
+ "subscribableInfo":{
+ "alias":"php",
+ "autoscalingPolicy":"autoscale-policy-1",
+ "artifactRepository":{
+ "privateRepo":false,
+ "repoUrl":"https://github.com/imesh/stratos-php-applications.git",
+ "repoUsername":"",
+ "repoPassword":""
+ }
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/artifacts/autoscale-policy.json
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/artifacts/autoscale-policy.json b/samples/single-cartridge/kubernetes/artifacts/autoscale-policy.json
new file mode 100644
index 0000000..918aadd
--- /dev/null
+++ b/samples/single-cartridge/kubernetes/artifacts/autoscale-policy.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscale-policy-1",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 50
+ },
+ "memoryConsumption": {
+ "threshold": 40
+ },
+ "loadAverage": {
+ "threshold": 40
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/artifacts/deployment-policy.json
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/artifacts/deployment-policy.json b/samples/single-cartridge/kubernetes/artifacts/deployment-policy.json
new file mode 100644
index 0000000..d150f93
--- /dev/null
+++ b/samples/single-cartridge/kubernetes/artifacts/deployment-policy.json
@@ -0,0 +1,41 @@
+{
+ "applicationId":"single-cartridge-app",
+ "applicationPolicy":{
+ "networkPartition":[
+ {
+ "id":"network-p1",
+ "kubernetesClusterId":"kubernetes-cluster-1",
+ "activeByDefault":"true",
+ "partitions":[
+ {
+ "id":"p1",
+ "provider":"kubernetes",
+ "property":[
+ {
+ "name":"region",
+ "value":"default"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "childPolicies":[
+ {
+ "alias":"php",
+ "networkPartition":[
+ {
+ "id":"network-p1",
+ "partitionAlgo":"one-after-another",
+ "partitions":[
+ {
+ "id":"p1",
+ "max":5
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/artifacts/kubernetes-cluster.json
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/artifacts/kubernetes-cluster.json b/samples/single-cartridge/kubernetes/artifacts/kubernetes-cluster.json
new file mode 100644
index 0000000..4873b70
--- /dev/null
+++ b/samples/single-cartridge/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":"10.100.0.136"
+ },
+ {
+ "name":"payload_parameter.MB_PORT",
+ "value":"1883"
+ },
+ {
+ "name":"payload_parameter.CEP_IP",
+ "value":"10.100.0.136"
+ },
+ {
+ "name":"payload_parameter.CEP_PORT",
+ "value":"7711"
+ },
+ {
+ "name":"payload_parameter.LOG_LEVEL",
+ "value":"DEBUG"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/artifacts/php-cartridge.json
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/artifacts/php-cartridge.json b/samples/single-cartridge/kubernetes/artifacts/php-cartridge.json
new file mode 100644
index 0000000..697adec
--- /dev/null
+++ b/samples/single-cartridge/kubernetes/artifacts/php-cartridge.json
@@ -0,0 +1,34 @@
+{
+ "type":"php",
+ "category":"framework",
+ "provider":"php.net",
+ "host":"php.stratos.org",
+ "displayName":"PHP",
+ "description":"PHP",
+ "version":"5.6",
+ "multiTenant":"false",
+ "portMapping":[
+ {
+ "protocol":"http",
+ "port":"80",
+ "proxyPort":"8280"
+ }
+ ],
+ "deployment":{
+ "baseDir":"/var/www"
+ },
+ "iaasProvider":[
+ {
+ "type":"kubernetes",
+ "imageId":"stratos/php:4.1.0-alpha",
+ "networkInterfaces":[
+ {
+ "name":"network-non-routable",
+ "networkUuid":""
+ }
+ ],
+ "property":[
+ ]
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/deploy.sh
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/deploy.sh b/samples/single-cartridge/kubernetes/deploy.sh
new file mode 100755
index 0000000..3d0f305
--- /dev/null
+++ b/samples/single-cartridge/kubernetes/deploy.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+echo "Adding autoscaling policy..."
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/autoscale-policy.json' -k -u admin:admin https://localhost:9443/api/autoscalingPolicies
+
+sleep 1
+
+echo "Adding php cartridge..."
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/php-cartridge.json' -k -u admin:admin https://localhost:9443/api/cartridges
+
+sleep 1
+
+echo "Adding kubernetes cluster..."
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/kubernetes-cluster.json' -k -u admin:admin https://localhost:9443/api/kubernetesClusters
+
+sleep 5
+
+echo "Adding application..."
+curl -X POST -H "Content-Type: application/json" -d @'artifacts/application.json' -k -u admin:admin https://localhost:9443/api/applications
+
+sleep 5
+
+echo "Deploying application..."
+curl -X POST -H "Content-Type: application/json" -d@'artifacts/deployment-policy.json' -k -v -u admin:admin https://localhost:9443/api/applications/single-cartridge-app/deploy
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/get-application.sh
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/get-application.sh b/samples/single-cartridge/kubernetes/get-application.sh
new file mode 100755
index 0000000..f7c30cb
--- /dev/null
+++ b/samples/single-cartridge/kubernetes/get-application.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+curl -X GET -H "Content-Type: application/json" -k -v -u admin:admin https://localhost:9443/api/applications/$1
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/get-deployment-policy.sh
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/get-deployment-policy.sh b/samples/single-cartridge/kubernetes/get-deployment-policy.sh
new file mode 100755
index 0000000..ec88eed
--- /dev/null
+++ b/samples/single-cartridge/kubernetes/get-deployment-policy.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+curl -X GET -H "Content-Type: application/json" -k -v -u admin:admin https://localhost:9443/api/applications/$1/deploymentPolicy
http://git-wip-us.apache.org/repos/asf/stratos/blob/05e20259/samples/single-cartridge/kubernetes/list-applications.sh
----------------------------------------------------------------------
diff --git a/samples/single-cartridge/kubernetes/list-applications.sh b/samples/single-cartridge/kubernetes/list-applications.sh
new file mode 100755
index 0000000..6607a8c
--- /dev/null
+++ b/samples/single-cartridge/kubernetes/list-applications.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+curl -X GET -H "Content-Type: application/json" -k -v -u admin:admin https://localhost:9443/api/applications
\ No newline at end of file