OpenShift 3 API documentation version v1beta1
http://localhost:8080/osapi/v1beta1
Overview
The OpenShift 3.x model attempts to expose underlying Docker and Kubernetes models as accurately as possible, with a focus on easy composition of applications by a developer (install Ruby, push code, add MySQL).
Unlike 2.x, more flexibility of configuration is exposed after creation in all aspects of the model. Terminology is still being weighed, but the concept of an application as a separate object is being removed in favor of more flexible composition of "services" - allowing two web containers to reuse a DB, or expose a DB directly to the edge of the network. The existing API will continue to be supported through 3.x, with concepts mapped as closely as possible to the new model.
Kubernetes API
OpenShift exposes Kubernetes API at http://localhost:8080/api/v1beta1/.
/aliases (NOT IMPLEMENTED)
List all aliases visible to you.
Aliases in v3 perform the same function as aliases in v2. The main difference is that in v3 an alias is associated with a service, not an application.
Create an alias for this service.
get /aliases
List all aliases visible to you.
Aliases in v3 perform the same function as aliases in v2. The main difference is that in v3 an alias is associated with a service, not an application.
Query Parameters
- serviceID: (string)
filter aliases by associated service.
HTTP status code 200
Body
Type: application/json
Example:
{
"list":
[
{
"id": "myalias",
"ssl_certificate": "-----BEGIN CERTIFICATE-----\nMIIDoDCCAogCCQDzF8AJCHnrbjANBgkqhkiG9w0BAQUFADCBkTELMAkGA1UEBhMC\nVVMxCzAJBgNVBAgMAkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJl\nZGhhdDESMBAGA1UECwwJb3BlbnNoaWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAm\nBgkqhkiG9w0BCQEWGWluZm9Ab3BlbnNoaWZ0LnJlZGhhdC5jb20wHhcNMTMwMjE5\nMjExMTQ4WhcNMTQwMjE5MjExMTQ4WjCBkTELMAkGA1UEBhMCVVMxCzAJBgNVBAgM\nAkNBMRIwEAYDVQQHDAlTdW5ueXZhbGUxDzANBgNVBAoMBnJlZGhhdDESMBAGA1UE\nCwwJb3BlbnNoaWZ0MRIwEAYDVQQDDAlvcGVuc2hpZnQxKDAmBgkqhkiG9w0BCQEW\nGWluZm9Ab3BlbnNoaWZ0LnJlZGhhdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB\nDwAwggEKAoIBAQDAEbH4MCi3iIDP1HS+/Xwu8SjdSc5WJX6htV7hJpmFZ8HohV/8\nba0v6aM9IJIIt+sIe2J62t/9G3leOdIHBxeACN4fV2l/iA/fvxvlnFKeD7sHm9Oc\nYj1H6YYJ57sIOf/oLDpJl6l3Rw8VC3+3W0/lzlVpA8qt7fpkiW7XQJCPplUSrdVC\n3okQ2T5NAod5+wVIOqELgE5bLX1LRs5VPsjytHkJ7rKXs55FHR3kpsoImn5xD0Ky\n6lRn8cIMolQoyN5HIGr8f5P+07hrHibve8jje/DKTssb5yEUAEmh6iGHQsRAnsUW\nQoIEUOLqQCu9re2No4G52Kl2xQIjyJF7rCfxAgMBAAEwDQYJKoZIhvcNAQEFBQAD\nggEBAGHrya/ZkiAje2kHsOajXMlO2+y1iLfUDcRLuEWpUa8sI5EM4YtemQrsupFp\n8lVYG5C4Vh8476oF9t8Wex5eH3ocwbSvPIUqE07hdmrubiMq4wxFVRYq7g9lHAnx\nl+bABuN/orbAcPcGAGg7AkXVoAc3Fza/ZcgMcw7NOtDTEss70V9OdgCfQUJL0KdO\nhCO8bQ1EaEiq6zEh8RpZe8mu+f/GYATX1I+eJUc6F6cn83oJjE9bqAVzk7TzTHeK\nEBKN50C14wWtXeG7n2+ugaVO+0xnvHeUrQBLHSRyOHqxXrQQ5XmzcaBiyI0f2IQM\nHst1BVXyX0n/L/ZoYYsv5juJmDo=\n-----END CERTIFICATE-----",
"private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAwBGx+DAot4iAz9R0vv18LvEo3UnOViV+obVe4SaZhWfB6IVf\n/G2tL+mjPSCSCLfrCHtietrf/Rt5XjnSBwcXgAjeH1dpf4gP378b5ZxSng+7B5vT\nnGI9R+mGCee7CDn/6Cw6SZepd0cPFQt/t1tP5c5VaQPKre36ZIlu10CQj6ZVEq3V\nQt6JENk+TQKHefsFSDqhC4BOWy19S0bOVT7I8rR5Ce6yl7OeRR0d5KbKCJp+cQ9C\nsupUZ/HCDKJUKMjeRyBq/H+T/tO4ax4m73vI43vwyk7LG+chFABJoeohh0LEQJ7F\nFkKCBFDi6kArva3tjaOBudipdsUCI8iRe6wn8QIDAQABAoIBAG/on4JVRRQSw8LU\nLiWt+jI7ryyoOUH2XL8JtzuGSwLwvomlVJT2rmbxQXx3Qr8zsgziHzIn30RRQrkF\nBXu0xRuDjzBBtSVqeJ1Mc4uoNncEAVxgjb5bewswZDnXPCGB8bosMtX4OPRXgdEo\nPwTtfjMOsrMaU3hd5Xu4m81tQA2BvwOlx8aYDyH0jeTnervc5uRGbeTBQG4Bu40E\nrWNmXvgNq2EzTAwbbN6Ma97gw9KgXnM4Nlh29Fxb5TBeUU9lkzuTZAZIDXKIm7AG\nUwMbj/A038yAumYQtThTE/3e4W3rn7F2Vko900bC4aAC1KQOAzjIeQqzqkVxWTWq\n4SUFQAECgYEA/ODwifOTuI6hdZK6JRgc4wp6Rc0fkqHuxLzABXoIGuSVlWyimqIN\nZySAkpo5EW6DNraRJxNCOBmWeGPEhHGrea+JPiPEwCK0F7SxvSmg3jzNzw3Es31T\necET7eDwuSOY9v4XDzLyiXXkEUUReD7Ng2hEYL+HaQrl5jWj4lxgq/ECgYEAwnCb\nKrz7FwX8AqtFAEi6uUrc12k1xYKQfrwSxbfdK2vBBUpgB71Iq/fqP+1BittEljDG\n8f4jEtMBFfEPhLzGIHaI3UiHUHXS4GetA77TRgR8lnKKpj1FcMIY2iKU479707O5\nQ08pgWRUDQ8BVg2ePgbo5QjLMc/rv7UF3AHvPAECgYB/auAIwqDGN6gHU/1TP4ke\npWLi1O55tfpXSzv+BnUbB96PQgPUop7aP7xBIlBrBiI7aVZOOBf/qHT3CF421geu\n8tHWa7NxlIrl/vgn9lfGYyDYmXlpb1amXLEsBVGGF/e1TGZWFDe9J5fZU9HvosVu\n1xTNIvSZ6xHYI2MGZcGYIQKBgEYeebaV5C7PV6xWu1F46O19U9rS9DM//H/XryVi\nQv4vo7IWuj7QQe7SPsXC98ntfPR0rqoCLf/R3ChfgGsr8H8wf/bc+v9HHj8S5E/f\ndy1e3Nccg2ej3PDm7jNsGSlwmmUkAQGHAL7KwYzcBm1UB+bycvZ1j2FtS+UckPpg\nMDgBAoGALD8PkxHb4U4DtbNFSYRrUdvS9heav/yph3lTMfifNkOir36io6v8RPgb\nD2bHKKZgmYlTgJrxD45Er9agC5jclJO35QRU/OfGf3GcnABkBI7vlvUKADAo65Sq\nweZkdJnbrIadcvLOHOzkKC9m+rxFTC9VoN1dwK2zwYvUXfa1VJA=\n-----END RSA PRIVATE KEY-----",
"pass_phrase": "abcd"
}
]
}
post /aliases
Create an alias for this service.
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"suffix": "dev.rhcloud.com",
"name": "mydomain",
"members": [
{
"login": "adminuser",
"role": "admin",
"type": "user",
"owner": true
}
]
}
}
Get a specific alias.
Update a specific alias.
Delete a specific alias.
get /aliases/{aliasID}
Get a specific alias.
URI Parameters
- aliasID: required (string)
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"suffix": "dev.rhcloud.com",
"name": "mydomain",
"members": [
{
"login": "adminuser",
"role": "admin",
"type": "user",
"owner": true
}
]
}
}
put /aliases/{aliasID}
Update a specific alias.
URI Parameters
- aliasID: required (string)
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"suffix": "dev.rhcloud.com",
"name": "mydomain",
"members": [
{
"login": "adminuser",
"role": "admin",
"type": "user",
"owner": true
}
]
}
}
/buildConfigHooks/{buildID}/{secret}/{plugin}
Webhook on push event from external repository.
buildID specifies which build to trigger, whereas plugin defines source of the request, this might be github, bitbucket or others.
post /buildConfigHooks/{buildID}/{secret}/{plugin}
Webhook on push event from external repository.
buildID specifies which build to trigger, whereas plugin defines source of the request, this might be github, bitbucket or others.
URI Parameters
- buildID: required (string)
- secret: required (string)
- plugin: required (string)
HTTP status code 204
No content
/buildConfigs
List all BuildConfigs.
BuildConfig contains the inputs needed to produce a new deployable image.
Create a new build.
post /buildConfigs
Create a new build.
Body
Type: application/json
Example:
{
"kind": "BuildConfig",
"apiVersion": "v1beta1",
"desiredInput": {
"type": "sti",
"sourceURI": "git://github.com/pmorie/simple-ruby",
"builderImage": "openshift/ruby-19-centos",
"imageTag": "test-ruby-app"
}
}
Get a specific build configuration.
Update a specific build configuration.
Delete a specific build configuration.
get /buildConfigs/{configID}
Get a specific build configuration.
URI Parameters
- configID: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-16T19:33:36Z",
"desiredInput": {
"builderImage": "openshift/ruby-19-centos",
"imageTag": "test-ruby-app",
"registry": "localhost:5000",
"sourceURI": "git://github.com/pmorie/simple-ruby",
"type": "sti"
},
"id": "5a6a5b9c-3dd8-11e4-9d75-0800279696e1",
"kind": "BuildConfig",
"resourceVersion": 117
}
put /buildConfigs/{configID}
Update a specific build configuration.
URI Parameters
- configID: required (string)
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-16T19:33:36Z",
"desiredInput": {
"builderImage": "openshift/ruby-19-centos",
"imageTag": "test-ruby-app",
"registry": "localhost:5000",
"sourceURI": "git://github.com/pmorie/simple-ruby",
"type": "sti"
},
"id": "5a6a5b9c-3dd8-11e4-9d75-0800279696e1",
"kind": "BuildConfig",
"resourceVersion": 117
}
/builds
List all builds.
Build encapsulates the inputs needed to produce a new deployable image, as well as the status of the operation and a reference to the Pod which runs the build.
Create a new build.
get /builds
List all builds.
Build encapsulates the inputs needed to produce a new deployable image, as well as the status of the operation and a reference to the Pod which runs the build.
HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"items": [
{
"creationTimestamp": "2014-09-16T02:58:19Z",
"id": "5065bcf2-3d4d-11e4-a95b-0800279696e1",
"input": {
"imageTag": "test/dockerbuild",
"sourceURI": "git://github.com/test/dockerbuild",
"type": "docker"
},
"podID": "build-sti-5065bcf2-3d4d-11e4-a95b-0800279696e1",
"resourceVersion": 114,
"status": "new"
}
],
"kind": "BuildList",
"resourceVersion": 116
}
post /builds
Create a new build.
Body
Type: application/json
Example:
{
"kind": "Build",
"apiVersion": "v1beta1",
"input": {
"type": "docker",
"sourceURI": "github.com/test/dockerBuild",
"imageTag": "test/dockerBuild"
}
}
Get details about a specific build.
Update a specific build.
Delete a specific build.
get /builds/{buildID}
Get details about a specific build.
URI Parameters
- buildID: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-16T02:58:19Z",
"id": "5065bcf2-3d4d-11e4-a95b-0800279696e1",
"input": {
"imageTag": "test/dockerBuild",
"sourceURI": "github.com/test/dockerBuild",
"type": "docker"
},
"kind": "Build",
"podID": "build-sti-5065bcf2-3d4d-11e4-a95b-0800279696e1",
"resourceVersion": 114,
"status": "pending"
}
put /builds/{buildID}
Update a specific build.
URI Parameters
- buildID: required (string)
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-16T02:58:19Z",
"id": "5065bcf2-3d4d-11e4-a95b-0800279696e1",
"input": {
"imageTag": "test/dockerBuild",
"sourceURI": "github.com/test/dockerBuild",
"type": "docker"
},
"kind": "Build",
"podID": "build-sti-5065bcf2-3d4d-11e4-a95b-0800279696e1",
"resourceVersion": 114,
"status": "pending"
}
/configs (NOT IMPLEMENTED)
List all configs that your account has access to.
A config defines 0..n Kubernetes resources.
Create a new config.
post /configs
Create a new config.
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-03/schema",
"type": "object",
"required": true,
"description": "Config resource.",
"properties": {
"id": {
"type": "string",
"required": true
},
"name": {
"type": "string",
"required": true
},
"description": {
"type": "string",
"required": false
},
"items": {
"type": "array",
"required": false,
"items": {
"type": "object",
"required": true,
"properties": {
"kind": {
"type": "string",
"required": true
},
"id": {
"type": "string",
"required": true
}
}
}
}
}
}Example:
{
"kind": "Config",
"id": "example1",
"name": "My awesome PHP app",
"description": "Example PHP application with PostgreSQL database",
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-22T09:48:27Z",
"items": [
{
"kind": "Service",
"id": "frontend",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"port": 8080,
"containerPort": 9292,
"selector": {
"name": "frontend"
}
},
{
"kind": "Service",
"id": "database",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"port": 5432,
"containerPort": 5432,
"selector": {
"name": "database"
}
},
{
"kind": "ReplicationController",
"id": "frontendController",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"desiredState": {
"replicas": 2,
"replicaSelector": {
"name": "frontend"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "frontendController",
"volumes": null,
"containers": [
{
"name": "nginx-php-app",
"image": "mfojtik/nginx-php-app",
"ports": [
{
"hostPort": 8080,
"containerPort": 9292,
"protocol": "TCP"
}
],
"env": [
{
"name": "PGPASSWORD",
"key": "PGPASSWORD",
"value": "MPbGM5T0"
},
{
"name": "PGUSER",
"key": "PGUSER",
"value": "adminO8bR"
},
{
"name": "PGDATABASE",
"key": "PGDATABASE",
"value": "mydb"
}
]
}
]
},
"restartpolicy": {}
},
"labels": {
"name": "frontend"
}
}
},
"labels": {
"name": "frontend"
}
},
{
"kind": "Pod",
"id": "postgresql",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"labels": {
"name": "database"
},
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "database",
"volumes": null,
"containers": [
{
"name": "postgresql",
"image": "postgres",
"ports": [
{
"hostPort": 5432,
"containerPort": 5432,
"protocol": "TCP"
}
],
"env": [
{
"name": "PGPASSWORD",
"key": "PGPASSWORD",
"value": "MPbGM5T0"
},
{
"name": "PGUSER",
"key": "PGUSER",
"value": "adminO8bR"
},
{
"name": "PGDATABASE",
"key": "PGDATABASE",
"value": "mydb"
}
]
}
]
},
"restartpolicy": {
"type": "RestartAlways"
}
},
"currentState": {
"manifest": {
"version": "",
"id": "",
"volumes": null,
"containers": null
},
"restartpolicy": {}
}
}
]
}HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"kind": "Status",
"status": "success"
}
Get a specific config.
Update a specific config.
Delete a specific config.
get /configs/{configID}
Get a specific config.
URI Parameters
- configID: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
"kind": "Config",
"id": "example1",
"name": "My awesome PHP app",
"description": "Example PHP application with PostgreSQL database",
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-22T09:48:27Z",
"items": [
{
"kind": "Service",
"id": "frontend",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"port": 8080,
"containerPort": 9292,
"selector": {
"name": "frontend"
}
},
{
"kind": "Service",
"id": "database",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"port": 5432,
"containerPort": 5432,
"selector": {
"name": "database"
}
},
{
"kind": "ReplicationController",
"id": "frontendController",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"desiredState": {
"replicas": 2,
"replicaSelector": {
"name": "frontend"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "frontendController",
"volumes": null,
"containers": [
{
"name": "nginx-php-app",
"image": "mfojtik/nginx-php-app",
"ports": [
{
"hostPort": 8080,
"containerPort": 9292,
"protocol": "TCP"
}
],
"env": [
{
"name": "PGPASSWORD",
"key": "PGPASSWORD",
"value": "MPbGM5T0"
},
{
"name": "PGUSER",
"key": "PGUSER",
"value": "adminO8bR"
},
{
"name": "PGDATABASE",
"key": "PGDATABASE",
"value": "mydb"
}
]
}
]
},
"restartpolicy": {}
},
"labels": {
"name": "frontend"
}
}
},
"labels": {
"name": "frontend"
}
},
{
"kind": "Pod",
"id": "postgresql",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"labels": {
"name": "database"
},
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "database",
"volumes": null,
"containers": [
{
"name": "postgresql",
"image": "postgres",
"ports": [
{
"hostPort": 5432,
"containerPort": 5432,
"protocol": "TCP"
}
],
"env": [
{
"name": "PGPASSWORD",
"key": "PGPASSWORD",
"value": "MPbGM5T0"
},
{
"name": "PGUSER",
"key": "PGUSER",
"value": "adminO8bR"
},
{
"name": "PGDATABASE",
"key": "PGDATABASE",
"value": "mydb"
}
]
}
]
},
"restartpolicy": {
"type": "RestartAlways"
}
},
"currentState": {
"manifest": {
"version": "",
"id": "",
"volumes": null,
"containers": null
},
"restartpolicy": {}
}
}
]
}/deploymentConfigs
List all DeploymentConfigs.
A DeploymentConfig represents a configuration for a single deployment of a replication controller: a template for the deployment, how new deployments are triggered, what the current deployed state is.
Create a new build.
get /deploymentConfigs
List all DeploymentConfigs.
A DeploymentConfig represents a configuration for a single deployment of a replication controller: a template for the deployment, how new deployments are triggered, what the current deployed state is.
HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"kind": "DeploymentConfigList",
"items": [
{
"id": "redisslave-config",
"kind": "DeploymentConfig",
"apiVersion": "v1beta1",
"triggerPolicy": "manual",
"template": {
"strategy": {
"type": "customPod",
"customPod": {
"image": "127.0.0.1:5000/openshift/kube-deploy"
}
},
"controllerTemplate": {
"replicas": 2,
"replicaSelector": {
"name": "redisslave"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redisSlaveController",
"containers": [
{
"name": "slave",
"image": "brendanburns/redis-slave",
"env": [
{
"name": "REDIS_PASSWORD",
"value": "secret"
}
],
"ports": [
{
"containerPort": 6379
}
]
}
]
}
},
"labels": {
"name": "redisslave"
}
}
}
}
}
]
}
post /deploymentConfigs
Create a new build.
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"kind": "Status",
"status": "success"
}
Get a specific build configuration.
Update a specific build configuration.
Delete a specific build configuration.
get /deploymentConfigs/{configID}
Get a specific build configuration.
URI Parameters
- configID: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
"id": "redisslave-config",
"kind": "DeploymentConfig",
"apiVersion": "v1beta1",
"triggerPolicy": "manual",
"template": {
"strategy": {
"type": "customPod",
"customPod": {
"image": "127.0.0.1:5000/openshift/kube-deploy"
}
},
"controllerTemplate": {
"replicas": 2,
"replicaSelector": {
"name": "redisslave"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redisSlaveController",
"containers": [
{
"name": "slave",
"image": "brendanburns/redis-slave",
"env": [
{
"name": "REDIS_PASSWORD",
"value": "secret"
}
],
"ports": [
{
"containerPort": 6379
}
]
}
]
}
},
"labels": {
"name": "redisslave"
}
}
}
}
}
put /deploymentConfigs/{configID}
Update a specific build configuration.
URI Parameters
- configID: required (string)
Body
Type: application/json
Example:
{
"id": "redisslave-config",
"kind": "DeploymentConfig",
"apiVersion": "v1beta1",
"triggerPolicy": "manual",
"template": {
"strategy": {
"type": "customPod",
"customPod": {
"image": "127.0.0.1:5000/openshift/kube-deploy"
}
},
"controllerTemplate": {
"replicas": 2,
"replicaSelector": {
"name": "redisslave"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redisSlaveController",
"containers": [
{
"name": "slave",
"image": "brendanburns/redis-slave",
"env": [
{
"name": "REDIS_PASSWORD",
"value": "secret"
}
],
"ports": [
{
"containerPort": 6379
}
]
}
]
}
},
"labels": {
"name": "redisslave"
}
}
}
}
}
/deployments
List all deployments.
A deployment represents a single unique realization of a deployment config.
Create a new deployment.
get /deployments
List all deployments.
A deployment represents a single unique realization of a deployment config.
HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"kind": "DeploymentList",
"items": [
{
"id": "redisslave-deploy",
"kind": "Deployment",
"apiVersion": "v1beta1",
"triggerPolicy": "manual",
"configId": "redisslave-config",
"strategy": {
"type": "customPod",
"customPod": {
"image": "127.0.0.1:5000/openshift/kube-deploy"
}
},
"controllerTemplate": {
"replicas": 2,
"replicaSelector": {
"name": "redisslave"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redisSlaveController",
"containers": [
{
"name": "slave",
"image": "brendanburns/redis-slave",
"env": [
{
"name": "REDIS_PASSWORD",
"value": "secret"
}
],
"ports": [
{
"containerPort": 6379
}
]
}
]
}
},
"labels": {
"name": "redisslave"
}
}
}
}
]
}
post /deployments
Create a new deployment.
Body
Type: application/json
Example:
{
"id": "redisslave-deploy",
"kind": "Deployment",
"apiVersion": "v1beta1",
"triggerPolicy": "manual",
"configId": "redisslave-config",
"strategy": {
"type": "customPod",
"customPod": {
"image": "127.0.0.1:5000/openshift/kube-deploy"
}
},
"controllerTemplate": {
"replicas": 2,
"replicaSelector": {
"name": "redisslave"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redisSlaveController",
"containers": [
{
"name": "slave",
"image": "brendanburns/redis-slave",
"env": [
{
"name": "REDIS_PASSWORD",
"value": "secret"
}
],
"ports": [
{
"containerPort": 6379
}
]
}
]
}
},
"labels": {
"name": "redisslave"
}
}
}
}
Get details about a specific deployment.
Update a specific deployment.
Delete a specific deployment.
get /deployments/{deploymentID}
Get details about a specific deployment.
URI Parameters
- deploymentID: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
"id": "redisslave-deploy",
"kind": "Deployment",
"apiVersion": "v1beta1",
"triggerPolicy": "manual",
"configId": "redisslave-config",
"strategy": {
"type": "customPod",
"customPod": {
"image": "127.0.0.1:5000/openshift/kube-deploy"
}
},
"controllerTemplate": {
"replicas": 2,
"replicaSelector": {
"name": "redisslave"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redisSlaveController",
"containers": [
{
"name": "slave",
"image": "brendanburns/redis-slave",
"env": [
{
"name": "REDIS_PASSWORD",
"value": "secret"
}
],
"ports": [
{
"containerPort": 6379
}
]
}
]
}
},
"labels": {
"name": "redisslave"
}
}
}
}
put /deployments/{deploymentID}
Update a specific deployment.
URI Parameters
- deploymentID: required (string)
Body
Type: application/json
Example:
{
"id": "redisslave-deploy",
"kind": "Deployment",
"apiVersion": "v1beta1",
"triggerPolicy": "manual",
"configId": "redisslave-config",
"strategy": {
"type": "customPod",
"customPod": {
"image": "127.0.0.1:5000/openshift/kube-deploy"
}
},
"controllerTemplate": {
"replicas": 2,
"replicaSelector": {
"name": "redisslave"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redisSlaveController",
"containers": [
{
"name": "slave",
"image": "brendanburns/redis-slave",
"env": [
{
"name": "REDIS_PASSWORD",
"value": "secret"
}
],
"ports": [
{
"containerPort": 6379
}
]
}
]
}
},
"labels": {
"name": "redisslave"
}
}
}
}
/imageRepositories
List all image repositories.
An image repository is a collection of images that share the same metadata. It may reference a Docker image repository on a Docker registry, but this is optional. An image repository also contains a mapping of tags to images.
Create a new image repository.
get /imageRepositories
List all image repositories.
An image repository is a collection of images that share the same metadata. It may reference a Docker image repository on a Docker registry, but this is optional. An image repository also contains a mapping of tags to images.
HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"items": [
{
"creationTimestamp": "2014-09-10T12:23:01-04:00",
"dockerImageRepository": "localhost:5000/someproject/somerepo",
"id": "somerepo",
"resourceVersion": 17,
"tags": {
"c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"latest": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b"
}
},
{
"creationTimestamp": "2014-09-10T09:33:42-04:00",
"dockerImageRepository": "openshift/ruby-19-centos",
"id": "test",
"labels": {
"color": "blue"
},
"resourceVersion": 14,
"tags": {
"latest": "120e218dd395ec314e7b6249f39d2853911b3d6def6ea164ae05722649f34b16"
}
}
],
"kind": "ImageRepositoryList",
"resourceVersion": 22
}
post /imageRepositories
Create a new image repository.
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"dockerImageRepository": "openshift/ruby-19-centos",
"id": "test",
"kind": "ImageRepository",
"labels": {
"color": "blue"
},
"tags": {
"latest": "120e218dd395ec314e7b6249f39d2853911b3d6def6ea164ae05722649f34b16"
}
}
Get information about a specific image repository.
Update an image repository.
Delete an image repository.
get /imageRepositories/{repositoryID}
Get information about a specific image repository.
URI Parameters
- repositoryID: required (string)
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-10T09:33:42-04:00",
"dockerImageRepository": "openshift/ruby-19-centos",
"id": "test",
"kind": "ImageRepository",
"labels": {
"color": "blue"
},
"resourceVersion": 14,
"tags": {
"latest": "120e218dd395ec314e7b6249f39d2853911b3d6def6ea164ae05722649f34b16"
}
}
put /imageRepositories/{repositoryID}
Update an image repository.
URI Parameters
- repositoryID: required (string)
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-10T09:33:42-04:00",
"dockerImageRepository": "openshift/ruby-19-centos",
"id": "test",
"kind": "ImageRepository",
"labels": {
"color": "blue"
},
"resourceVersion": 14,
"tags": {
"latest": "120e218dd395ec314e7b6249f39d2853911b3d6def6ea164ae05722649f34b16"
}
}
/imageRepositoryMappings
Create an image and update an image repository.
This is designed as a webhook that a Docker registry can invoke when a new tag is created. The image repository mapping contains a reference to the repository, the image's metadata, and the name of the new tag. Upon execution, a new image is created if it doesn't already exist, and the image repository is updated with the new tag.
post /imageRepositoryMappings
Create an image and update an image repository.
This is designed as a webhook that a Docker registry can invoke when a new tag is created. The image repository mapping contains a reference to the repository, the image's metadata, and the name of the new tag. Upon execution, a new image is created if it doesn't already exist, and the image repository is updated with the new tag.
Body
Type: application/json
Example:
{
"dockerImageRepository": "localhost:5000/someproject/somerepo",
"image": {
"dockerImageReference": "localhost:5000/someproject/somerepo:c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"id": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"metadata": {
"Size": 0,
"architecture": "amd64",
"config": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": [
"/bin/sh"
],
"CpuShares": 0,
"Cpuset": "",
"Domainname": "",
"Entrypoint": null,
"Env": [
"c=e",
"b=2",
"a=1",
"HOME=/",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"ExposedPorts": null,
"Hostname": "",
"Image": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OnBuild": null,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"WorkingDir": ""
},
"container": "6b03c2dda0f8cbfa6186d96557e35e35c61915a70e4217a465f92f26c2d9290b",
"container_config": {
"AttachStderr": true,
"AttachStdin": false,
"AttachStdout": true,
"Cmd": [
"/bin/sh"
],
"CpuShares": 0,
"Cpuset": "",
"Domainname": "",
"Entrypoint": null,
"Env": [
"c=e",
"b=2",
"a=1",
"HOME=/",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"ExposedPorts": null,
"Hostname": "6b03c2dda0f8",
"Image": "localhost:5000/someproject/somerepo",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OnBuild": null,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"WorkingDir": ""
},
"created": "2014-09-04T17:43:39.863545902Z",
"docker_version": "1.1.2",
"id": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"os": "linux",
"parent": "32730be9f383719ce6308329c8ee5aac189ece9e41928dc10b8bc0fc35e9d1d5"
}
},
"kind": "ImageRepositoryMapping",
"tag": "latest",
"version": "v1beta1"
}
/images
List all images.
An image is a reference to an image in a Docker image repository on a Docker registry, plus a set of metadata. The metadata that Openshift stores for an image will augment the metadata that has already been specified in the image through its Dockerfile.
Create a new image definition.
get /images
List all images.
An image is a reference to an image in a Docker image repository on a Docker registry, plus a set of metadata. The metadata that Openshift stores for an image will augment the metadata that has already been specified in the image through its Dockerfile.
HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"items": [
{
"creationTimestamp": "2014-09-10T09:33:43-04:00",
"dockerImageReference": "openshift/ruby-19-centos:latest",
"id": "abcd1234",
"metadata": {
"Size": 0,
"containerconfig": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": null,
"CpuShares": 0,
"Dns": null,
"Domainname": "",
"Entrypoint": null,
"Env": null,
"ExposedPorts": null,
"Hostname": "",
"Image": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": ""
},
"created": "0001-01-01T00:00:00Z",
"id": ""
},
"resourceVersion": 15
},
{
"creationTimestamp": "2014-09-10T12:23:24-04:00",
"dockerImageReference": "localhost:5000/someproject/somerepo:c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"id": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"metadata": {
"Size": 0,
"architecture": "amd64",
"config": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": null,
"CpuShares": 0,
"Dns": null,
"Domainname": "",
"Entrypoint": null,
"Env": null,
"ExposedPorts": null,
"Hostname": "",
"Image": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": ""
},
"container": "6b03c2dda0f8cbfa6186d96557e35e35c61915a70e4217a465f92f26c2d9290b",
"containerconfig": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": null,
"CpuShares": 0,
"Dns": null,
"Domainname": "",
"Entrypoint": null,
"Env": null,
"ExposedPorts": null,
"Hostname": "",
"Image": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": ""
},
"created": "0001-01-01T00:00:00Z",
"id": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"parent": "32730be9f383719ce6308329c8ee5aac189ece9e41928dc10b8bc0fc35e9d1d5"
},
"resourceVersion": 18
}
],
"kind": "ImageList",
"resourceVersion": 22
}
post /images
Create a new image definition.
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"dockerImageReference": "localhost:5000/someproject/somerepo:c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"id": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"kind": "Image",
"metadata": {
"Size": 0,
"architecture": "amd64",
"config": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": null,
"CpuShares": 0,
"Dns": null,
"Domainname": "",
"Entrypoint": null,
"Env": null,
"ExposedPorts": null,
"Hostname": "",
"Image": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": ""
},
"container": "6b03c2dda0f8cbfa6186d96557e35e35c61915a70e4217a465f92f26c2d9290b",
"containerconfig": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": null,
"CpuShares": 0,
"Dns": null,
"Domainname": "",
"Entrypoint": null,
"Env": null,
"ExposedPorts": null,
"Hostname": "",
"Image": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": ""
},
"created": "0001-01-01T00:00:00Z",
"id": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"parent": "32730be9f383719ce6308329c8ee5aac189ece9e41928dc10b8bc0fc35e9d1d5"
},
}
Get a specific image definition.
Delete a specific image.
get /images/{imageID}
Get a specific image definition.
URI Parameters
- imageID: required (string)
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-10T12:23:24-04:00",
"dockerImageReference": "localhost:5000/someproject/somerepo:c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"id": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"kind": "Image",
"metadata": {
"Size": 0,
"architecture": "amd64",
"config": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": null,
"CpuShares": 0,
"Dns": null,
"Domainname": "",
"Entrypoint": null,
"Env": null,
"ExposedPorts": null,
"Hostname": "",
"Image": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": ""
},
"container": "6b03c2dda0f8cbfa6186d96557e35e35c61915a70e4217a465f92f26c2d9290b",
"containerconfig": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": null,
"CpuShares": 0,
"Dns": null,
"Domainname": "",
"Entrypoint": null,
"Env": null,
"ExposedPorts": null,
"Hostname": "",
"Image": "",
"Memory": 0,
"MemorySwap": 0,
"NetworkDisabled": false,
"OpenStdin": false,
"PortSpecs": null,
"StdinOnce": false,
"Tty": false,
"User": "",
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": ""
},
"created": "0001-01-01T00:00:00Z",
"id": "c115fca463efa744a5492ca580ef24b20ed5ef2155c624cc5b1262aefc14797b",
"parent": "32730be9f383719ce6308329c8ee5aac189ece9e41928dc10b8bc0fc35e9d1d5"
},
"resourceVersion": 18
}
/links (NOT IMPLEMENTED)
List of links between services in your account.
Unlike a Docker link, a Link in OpenShift defines a relationship between services which may be composed by multiple Docker images. A link may include additional metadata about the relationship such as the algorithm to use to distribute requests.
Create a new link between two services.
get /links
List of links between services in your account.
Unlike a Docker link, a Link in OpenShift defines a relationship between services which may be composed by multiple Docker images. A link may include additional metadata about the relationship such as the algorithm to use to distribute requests.
Query Parameters
- projectID: (string)
filter the links owned by a particular project.
- serviceID: (string)
filter the links attached to a particular service.
HTTP status code 200
Body
Type: application/json
Example:
{
"list":
[
{
"id": "53c4249f076573c0f4000001",
"projectId": "myproject-1234123132",
"source": {
"serviceId": "nginx-1893747912737"
},
"destination": {
"serviceId": "ruby1.9-1237471273",
"port": 8080
}
"policy": "round-robin"
}
]
}
post /links
Create a new link between two services.
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"projectId": "myproject-1234123132",
"source": {
"serviceId": "nginx-1893747912737"
},
"destination": {
"serviceId": "ruby1.9-1237471273",
"port": 8080
}
"policy": "round-robin"
}
}
Get details about a specific link.
Update a specific link.
Delete a specific link.
get /links/{linkID}
Get details about a specific link.
URI Parameters
- linkID: required (string)
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"projectId": "myproject-1234123132",
"source": {
"serviceId": "nginx-1893747912737"
},
"destination": {
"serviceId": "ruby1.9-1237471273",
"port": 8080
}
"policy": "round-robin"
}
}
put /links/{linkID}
Update a specific link.
URI Parameters
- linkID: required (string)
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"projectId": "myproject-1234123132",
"source": {
"serviceId": "nginx-1893747912737"
},
"destination": {
"serviceId": "ruby1.9-1237471273",
"port": 8080
}
"policy": "round-robin"
}
}
/projects (NOT IMPLEMENTED)
List all projects for your account.
Projects are a similar concept to v2 domains. A project is a grouping of services with shared access control and resource limits. Applications can be assembled from services in a project by linking them together via service endpoints.
Create a new project.
get /projects
List all projects for your account.
Projects are a similar concept to v2 domains. A project is a grouping of services with shared access control and resource limits. Applications can be assembled from services in a project by linking them together via service endpoints.
HTTP status code 200
Body
Type: application/json
Example:
{
"data":
[
{
"id": "53c4249f076573c0f4000001",
"suffix": "dev.rhcloud.com",
"name": "mydomain",
"members": [
{
"login": "adminuser",
"role": "admin",
"type": "user",
"owner": true
}
]
},
{
"id": "54c4259f076573c0f4000023",
"suffix": "dev.rhcloud.com",
"name": "appdomain",
"members": [
{
"login": "adminuser",
"role": "admin",
"type": "user",
"owner": true
}
]
}
]
}
post /projects
Create a new project.
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"suffix": "dev.rhcloud.com",
"name": "myproject",
"members": [
{
"login": "adminuser",
"role": "admin",
"type": "user",
"owner": true
}
]
}
}
Get a specific project.
Update a project.
Delete a project.
Instantiate a template in the given project.
get /projects/{projectID}
Get a specific project.
URI Parameters
- projectID: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"suffix": "dev.rhcloud.com",
"name": "myproject",
"members": [
{
"login": "adminuser",
"role": "admin",
"type": "user",
"owner": true
}
]
}
}
put /projects/{projectID}
Update a project.
URI Parameters
- projectID: required (string)
Body
Type: application/json
Example:
{
"data":
{
"id": "53c4249f076573c0f4000001",
"name": "newproject-name"
}
}
post /projects/{projectID}
Instantiate a template in the given project.
URI Parameters
- projectID: required (string)
Body
Type: application/json
Example:
{
"templateId": "the-template-id"
}
/templateConfigs
Process a template into a config. See /templates endpoint for details on template transformation, parameters and generators.
post /templateConfigs
Process a template into a config. See /templates endpoint for details on template transformation, parameters and generators.
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-03/schema",
"type": "object",
"required": true,
"description": "Template resource.",
"properties": {
"id": {
"type": "string",
"required": true
},
"name": {
"type": "string",
"required": true
},
"description": {
"type": "string",
"required": false
},
"parameters": {
"type": "array",
"required": false,
"items": {
"type": "object",
"required": false,
"properties": {
"name": {
"type": "string",
"required": true
},
"type": {
"type": "string",
"required": true,
"enum": ["string"]
},
"value": {
"type": "string",
"required": false
},
"expression": {
"type": "string",
"required": false
},
"description": {
"type": "string",
"required": false
}
}
}
},
"items": {
"type": "array",
"required": false,
"items": {
"type": "object",
"required": true,
"properties": {
"kind": {
"type": "string",
"required": true
},
"id": {
"type": "string",
"required": true
}
}
}
}
}
}Example:
{
"kind": "Template",
"id": "example1",
"name": "My awesome PHP app",
"description": "Example PHP application with PostgreSQL database",
"parameters": [
{
"name": "DB_PASSWORD",
"description": "PostgreSQL admin user password",
"type": "string",
"expression": "[a-zA-Z0-9]{8}"
},
{
"name": "DB_USER",
"description": "PostgreSQL username",
"type": "string",
"expression": "admin[a-zA-Z0-9]{4}"
},
{
"name": "DB_NAME",
"description": "PostgreSQL database name",
"type": "string",
"value": "mydb"
}
],
"items": [
{
"kind": "Service",
"id": "frontend",
"apiVersion": "v1beta1",
"port": 8080,
"containerPort": 9292,
"selector": {
"name": "frontend"
}
},
{
"kind": "Service",
"id": "database",
"apiVersion": "v1beta1",
"port": 5432,
"containerPort": 5432,
"selector": {
"name": "database"
}
},
{
"kind": "ReplicationController",
"id": "frontendController",
"apiVersion": "v1beta1",
"desiredState": {
"replicas": 2,
"replicaSelector": {
"name": "frontend"
},
"podTemplate": {
"desiredState": {
"manifest": {
"id": "frontendController",
"version": "v1beta1",
"containers": [
{
"name": "nginx-php-app",
"image": "mfojtik/nginx-php-app",
"env": [
{
"name": "PGPASSWORD",
"value": "${DB_PASSWORD}"
},
{
"name": "PGUSER",
"value": "${DB_USER}"
},
{
"name": "PGDATABASE",
"value": "${DB_NAME}"
}
],
"ports": [
{
"containerPort": 9292,
"hostPort": 8080
}
]
}
]
}
},
"labels": {
"name": "frontend"
}
}
},
"labels": {
"name": "frontend"
}
},
{
"kind": "Pod",
"id": "postgresql",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "database",
"containers": [
{
"name": "postgresql",
"image": "postgres",
"env": [
{
"name": "PGPASSWORD",
"value": "${DB_PASSWORD}"
},
{
"name": "PGUSER",
"value": "${DB_USER}"
},
{
"name": "PGDATABASE",
"value": "${DB_NAME}"
}
],
"ports": [
{
"containerPort": 5432,
"hostPort": 5432
}
]
}
]
}
},
"labels": {
"name": "database"
}
}
]
}HTTP status code 200
Body
Type: application/json
Example:
{
"kind": "Config",
"id": "example1",
"name": "My awesome PHP app",
"description": "Example PHP application with PostgreSQL database",
"apiVersion": "v1beta1",
"creationTimestamp": "2014-09-22T09:48:27Z",
"items": [
{
"kind": "Service",
"id": "frontend",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"port": 8080,
"containerPort": 9292,
"selector": {
"name": "frontend"
}
},
{
"kind": "Service",
"id": "database",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"port": 5432,
"containerPort": 5432,
"selector": {
"name": "database"
}
},
{
"kind": "ReplicationController",
"id": "frontendController",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"desiredState": {
"replicas": 2,
"replicaSelector": {
"name": "frontend"
},
"podTemplate": {
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "frontendController",
"volumes": null,
"containers": [
{
"name": "nginx-php-app",
"image": "mfojtik/nginx-php-app",
"ports": [
{
"hostPort": 8080,
"containerPort": 9292,
"protocol": "TCP"
}
],
"env": [
{
"name": "PGPASSWORD",
"key": "PGPASSWORD",
"value": "MPbGM5T0"
},
{
"name": "PGUSER",
"key": "PGUSER",
"value": "adminO8bR"
},
{
"name": "PGDATABASE",
"key": "PGDATABASE",
"value": "mydb"
}
]
}
]
},
"restartpolicy": {}
},
"labels": {
"name": "frontend"
}
}
},
"labels": {
"name": "frontend"
}
},
{
"kind": "Pod",
"id": "postgresql",
"creationTimestamp": null,
"apiVersion": "v1beta1",
"labels": {
"name": "database"
},
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "database",
"volumes": null,
"containers": [
{
"name": "postgresql",
"image": "postgres",
"ports": [
{
"hostPort": 5432,
"containerPort": 5432,
"protocol": "TCP"
}
],
"env": [
{
"name": "PGPASSWORD",
"key": "PGPASSWORD",
"value": "MPbGM5T0"
},
{
"name": "PGUSER",
"key": "PGUSER",
"value": "adminO8bR"
},
{
"name": "PGDATABASE",
"key": "PGDATABASE",
"value": "mydb"
}
]
}
]
},
"restartpolicy": {
"type": "RestartAlways"
}
},
"currentState": {
"manifest": {
"version": "",
"id": "",
"volumes": null,
"containers": null
},
"restartpolicy": {}
}
}
]
}/templates (NOT IMPLEMENTED)
List all templates that your account has access to.
A template represents generic config with parameters.
Parameters:
Example #1 - static paramater:
{
"name": "DB_NAME",
"description": "PostgreSQL database name",
"type": "string",
"value": "mydb"
}
The above parameter can be referenced in the rest of the template as ${DB_NAME} expression, which is to be substituted by its value (the "mydb" string) during the transformation.
Example #2 - parameter with generator:
{
"name": "DB_PASSWORD",
"description": "PostgreSQL admin user password",
"type": "string",
"expression": "[a-zA-Z0-9]{8}"
}
The above parameter can be referenced in the rest of the template as ${DB_PASSWORD} expression, which is to be substituted by its newly generated value during the transformation.
Generators:
Generators generate random values based on the input. OpenShift 3 currently support expression value generator only.
Expression value generator generates random string based on the input expression. The input expression is a string, which may contain "[a-zA-Z0-9]{length}" expression constructs, defining range and length of the result random characters.
Examples ("expression" => "value"):
"test[0-9]{1}x" => "test7x"
"[0-1]{8}" => "01001100"
"0x[A-F0-9]{4}" => "0xB3AF"
"[a-zA-Z0-9]{8}" => "hW4yQU5i"
Create a new template.
get /templates
List all templates that your account has access to.
A template represents generic config with parameters.
Parameters:
Example #1 - static paramater:
{
"name": "DB_NAME",
"description": "PostgreSQL database name",
"type": "string",
"value": "mydb"
}
The above parameter can be referenced in the rest of the template as ${DB_NAME} expression, which is to be substituted by its value (the "mydb" string) during the transformation.
Example #2 - parameter with generator:
{
"name": "DB_PASSWORD",
"description": "PostgreSQL admin user password",
"type": "string",
"expression": "[a-zA-Z0-9]{8}"
}
The above parameter can be referenced in the rest of the template as ${DB_PASSWORD} expression, which is to be substituted by its newly generated value during the transformation.
Generators:
Generators generate random values based on the input. OpenShift 3 currently support expression value generator only.
Expression value generator generates random string based on the input expression. The input expression is a string, which may contain "[a-zA-Z0-9]{length}" expression constructs, defining range and length of the result random characters.
Examples ("expression" => "value"):
"test[0-9]{1}x" => "test7x"
"[0-1]{8}" => "01001100"
"0x[A-F0-9]{4}" => "0xB3AF"
"[a-zA-Z0-9]{8}" => "hW4yQU5i"
post /templates
Create a new template.
Body
Type: application/json
Schema:
{
"$schema": "http://json-schema.org/draft-03/schema",
"type": "object",
"required": true,
"description": "Template resource.",
"properties": {
"id": {
"type": "string",
"required": true
},
"name": {
"type": "string",
"required": true
},
"description": {
"type": "string",
"required": false
},
"parameters": {
"type": "array",
"required": false,
"items": {
"type": "object",
"required": false,
"properties": {
"name": {
"type": "string",
"required": true
},
"type": {
"type": "string",
"required": true,
"enum": ["string"]
},
"value": {
"type": "string",
"required": false
},
"expression": {
"type": "string",
"required": false
},
"description": {
"type": "string",
"required": false
}
}
}
},
"items": {
"type": "array",
"required": false,
"items": {
"type": "object",
"required": true,
"properties": {
"kind": {
"type": "string",
"required": true
},
"id": {
"type": "string",
"required": true
}
}
}
}
}
}Example:
{
"kind": "Template",
"id": "example1",
"name": "My awesome PHP app",
"description": "Example PHP application with PostgreSQL database",
"parameters": [
{
"name": "DB_PASSWORD",
"description": "PostgreSQL admin user password",
"type": "string",
"expression": "[a-zA-Z0-9]{8}"
},
{
"name": "DB_USER",
"description": "PostgreSQL username",
"type": "string",
"expression": "admin[a-zA-Z0-9]{4}"
},
{
"name": "DB_NAME",
"description": "PostgreSQL database name",
"type": "string",
"value": "mydb"
}
],
"items": [
{
"kind": "Service",
"id": "frontend",
"apiVersion": "v1beta1",
"port": 8080,
"containerPort": 9292,
"selector": {
"name": "frontend"
}
},
{
"kind": "Service",
"id": "database",
"apiVersion": "v1beta1",
"port": 5432,
"containerPort": 5432,
"selector": {
"name": "database"
}
},
{
"kind": "ReplicationController",
"id": "frontendController",
"apiVersion": "v1beta1",
"desiredState": {
"replicas": 2,
"replicaSelector": {
"name": "frontend"
},
"podTemplate": {
"desiredState": {
"manifest": {
"id": "frontendController",
"version": "v1beta1",
"containers": [
{
"name": "nginx-php-app",
"image": "mfojtik/nginx-php-app",
"env": [
{
"name": "PGPASSWORD",
"value": "${DB_PASSWORD}"
},
{
"name": "PGUSER",
"value": "${DB_USER}"
},
{
"name": "PGDATABASE",
"value": "${DB_NAME}"
}
],
"ports": [
{
"containerPort": 9292,
"hostPort": 8080
}
]
}
]
}
},
"labels": {
"name": "frontend"
}
}
},
"labels": {
"name": "frontend"
}
},
{
"kind": "Pod",
"id": "postgresql",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "database",
"containers": [
{
"name": "postgresql",
"image": "postgres",
"env": [
{
"name": "PGPASSWORD",
"value": "${DB_PASSWORD}"
},
{
"name": "PGUSER",
"value": "${DB_USER}"
},
{
"name": "PGDATABASE",
"value": "${DB_NAME}"
}
],
"ports": [
{
"containerPort": 5432,
"hostPort": 5432
}
]
}
]
}
},
"labels": {
"name": "database"
}
}
]
}HTTP status code 200
Body
Type: application/json
Example:
{
"apiVersion": "v1beta1",
"creationTimestamp": null,
"kind": "Status",
"status": "success"
}
Get a specific template.
Update a specific template.
Delete a specific template.
get /templates/{templateID}
Get a specific template.
URI Parameters
- templateID: required (string)
HTTP status code 200
Body
Type: application/json
Example:
{
"kind": "Template",
"id": "example1",
"name": "My awesome PHP app",
"description": "Example PHP application with PostgreSQL database",
"parameters": [
{
"name": "DB_PASSWORD",
"description": "PostgreSQL admin user password",
"type": "string",
"expression": "[a-zA-Z0-9]{8}"
},
{
"name": "DB_USER",
"description": "PostgreSQL username",
"type": "string",
"expression": "admin[a-zA-Z0-9]{4}"
},
{
"name": "DB_NAME",
"description": "PostgreSQL database name",
"type": "string",
"value": "mydb"
}
],
"items": [
{
"kind": "Service",
"id": "frontend",
"apiVersion": "v1beta1",
"port": 8080,
"containerPort": 9292,
"selector": {
"name": "frontend"
}
},
{
"kind": "Service",
"id": "database",
"apiVersion": "v1beta1",
"port": 5432,
"containerPort": 5432,
"selector": {
"name": "database"
}
},
{
"kind": "ReplicationController",
"id": "frontendController",
"apiVersion": "v1beta1",
"desiredState": {
"replicas": 2,
"replicaSelector": {
"name": "frontend"
},
"podTemplate": {
"desiredState": {
"manifest": {
"id": "frontendController",
"version": "v1beta1",
"containers": [
{
"name": "nginx-php-app",
"image": "mfojtik/nginx-php-app",
"env": [
{
"name": "PGPASSWORD",
"value": "${DB_PASSWORD}"
},
{
"name": "PGUSER",
"value": "${DB_USER}"
},
{
"name": "PGDATABASE",
"value": "${DB_NAME}"
}
],
"ports": [
{
"containerPort": 9292,
"hostPort": 8080
}
]
}
]
}
},
"labels": {
"name": "frontend"
}
}
},
"labels": {
"name": "frontend"
}
},
{
"kind": "Pod",
"id": "postgresql",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "database",
"containers": [
{
"name": "postgresql",
"image": "postgres",
"env": [
{
"name": "PGPASSWORD",
"value": "${DB_PASSWORD}"
},
{
"name": "PGUSER",
"value": "${DB_USER}"
},
{
"name": "PGDATABASE",
"value": "${DB_NAME}"
}
],
"ports": [
{
"containerPort": 5432,
"hostPort": 5432
}
]
}
]
}
},
"labels": {
"name": "database"
}
}
]
}