Browse code

refactor examples to use Basic deploy strategy

Ben Parees authored on 2014/10/28 02:17:36
Showing 16 changed files
... ...
@@ -19,13 +19,13 @@ import (
19 19
 
20 20
 func TestExamples(t *testing.T) {
21 21
 	expected := map[string]runtime.Object{
22
-		"guestbook/template.json":               &templateapi.Template{},
23
-		"hello-openshift/hello-pod.json":        &kubeapi.Pod{},
24
-		"hello-openshift/hello-project.json":         &projectapi.Project{},
25
-		"sample-app/buildcfg/buildcfg.json":     &buildapi.BuildConfig{},
26
-		"sample-app/buildinvoke/pushevent.json": nil, // Skip.
27
-		"sample-app/registry-config.json":       &configapi.Config{},
28
-		"sample-app/template/template.json":     &templateapi.Template{},
22
+		"guestbook/template.json":                 &templateapi.Template{},
23
+		"hello-openshift/hello-pod.json":          &kubeapi.Pod{},
24
+		"hello-openshift/hello-project.json":      &projectapi.Project{},
25
+		"sample-app/application-buildconfig.json": &buildapi.BuildConfig{},
26
+		"sample-app/github-webhook-example.json":  nil, // Skip.
27
+		"sample-app/docker-registry-config.json":  &configapi.Config{},
28
+		"sample-app/application-template.json":    &templateapi.Template{},
29 29
 	}
30 30
 
31 31
 	files := []string{}
32 32
deleted file mode 100644
... ...
@@ -1,30 +0,0 @@
1
-Quickstart
2
-This section describes how you can quickly test that your OpenShift environment is setup properly, and allows you to watch the flow of an application creation and build in OpenShift.
3
-
4
-To do this, run:
5
-
6
-        $ ./run.sh
7
-
8
-This will:
9
-
10
-1. Launch the OpenShift server
11
- * Logs are available in logs/openshift.log
12
- 
13
-2. Create a private Docker registry running in OpenShift
14
-
15
-3. Define a build configuration for the application
16
-
17
-4. Trigger a new build of the application
18
-
19
-5. Submit the template/template.json for parameterization
20
-
21
-6. Submit the config json to OpenShift for creation
22
-
23
-7. Confirm the application is created/accessible via curl
24
-
25
-To reset your system after running this example, you can run:
26
-        
27
-    $ ./cleanup.sh
28
-        
29
-This will stop the openshift process, remove the etcd storage, and kill all docker containers running on your host system.  (**Use with caution!**   Docker containers unrelated to openshift will also be killed by this script)
... ...
@@ -11,8 +11,6 @@ Application Build, Deploy, and Update Flow
11 11
 
12 12
 This section covers how to perform all the steps of building, deploying, and updating an application on the OpenShift platform.
13 13
 
14
-Note:  If you just want to quickly validate your environment or see the expected results, you can run the quickstart script described [here](QUICKSTART.md)
15
-
16 14
 All commands assume the `openshift` binary is in your path:
17 15
 
18 16
 1. Pre-pull the docker images used in this sample.  This is not strictly necessary as OpenShift will pull the images as it needs them, but by doing it up front it will prevent lengthy operations during build and deployment which might otherwise lead you to believe the process has failed or hung.
... ...
@@ -25,7 +23,7 @@ All commands assume the `openshift` binary is in your path:
25 25
 
26 26
 3. Deploy the private docker registry within OpenShift:
27 27
 
28
-        $ openshift kube apply -c registry-config.json
28
+        $ openshift kube apply -c docker-registry-config.json
29 29
 
30 30
 4. Confirm the registry is started (this can take a few mins):
31 31
 
... ...
@@ -35,7 +33,7 @@ All commands assume the `openshift` binary is in your path:
35 35
 
36 36
         ID                                     Image(s)                    Host                     Labels                                                                                                   Status
37 37
         ----------                             ----------                  ----------               ----------                                                                                               ----------
38
-        94679170-54dc-11e4-88cc-3c970e3bf0b7   openshift/docker-registry   localhost.localdomain/   deployment=registry-config,name=registryPod,replicationController=946583f6-54dc-11e4-88cc-3c970e3bf0b7   Running
38
+        94679170-54dc-11e4-88cc-3c970e3bf0b7   openshift/docker-registry   localhost.localdomain/   deployment=registry-config,name=registrypod,replicationController=946583f6-54dc-11e4-88cc-3c970e3bf0b7   Running
39 39
 
40 40
 
41 41
 5. Fork the [ruby sample repository](https://github.com/openshift/ruby-hello-world)
... ...
@@ -45,12 +43,12 @@ All commands assume the `openshift` binary is in your path:
45 45
         $ http://<host>:8080/osapi/v1beta1/buildConfigHooks/build100/secret101/github
46 46
   * Note: Using the webhook requires your OpenShift server be publicly accessible so github can reach it to invoke the hook.
47 47
 
48
-7. Edit buildcfg/buildcfg.json
48
+7. Edit application-buildconfig.json
49 49
  * Update the sourceURI to point to your forked repository.
50 50
 
51 51
 8. Create a build configuration for your application.  This configuration is used by OpenShift to rebuild your application's Docker image (e.g. when you push changes to the application source).
52 52
 
53
-        $ openshift kube create buildConfigs -c buildcfg/buildcfg.json
53
+        $ openshift kube create buildConfigs -c application-buildconfig.json
54 54
 
55 55
     You should see the build configuration returned as output (SourceURI will depend on your repo name):
56 56
 
... ...
@@ -62,7 +60,7 @@ All commands assume the `openshift` binary is in your path:
62 62
  * If you setup the github webhook in step 6, push a change to app.rb in your ruby sample repository from step 5.
63 63
  * Otherwise you can simulate the webhook invocation by running:
64 64
 
65
-            $ curl -s -A "GitHub-Hookshot/github" -H "Content-Type:application/json" -H "X-Github-Event:push" -d @buildinvoke/pushevent.json http://localhost:8080/osapi/v1beta1/buildConfigHooks/build100/secret101/github
65
+            $ curl -s -A "GitHub-Hookshot/github" -H "Content-Type:application/json" -H "X-Github-Event:push" -d @github-webhook-example.json http://localhost:8080/osapi/v1beta1/buildConfigHooks/build100/secret101/github
66 66
 
67 67
     In the OpenShift logs (logs/openshift.log) you should see something like:
68 68
 
... ...
@@ -86,7 +84,7 @@ All commands assume the `openshift` binary is in your path:
86 86
 
87 87
 11. Submit the application template for processing and create the application using the processed template:
88 88
 
89
-        $ openshift kube process -c template/template.json | openshift kube apply -c -
89
+        $ openshift kube process -c application-template.json | openshift kube apply -c -
90 90
 
91 91
 12. Wait for the application's frontend pod to be started (this can take a few mins):
92 92
 
93 93
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+{
1
+    "id": "build100",
2
+    "kind": "BuildConfig",
3
+    "apiVersion": "v1beta1",
4
+    "desiredInput":
5
+    {
6
+        "type": "docker",
7
+        "sourceURI": "git://github.com/openshift/ruby-hello-world.git",
8
+        "imageTag":  "openshift/origin-ruby-sample",
9
+        "registry":  "127.0.0.1:5001"
10
+    },
11
+    "secret": "secret101"
12
+}
0 13
new file mode 100644
... ...
@@ -0,0 +1,84 @@
0
+{
1
+  "id": "ruby-helloworld-sample",
2
+  "kind": "Template",
3
+  "apiVersion": "v1beta1",
4
+  "name": "ruby-hello-world-template",
5
+  "description": "This example shows how to create a simple ruby application in openshift origin v3",
6
+  "parameters": [
7
+    {
8
+      "name": "ADMIN_USERNAME",
9
+      "description": "administrator username",
10
+      "generate": "expression",
11
+      "from": "admin[A-Z0-9]{3}"
12
+    },
13
+    {
14
+      "name": "ADMIN_PASSWORD",
15
+      "description": "administrator password",
16
+      "generate": "expression",
17
+      "from": "[a-zA-Z0-9]{8}"
18
+    },
19
+    {
20
+      "name": "DB_PASSWORD",
21
+      "description": "database password",
22
+      "generate": "expression",
23
+      "from": "[a-zA-Z0-9]{8}"
24
+    }
25
+  ],
26
+  "items": [
27
+    {
28
+      "id": "frontend",
29
+      "kind": "Service",
30
+      "apiVersion": "v1beta1",
31
+      "port": 5432,
32
+      "containerPort": 8080,
33
+      "selector": {
34
+        "name": "frontend"
35
+      }
36
+    },
37
+    {
38
+      "id": "frontend",
39
+      "kind": "Deployment",
40
+      "apiVersion": "v1beta1",
41
+      "triggerPolicy": "manual",
42
+      "strategy": {
43
+        "type": "Basic"
44
+      },
45
+      "controllerTemplate": {
46
+        "replicas": 1,
47
+        "replicaSelector": {
48
+          "name": "frontend"
49
+        },
50
+        "podTemplate": {
51
+          "desiredState": {
52
+            "manifest": {
53
+              "version": "v1beta1",
54
+              "containers": [{
55
+                "name": "ruby-helloworld",
56
+                "image": "127.0.0.1:5001/openshift/origin-ruby-sample",
57
+                "env": [
58
+                  {
59
+                    "name": "ADMIN_USERNAME",
60
+                    "value": "${ADMIN_USERNAME}"
61
+                  },
62
+                  {
63
+                    "name": "ADMIN_PASSWORD",
64
+                    "value": "${ADMIN_PASSWORD}"
65
+                  },
66
+                  {
67
+                    "name": "DB_PASSWORD",
68
+                    "value": "${DB_PASSWORD}"
69
+                  }
70
+                ],
71
+                "ports": [{"containerPort": 8080}]
72
+              }]
73
+            }
74
+          },
75
+          "labels": {"name": "frontend"}
76
+        }
77
+      },
78
+      "labels": {
79
+        "deploymentConfig": "application-config"
80
+      }
81
+    }
82
+  ]
83
+}
0 84
deleted file mode 100644
... ...
@@ -1,12 +0,0 @@
1
-{
2
-    "id": "build100",
3
-    "kind": "BuildConfig",
4
-    "apiVersion": "v1beta1",
5
-    "desiredInput":
6
-    {
7
-        "sourceURI": "git://github.com/openshift/ruby-hello-world.git",
8
-        "imageTag":  "openshift/origin-ruby-sample",
9
-        "registry":  "127.0.0.1:5001"
10
-    },
11
-    "secret": "secret101"
12
-}
13 1
deleted file mode 100644
... ...
@@ -1,136 +0,0 @@
1
-{
2
-   "ref":"refs/heads/master",
3
-   "after":"9bdc3a26ff933b32f3e558636b58aea86a69f051",
4
-   "before":"0000000000000000000000000000000000000000",
5
-   "created":true,
6
-   "deleted":false,
7
-   "forced":true,
8
-   "compare":"https://github.com/anonUser/anonRepo/commit/9bdc3a26ff93",
9
-   "commits":[
10
-      {
11
-         "id":"9bdc3a26ff933b32f3e558636b58aea86a69f051",
12
-         "distinct":true,
13
-         "message":"Added license",
14
-         "timestamp":"2014-08-28T16:55:36+02:00",
15
-         "url":"https://github.com/anonUser/anonRepo/commit/9bdc3a26ff933b32f3e558636b58aea86a69f051",
16
-         "author":{
17
-            "name":"Anonymous User",
18
-            "email":"anonUser@example.com"
19
-         },
20
-         "committer":{
21
-            "name":"Anonymous User",
22
-            "email":"anonUser@example.com"
23
-         },
24
-         "added":[
25
-            "LICENSE"
26
-         ],
27
-         "removed":[
28
-
29
-         ],
30
-         "modified":[
31
-
32
-         ]
33
-      }
34
-   ],
35
-   "head_commit":{
36
-      "id":"9bdc3a26ff933b32f3e558636b58aea86a69f051",
37
-      "distinct":true,
38
-      "message":"Added license",
39
-      "timestamp":"2014-08-28T16:55:36+02:00",
40
-      "url":"https://github.com/anonUser/anonRepo/commit/9bdc3a26ff933b32f3e558636b58aea86a69f051",
41
-      "author":{
42
-         "name":"Anonymous User",
43
-         "email":"anonUser@example.com"
44
-      },
45
-      "committer":{
46
-         "name":"Anonymous User",
47
-         "email":"anonUser@example.com"
48
-      },
49
-      "added":[
50
-         "LICENSE"
51
-      ],
52
-      "removed":[
53
-
54
-      ],
55
-      "modified":[
56
-
57
-      ]
58
-   },
59
-   "repository":{
60
-      "id":23354788,
61
-      "name":"anonRepo",
62
-      "full_name":"anonUser/anonRepo",
63
-      "owner":{
64
-         "name":"anonUser",
65
-         "email":"anonUser@example.com"
66
-      },
67
-      "private":false,
68
-      "html_url":"https://github.com/anonUser/anonRepo",
69
-      "description":"Git webhook implementation in Go.",
70
-      "fork":false,
71
-      "url":"https://github.com/anonUser/anonRepo",
72
-      "forks_url":"https://api.github.com/repos/anonUser/anonRepo/forks",
73
-      "keys_url":"https://api.github.com/repos/anonUser/anonRepo/keys{/key_id}",
74
-      "collaborators_url":"https://api.github.com/repos/anonUser/anonRepo/collaborators{/collaborator}",
75
-      "teams_url":"https://api.github.com/repos/anonUser/anonRepo/teams",
76
-      "hooks_url":"https://api.github.com/repos/anonUser/anonRepo/hooks",
77
-      "issue_events_url":"https://api.github.com/repos/anonUser/anonRepo/issues/events{/number}",
78
-      "events_url":"https://api.github.com/repos/anonUser/anonRepo/events",
79
-      "assignees_url":"https://api.github.com/repos/anonUser/anonRepo/assignees{/user}",
80
-      "branches_url":"https://api.github.com/repos/anonUser/anonRepo/branches{/branch}",
81
-      "tags_url":"https://api.github.com/repos/anonUser/anonRepo/tags",
82
-      "blobs_url":"https://api.github.com/repos/anonUser/anonRepo/git/blobs{/sha}",
83
-      "git_tags_url":"https://api.github.com/repos/anonUser/anonRepo/git/tags{/sha}",
84
-      "git_refs_url":"https://api.github.com/repos/anonUser/anonRepo/git/refs{/sha}",
85
-      "trees_url":"https://api.github.com/repos/anonUser/anonRepo/git/trees{/sha}",
86
-      "statuses_url":"https://api.github.com/repos/anonUser/anonRepo/statuses/{sha}",
87
-      "languages_url":"https://api.github.com/repos/anonUser/anonRepo/languages",
88
-      "stargazers_url":"https://api.github.com/repos/anonUser/anonRepo/stargazers",
89
-      "contributors_url":"https://api.github.com/repos/anonUser/anonRepo/contributors",
90
-      "subscribers_url":"https://api.github.com/repos/anonUser/anonRepo/subscribers",
91
-      "subscription_url":"https://api.github.com/repos/anonUser/anonRepo/subscription",
92
-      "commits_url":"https://api.github.com/repos/anonUser/anonRepo/commits{/sha}",
93
-      "git_commits_url":"https://api.github.com/repos/anonUser/anonRepo/git/commits{/sha}",
94
-      "comments_url":"https://api.github.com/repos/anonUser/anonRepo/comments{/number}",
95
-      "issue_comment_url":"https://api.github.com/repos/anonUser/anonRepo/issues/comments/{number}",
96
-      "contents_url":"https://api.github.com/repos/anonUser/anonRepo/contents/{+path}",
97
-      "compare_url":"https://api.github.com/repos/anonUser/anonRepo/compare/{base}...{head}",
98
-      "merges_url":"https://api.github.com/repos/anonUser/anonRepo/merges",
99
-      "archive_url":"https://api.github.com/repos/anonUser/anonRepo/{archive_format}{/ref}",
100
-      "downloads_url":"https://api.github.com/repos/anonUser/anonRepo/downloads",
101
-      "issues_url":"https://api.github.com/repos/anonUser/anonRepo/issues{/number}",
102
-      "pulls_url":"https://api.github.com/repos/anonUser/anonRepo/pulls{/number}",
103
-      "milestones_url":"https://api.github.com/repos/anonUser/anonRepo/milestones{/number}",
104
-      "notifications_url":"https://api.github.com/repos/anonUser/anonRepo/notifications{?since,all,participating}",
105
-      "labels_url":"https://api.github.com/repos/anonUser/anonRepo/labels{/name}",
106
-      "releases_url":"https://api.github.com/repos/anonUser/anonRepo/releases{/id}",
107
-      "created_at":1409063699,
108
-      "updated_at":"2014-08-26T14:34:59Z",
109
-      "pushed_at":1409238007,
110
-      "git_url":"git://github.com/anonUser/anonRepo.git",
111
-      "ssh_url":"git@github.com:anonUser/anonRepo.git",
112
-      "clone_url":"https://github.com/anonUser/anonRepo.git",
113
-      "svn_url":"https://github.com/anonUser/anonRepo",
114
-      "homepage":null,
115
-      "size":0,
116
-      "stargazers_count":0,
117
-      "watchers_count":0,
118
-      "language":null,
119
-      "has_issues":true,
120
-      "has_downloads":true,
121
-      "has_wiki":true,
122
-      "forks_count":0,
123
-      "mirror_url":null,
124
-      "open_issues_count":0,
125
-      "forks":0,
126
-      "open_issues":0,
127
-      "watchers":0,
128
-      "default_branch":"master",
129
-      "stargazers":0,
130
-      "master_branch":"master"
131
-   },
132
-   "pusher":{
133
-      "name":"anonUser",
134
-      "email":"anonUser@example.com"
135
-   }
136
-}
137 1
new file mode 100644
... ...
@@ -0,0 +1,63 @@
0
+{
1
+    "id": "docker-registry",
2
+    "kind": "Config",
3
+    "apiVersion": "v1beta1",
4
+    "creationTimestamp": "2014-09-18T18:28:38-04:00",
5
+    "name": "docker-registry-config",
6
+    "description": "Creates a private docker registry",
7
+    "items": [
8
+        {
9
+            "apiVersion": "v1beta1",
10
+            "creationTimestamp": null,
11
+            "id": "docker-registry",
12
+            "kind": "Service",
13
+            "port": 5001,
14
+            "containerPort": 5000,
15
+            "selector": {
16
+                "name": "registrypod"
17
+            }
18
+        },
19
+        {
20
+            "id": "docker-registry",
21
+            "kind": "Deployment",
22
+            "apiVersion": "v1beta1",
23
+            "triggerPolicy": "manual",
24
+            "strategy": {
25
+              "type": "Basic"
26
+            },
27
+            "controllerTemplate": {
28
+              "replicas": 1,
29
+              "replicaSelector": {
30
+                "name": "registrypod"
31
+              },
32
+              "podTemplate": {
33
+              "desiredState": {
34
+                    "manifest": {
35
+                        "containers": [
36
+                            {
37
+                                "image": "openshift/docker-registry",
38
+                                "name": "registry-container",
39
+                                "ports": [
40
+                                    {
41
+                                        "containerPort": 5000,
42
+                                        "protocol": "TCP"
43
+                                    }
44
+                                ]
45
+                            }
46
+                        ],
47
+                        "version": "v1beta1",
48
+                        "volumes": null
49
+                    },
50
+                    "restartpolicy": {}
51
+                },
52
+                "labels": {
53
+                    "name": "registrypod"
54
+                }
55
+            }
56
+          },
57
+          "labels": {
58
+            "deploymentConfig": "registry-config"
59
+          }
60
+        }
61
+    ]
62
+}
0 63
new file mode 100644
... ...
@@ -0,0 +1,136 @@
0
+{
1
+   "ref":"refs/heads/master",
2
+   "after":"9bdc3a26ff933b32f3e558636b58aea86a69f051",
3
+   "before":"0000000000000000000000000000000000000000",
4
+   "created":true,
5
+   "deleted":false,
6
+   "forced":true,
7
+   "compare":"https://github.com/anonUser/anonRepo/commit/9bdc3a26ff93",
8
+   "commits":[
9
+      {
10
+         "id":"9bdc3a26ff933b32f3e558636b58aea86a69f051",
11
+         "distinct":true,
12
+         "message":"Added license",
13
+         "timestamp":"2014-08-28T16:55:36+02:00",
14
+         "url":"https://github.com/anonUser/anonRepo/commit/9bdc3a26ff933b32f3e558636b58aea86a69f051",
15
+         "author":{
16
+            "name":"Anonymous User",
17
+            "email":"anonUser@example.com"
18
+         },
19
+         "committer":{
20
+            "name":"Anonymous User",
21
+            "email":"anonUser@example.com"
22
+         },
23
+         "added":[
24
+            "LICENSE"
25
+         ],
26
+         "removed":[
27
+
28
+         ],
29
+         "modified":[
30
+
31
+         ]
32
+      }
33
+   ],
34
+   "head_commit":{
35
+      "id":"9bdc3a26ff933b32f3e558636b58aea86a69f051",
36
+      "distinct":true,
37
+      "message":"Added license",
38
+      "timestamp":"2014-08-28T16:55:36+02:00",
39
+      "url":"https://github.com/anonUser/anonRepo/commit/9bdc3a26ff933b32f3e558636b58aea86a69f051",
40
+      "author":{
41
+         "name":"Anonymous User",
42
+         "email":"anonUser@example.com"
43
+      },
44
+      "committer":{
45
+         "name":"Anonymous User",
46
+         "email":"anonUser@example.com"
47
+      },
48
+      "added":[
49
+         "LICENSE"
50
+      ],
51
+      "removed":[
52
+
53
+      ],
54
+      "modified":[
55
+
56
+      ]
57
+   },
58
+   "repository":{
59
+      "id":23354788,
60
+      "name":"anonRepo",
61
+      "full_name":"anonUser/anonRepo",
62
+      "owner":{
63
+         "name":"anonUser",
64
+         "email":"anonUser@example.com"
65
+      },
66
+      "private":false,
67
+      "html_url":"https://github.com/anonUser/anonRepo",
68
+      "description":"Git webhook implementation in Go.",
69
+      "fork":false,
70
+      "url":"https://github.com/anonUser/anonRepo",
71
+      "forks_url":"https://api.github.com/repos/anonUser/anonRepo/forks",
72
+      "keys_url":"https://api.github.com/repos/anonUser/anonRepo/keys{/key_id}",
73
+      "collaborators_url":"https://api.github.com/repos/anonUser/anonRepo/collaborators{/collaborator}",
74
+      "teams_url":"https://api.github.com/repos/anonUser/anonRepo/teams",
75
+      "hooks_url":"https://api.github.com/repos/anonUser/anonRepo/hooks",
76
+      "issue_events_url":"https://api.github.com/repos/anonUser/anonRepo/issues/events{/number}",
77
+      "events_url":"https://api.github.com/repos/anonUser/anonRepo/events",
78
+      "assignees_url":"https://api.github.com/repos/anonUser/anonRepo/assignees{/user}",
79
+      "branches_url":"https://api.github.com/repos/anonUser/anonRepo/branches{/branch}",
80
+      "tags_url":"https://api.github.com/repos/anonUser/anonRepo/tags",
81
+      "blobs_url":"https://api.github.com/repos/anonUser/anonRepo/git/blobs{/sha}",
82
+      "git_tags_url":"https://api.github.com/repos/anonUser/anonRepo/git/tags{/sha}",
83
+      "git_refs_url":"https://api.github.com/repos/anonUser/anonRepo/git/refs{/sha}",
84
+      "trees_url":"https://api.github.com/repos/anonUser/anonRepo/git/trees{/sha}",
85
+      "statuses_url":"https://api.github.com/repos/anonUser/anonRepo/statuses/{sha}",
86
+      "languages_url":"https://api.github.com/repos/anonUser/anonRepo/languages",
87
+      "stargazers_url":"https://api.github.com/repos/anonUser/anonRepo/stargazers",
88
+      "contributors_url":"https://api.github.com/repos/anonUser/anonRepo/contributors",
89
+      "subscribers_url":"https://api.github.com/repos/anonUser/anonRepo/subscribers",
90
+      "subscription_url":"https://api.github.com/repos/anonUser/anonRepo/subscription",
91
+      "commits_url":"https://api.github.com/repos/anonUser/anonRepo/commits{/sha}",
92
+      "git_commits_url":"https://api.github.com/repos/anonUser/anonRepo/git/commits{/sha}",
93
+      "comments_url":"https://api.github.com/repos/anonUser/anonRepo/comments{/number}",
94
+      "issue_comment_url":"https://api.github.com/repos/anonUser/anonRepo/issues/comments/{number}",
95
+      "contents_url":"https://api.github.com/repos/anonUser/anonRepo/contents/{+path}",
96
+      "compare_url":"https://api.github.com/repos/anonUser/anonRepo/compare/{base}...{head}",
97
+      "merges_url":"https://api.github.com/repos/anonUser/anonRepo/merges",
98
+      "archive_url":"https://api.github.com/repos/anonUser/anonRepo/{archive_format}{/ref}",
99
+      "downloads_url":"https://api.github.com/repos/anonUser/anonRepo/downloads",
100
+      "issues_url":"https://api.github.com/repos/anonUser/anonRepo/issues{/number}",
101
+      "pulls_url":"https://api.github.com/repos/anonUser/anonRepo/pulls{/number}",
102
+      "milestones_url":"https://api.github.com/repos/anonUser/anonRepo/milestones{/number}",
103
+      "notifications_url":"https://api.github.com/repos/anonUser/anonRepo/notifications{?since,all,participating}",
104
+      "labels_url":"https://api.github.com/repos/anonUser/anonRepo/labels{/name}",
105
+      "releases_url":"https://api.github.com/repos/anonUser/anonRepo/releases{/id}",
106
+      "created_at":1409063699,
107
+      "updated_at":"2014-08-26T14:34:59Z",
108
+      "pushed_at":1409238007,
109
+      "git_url":"git://github.com/anonUser/anonRepo.git",
110
+      "ssh_url":"git@github.com:anonUser/anonRepo.git",
111
+      "clone_url":"https://github.com/anonUser/anonRepo.git",
112
+      "svn_url":"https://github.com/anonUser/anonRepo",
113
+      "homepage":null,
114
+      "size":0,
115
+      "stargazers_count":0,
116
+      "watchers_count":0,
117
+      "language":null,
118
+      "has_issues":true,
119
+      "has_downloads":true,
120
+      "has_wiki":true,
121
+      "forks_count":0,
122
+      "mirror_url":null,
123
+      "open_issues_count":0,
124
+      "forks":0,
125
+      "open_issues":0,
126
+      "watchers":0,
127
+      "default_branch":"master",
128
+      "stargazers":0,
129
+      "master_branch":"master"
130
+   },
131
+   "pusher":{
132
+      "name":"anonUser",
133
+      "email":"anonUser@example.com"
134
+   }
135
+}
0 136
new file mode 100644
1 137
deleted file mode 100644
... ...
@@ -1,65 +0,0 @@
1
-{
2
-    "id": "docker-registry-config",
3
-    "kind": "Config",
4
-    "apiVersion": "v1beta1",
5
-    "creationTimestamp": "2014-09-18T18:28:38-04:00",
6
-    "name": "docker-registry-config",
7
-    "description": "Creates a private docker registry",
8
-    "items": [
9
-        {
10
-            "apiVersion": "v1beta1",
11
-            "creationTimestamp": null,
12
-            "id": "registryservice",
13
-            "kind": "Service",
14
-            "port": 5001,
15
-            "containerPort": 5000,
16
-            "selector": {
17
-                "name": "registryPod"
18
-            }
19
-        },
20
-        {
21
-            "id": "registry-deploy",
22
-            "kind": "Deployment",
23
-            "apiVersion": "v1beta1",
24
-            "triggerPolicy": "manual",
25
-            "configId": "registry-config",
26
-            "strategy": {
27
-              "type": "CustomPod",
28
-              "customPod": {
29
-                "image": "openshift/kube-deploy"
30
-              }
31
-            },
32
-            "controllerTemplate": {
33
-              "replicas": 1,
34
-              "replicaSelector": {
35
-                "name": "registryPod"
36
-              },
37
-              "podTemplate": {
38
-              "desiredState": {
39
-                    "manifest": {
40
-                        "containers": [
41
-                            {
42
-                                "image": "openshift/docker-registry",
43
-                                "name": "registry-container",
44
-                                "ports": [
45
-                                    {
46
-                                        "containerPort": 5000,
47
-                                        "protocol": "TCP"
48
-                                    }
49
-                                ]
50
-                            }
51
-                        ],
52
-                        "id": "registryPod",
53
-                        "version": "v1beta1",
54
-                        "volumes": null
55
-                    },
56
-                    "restartpolicy": {}
57
-                },
58
-                "labels": {
59
-                    "name": "registryPod"
60
-                }
61
-            }
62
-          }
63
-        }
64
-    ]
65
-}
66 1
deleted file mode 100755
... ...
@@ -1,124 +0,0 @@
1
-#!/bin/bash
2
-
3
-# OpenShift binary
4
-openshift="../../_output/go/bin/openshift"
5
-
6
-# OPTIONAL: Wipe out previous OpenShift/k8s deployment information for a
7
-# clean start.
8
-rm -rf openshift.local.etcd
9
-
10
-# OPTIONAL: kill all Docker containers before starting
11
-# docker kill `docker ps --no-trunc -q`
12
-
13
-echo "Pre-pulling images"
14
-./pullimages.sh
15
-
16
-# Start the OpenShift all-in-one server
17
-# (starts a kubernetes master and minion as well as providing the origin REST api)
18
-echo "Launching openshift all-in-one server"
19
-$openshift start &> logs/openshift.log &
20
-
21
-sleep 5
22
-
23
-# Deploy the private Docker registry config
24
-$openshift kube apply -c registry-config.json
25
-
26
-# Wait for the app container to start up
27
-rc=1
28
-while [ ! $rc -eq 0 ]
29
-do
30
-  echo "Waiting for Docker registry pod to start..."
31
-  $openshift kube list pods
32
-  sleep 5
33
-  $openshift kube list pods | grep registryPod | grep Running
34
-  rc=$?
35
-done
36
-
37
-$openshift kube list services | grep frontend
38
-rc=$?
39
-while [ ! $rc -eq 0 ]
40
-do
41
-  echo "Waiting for Docker registry service to start..."
42
-  $openshift kube list services
43
-  sleep 5
44
-  $openshift kube list services | grep registryPod
45
-  rc=$?
46
-done
47
-
48
-# poke the docker registry to make sure it's alive
49
-echo "Probing docker registry"
50
-curl http://localhost:5001 >& /dev/null
51
-curl http://localhost:5001
52
-
53
-# show build cfgs
54
-echo "Initially no build configurations:"
55
-$openshift kube list buildConfigs
56
-
57
-# define a build cfg
58
-echo "Defining a new build configuration"
59
-$openshift kube create buildConfigs -c buildcfg/buildcfg.json
60
-
61
-# show build cfgs
62
-echo "Build configuration defined:"
63
-$openshift kube list buildConfigs
64
-
65
-
66
-#show no build running
67
-echo "Initially no builds running:"
68
-$openshift kube list builds
69
-
70
-
71
-#Requesting new build
72
-echo "Triggering new build"
73
-curl -s -A "GitHub-Hookshot/github" -H "Content-Type:application/json" -H "X-Github-Event:push" -d @buildinvoke/pushevent.json http://localhost:8080/osapi/v1beta1/buildConfigHooks/build100/secret101/github
74
-
75
-#show build running
76
-echo "Build now running: "
77
-$openshift kube list builds
78
-
79
-id=`$openshift kube list builds | grep new | awk '{print $1}'`
80
-
81
-$openshift kube get builds/$id | grep complete
82
-rc=$?
83
-while [ ! $rc -eq 0 ]
84
-do
85
-  echo "Waiting for build to complete..."
86
-  $openshift kube get builds/$id
87
-  sleep 5
88
-  $openshift kube get builds/$id | grep complete
89
-  rc=$?
90
-done
91
-
92
-# Convert template to config
93
-echo "Submitting application template json for processing..."
94
-$openshift kube process -c template/template.json | $openshift kube apply -c -
95
-
96
-# Wait for the app container to start up
97
-rc=1
98
-while [ ! $rc -eq 0 ]
99
-do
100
-  echo "Waiting for frontend pod to start..."
101
-  $openshift kube list pods
102
-  sleep 5
103
-  $openshift kube list pods | grep frontend | grep Running
104
-  rc=$?
105
-done
106
-
107
-$openshift kube list services | grep frontend
108
-rc=$?
109
-while [ ! $rc -eq 0 ]
110
-do
111
-  echo "Waiting for frontend service to start..."
112
-  $openshift kube list services
113
-  sleep 5
114
-  $openshift kube list services | grep frontend
115
-  rc=$?
116
-done
117
-
118
-# Sometimes the app isn't quite available even though the pod is running,
119
-# wait a little longer.
120
-sleep 20
121
-
122
-# Confirm the app is running/responsive.
123
-echo "Frontend is available, sending request.  Frontend says:"
124
-curl http://localhost:5432
125 1
deleted file mode 100644
... ...
@@ -1,86 +0,0 @@
1
-{
2
-  "id": "ruby-helloworld-sample-template",
3
-  "kind": "Template",
4
-  "apiVersion": "v1beta1",
5
-  "name": "ruby-hello-world-template",
6
-  "description": "This example shows how to create a simple ruby application in openshift origin v3",
7
-  "parameters": [
8
-    {
9
-      "name": "ADMIN_USERNAME",
10
-      "description": "administrator username",
11
-      "generate": "expression",
12
-      "from": "admin[A-Z0-9]{3}"
13
-    },
14
-    {
15
-      "name": "ADMIN_PASSWORD",
16
-      "description": "administrator password",
17
-      "generate": "expression",
18
-      "from": "[a-zA-Z0-9]{8}"
19
-    },
20
-    {
21
-      "name": "DB_PASSWORD",
22
-      "description": "database password",
23
-      "generate": "expression",
24
-      "from": "[a-zA-Z0-9]{8}"
25
-    }
26
-  ],
27
-  "items": [
28
-    {
29
-      "id": "frontend",
30
-      "kind": "Service",
31
-      "apiVersion": "v1beta1",
32
-      "port": 5432,
33
-      "containerPort": 8080,
34
-      "selector": {
35
-        "name": "frontend"
36
-      }
37
-    },
38
-    {
39
-      "id": "frontend-deploy",
40
-      "kind": "Deployment",
41
-      "apiVersion": "v1beta1",
42
-      "triggerPolicy": "manual",
43
-      "configId": "frontend-config",
44
-      "strategy": {
45
-        "type": "CustomPod",
46
-        "customPod": {
47
-          "image": "openshift/kube-deploy"
48
-        }
49
-      },
50
-      "controllerTemplate": {
51
-        "replicas": 1,
52
-        "replicaSelector": {
53
-          "name": "frontend"
54
-        },
55
-        "podTemplate": {
56
-          "desiredState": {
57
-            "manifest": {
58
-              "version": "v1beta1",
59
-              "id": "frontendController",
60
-              "containers": [{
61
-                "name": "ruby-helloworld",
62
-                "image": "127.0.0.1:5001/openshift/origin-ruby-sample",
63
-                "env": [
64
-                  {
65
-                    "name": "ADMIN_USERNAME",
66
-                    "value": "${ADMIN_USERNAME}"
67
-                  },
68
-                  {
69
-                    "name": "ADMIN_PASSWORD",
70
-                    "value": "${ADMIN_PASSWORD}"
71
-                  },
72
-                  {
73
-                    "name": "DB_PASSWORD",
74
-                    "value": "${DB_PASSWORD}"
75
-                  }
76
-                ],
77
-                "ports": [{"containerPort": 8080}]
78
-              }]
79
-            }
80
-          },
81
-          "labels": {"name": "frontend"}
82
-        }
83
-      }
84
-    }
85
-  ]
86
-}
... ...
@@ -22,7 +22,3 @@ docker build -t openshift/base-builder images/builder/docker/base
22 22
 docker build -t openshift/docker-builder images/builder/docker/docker-builder
23 23
 docker build -t openshift/sti-builder images/builder/docker/sti-builder
24 24
 docker build -t openshift/hello-openshift examples/hello-openshift
25
-
26
-images/deployer/kube-deploy/build.sh
27
-docker build -t openshift/kube-deploy images/deployer/kube-deploy
28
-rm -f images/deployer/kube-deploy/kube-deploy
... ...
@@ -67,23 +67,23 @@ wait_for_url "http://localhost:8080/healthz" "[INFO] apiserver: "
67 67
 
68 68
 # Deploy private docker registry
69 69
 echo "[INFO] Deploying private Docker registry"
70
-$openshift kube apply -c ${FIXTURE_DIR}/registry-config.json
70
+$openshift kube apply -c ${FIXTURE_DIR}/docker-registry-config.json
71 71
 
72 72
 echo "[INFO] Waiting for Docker registry pod to start"
73
-wait_for_command "$openshift kube list pods | grep registryPod | grep Running" $((5*TIME_MIN))
73
+wait_for_command "$openshift kube list pods | grep registrypod | grep Running" $((5*TIME_MIN))
74 74
 
75 75
 echo "[INFO] Waiting for Docker registry service to start"
76
-wait_for_command "$openshift kube list services | grep registryPod"
76
+wait_for_command "$openshift kube list services | grep registrypod"
77 77
 echo "[INFO] Probing the docker-registry"
78 78
 wait_for_url_timed "http://localhost:5001" "[INFO] Docker registry says: " $((2*TIME_MIN))
79 79
 
80 80
 # Define a build configuration
81 81
 echo "[INFO] Create a build config"
82
-wait_for_command "$openshift kube create buildConfigs -c ${FIXTURE_DIR}/buildcfg/buildcfg.json"
82
+wait_for_command "$openshift kube create buildConfigs -c ${FIXTURE_DIR}/application-buildconfig.json"
83 83
 
84 84
 # Trigger build
85 85
 echo "[INFO] Simulating github hook to trigger new build using curl"
86
-curl -s -A "GitHub-Hookshot/github" -H "Content-Type:application/json" -H "X-Github-Event:push" -d @${FIXTURE_DIR}/buildinvoke/pushevent.json http://localhost:8080/osapi/v1beta1/buildConfigHooks/build100/secret101/github
86
+curl -s -A "GitHub-Hookshot/github" -H "Content-Type:application/json" -H "X-Github-Event:push" -d @${FIXTURE_DIR}/github-webhook-example.json http://localhost:8080/osapi/v1beta1/buildConfigHooks/build100/secret101/github
87 87
 
88 88
 # Wait for build to complete
89 89
 echo "[INFO] Waiting for build to complete"
... ...
@@ -92,7 +92,7 @@ wait_for_command "$openshift kube get builds/$BUILD_ID | grep complete" $((30*TI
92 92
 
93 93
 # Process template and apply
94 94
 echo "[INFO] Submitting application template json for processing..."
95
-$openshift kube process -c ${FIXTURE_DIR}/template/template.json > $CONFIG_FILE
95
+$openshift kube process -c ${FIXTURE_DIR}/application-template.json > $CONFIG_FILE
96 96
 
97 97
 echo "[INFO] Applying application config"
98 98
 $openshift kube  apply -c $CONFIG_FILE
... ...
@@ -13,6 +13,7 @@ TIME_MIN=$((60 * $TIME_SEC))
13 13
 # $3 - Optional alternate command to determine if the wait should
14 14
 #      exit before the max_wait
15 15
 function wait_for_command {
16
+  STARTTIME=$(date +%s)
16 17
   cmd=$1
17 18
   msg="Waiting for command to finish: '${cmd}'..."
18 19
   max_wait=${2:-10*TIME_SEC}
... ...
@@ -26,7 +27,8 @@ function wait_for_command {
26 26
     eval $cmd
27 27
     if [ $? -eq 0 ]; then
28 28
       set -e
29
-      echo "[INFO] Success running command: '$cmd'"
29
+      ENDTIME=$(date +%s)
30
+      echo "[INFO] Success running command: '$cmd' after $(($ENDTIME - $STARTTIME)) seconds"
30 31
       return 0
31 32
     fi
32 33
     #check a failure condition where the success
... ...
@@ -54,6 +56,7 @@ function wait_for_command {
54 54
 # $2 - Optional prefix to use when echoing a successful result
55 55
 # $3 - Optional maximum time to wait before giving up (Default: 10s)
56 56
 function wait_for_url_timed {
57
+  STARTTIME=$(date +%s)
57 58
   url=$1
58 59
   prefix=${2:-}
59 60
   max_wait=${3:-10*TIME_SEC}
... ...
@@ -65,6 +68,8 @@ function wait_for_url_timed {
65 65
     if [ $? -eq 0 ]; then
66 66
       set -e
67 67
       echo ${prefix}${out}
68
+      ENDTIME=$(date +%s)
69
+      echo "[INFO] Success accessing '$url' after $(($ENDTIME - $STARTTIME)) seconds"
68 70
       return 0
69 71
     fi
70 72
     sleep $wait