Skip to content

Commit 05fd380

Browse files
committed
Merge pull request #7 from rhcarvalho/std-tmpl
Standardize templates across examples
2 parents 662f5be + 2e3974a commit 05fd380

File tree

1 file changed

+66
-59
lines changed

1 file changed

+66
-59
lines changed

openshift/templates/nodejs.json

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,23 @@
44
"metadata": {
55
"name": "nodejs-example",
66
"annotations": {
7-
"description": "A simple Node.js application with no database",
8-
"iconClass": "icon-nodejs",
9-
"tags": "instant-app,nodejs"
7+
"description": "An example Node.js application with no database",
8+
"tags": "instant-app,nodejs",
9+
"iconClass": "icon-nodejs"
1010
}
1111
},
12+
"labels": {
13+
"template": "nodejs-example"
14+
},
1215
"objects": [
1316
{
1417
"kind": "Service",
1518
"apiVersion": "v1",
1619
"metadata": {
17-
"name": "${FRONTEND_SERVICE_NAME}"
20+
"name": "nodejs-frontend",
21+
"annotations": {
22+
"description": "Exposes and load balances the application pods"
23+
}
1824
},
1925
"spec": {
2026
"ports": [
@@ -25,97 +31,92 @@
2531
}
2632
],
2733
"selector": {
28-
"name": "${FRONTEND_SERVICE_NAME}"
34+
"name": "nodejs-frontend"
2935
}
3036
}
3137
},
3238
{
3339
"kind": "Route",
3440
"apiVersion": "v1",
3541
"metadata": {
36-
"name": "${FRONTEND_ROUTE}"
42+
"name": "nodejs-route"
3743
},
3844
"spec": {
39-
"host" : "${FRONTEND_ROUTE}",
40-
"to": {
41-
"kind" : "Service",
42-
"name" : "${FRONTEND_SERVICE_NAME}"
43-
}
45+
"host": "${FRONTEND_ROUTE}",
46+
"to": {
47+
"kind": "Service",
48+
"name": "nodejs-frontend"
49+
}
4450
}
4551
},
4652
{
4753
"kind": "ImageStream",
4854
"apiVersion": "v1",
4955
"metadata": {
50-
"name": "nodejs-example"
56+
"name": "nodejs-example",
57+
"annotations": {
58+
"description": "Keeps track of changes in the application image"
59+
}
5160
}
5261
},
5362
{
5463
"kind": "BuildConfig",
5564
"apiVersion": "v1",
5665
"metadata": {
5766
"name": "nodejs-example",
58-
"labels": {
59-
"name": "nodejs-example"
67+
"annotations": {
68+
"description": "Defines how to build the application"
6069
}
6170
},
6271
"spec": {
63-
"triggers": [
64-
{
65-
"type": "GitHub",
66-
"github": {
67-
"secret": "secret101"
68-
}
69-
},
70-
{
71-
"type": "Generic",
72-
"generic": {
73-
"secret": "secret101"
74-
}
75-
},
76-
{
77-
"type": "ImageChange"
78-
}
79-
],
8072
"source": {
8173
"type": "Git",
8274
"git": {
8375
"uri": "${SOURCE_REPOSITORY_URL}"
84-
}
76+
},
77+
"contextDir": "${CONTEXT_DIR}"
8578
},
8679
"strategy": {
8780
"type": "Source",
8881
"sourceStrategy": {
8982
"from": {
9083
"kind": "ImageStreamTag",
91-
"name": "nodejs:latest",
92-
"namespace": "openshift"
93-
},
94-
"incremental": true
84+
"namespace": "openshift",
85+
"name": "nodejs:0.10"
86+
}
9587
}
9688
},
9789
"output": {
9890
"to": {
99-
"kind": "ImageStreamTag",
100-
"name": "nodejs-example:latest"
91+
"kind": "ImageStream",
92+
"name": "nodejs-example"
10193
}
102-
}
94+
},
95+
"triggers": [
96+
{
97+
"type": "ImageChange"
98+
},
99+
{
100+
"type": "GitHub",
101+
"github": {
102+
"secret": "${GITHUB_WEBHOOK_SECRET}"
103+
}
104+
}
105+
]
103106
}
104107
},
105108
{
106109
"kind": "DeploymentConfig",
107110
"apiVersion": "v1",
108111
"metadata": {
109-
"name": "nodejs-frontend"
112+
"name": "nodejs-frontend",
113+
"annotations": {
114+
"description": "Defines how to deploy the application server"
115+
}
110116
},
111117
"spec": {
112118
"strategy": {
113-
"type": "Rolling",
114-
"rollingParams": {
115-
"updatePeriodSeconds": 1,
116-
"intervalSeconds": 1,
117-
"timeoutSeconds": 120
118-
}
119+
"type": "Rolling"
119120
},
120121
"triggers": [
121122
{
@@ -126,20 +127,24 @@
126127
"nodejs-example"
127128
],
128129
"from": {
129-
"kind": "ImageStreamTag",
130+
"kind": "ImageStreamTag",
130131
"name": "nodejs-example:latest"
131132
}
132133
}
134+
},
135+
{
136+
"type": "ConfigChange"
133137
}
134138
],
135139
"replicas": 1,
136140
"selector": {
137-
"name": "nodejs-example"
141+
"name": "nodejs-frontend"
138142
},
139143
"template": {
140144
"metadata": {
145+
"name": "nodejs-frontend",
141146
"labels": {
142-
"name": "nodejs-example"
147+
"name": "nodejs-frontend"
143148
}
144149
},
145150
"spec": {
@@ -162,21 +167,23 @@
162167
"parameters": [
163168
{
164169
"name": "SOURCE_REPOSITORY_URL",
165-
"description": "The URL with your Node.js application source code",
170+
"description": "The URL of the repository with your application source code",
166171
"value": "https://github.com/openshift/nodejs-ex.git"
167172
},
168173
{
169-
"name": "FRONTEND_SERVICE_NAME",
170-
"description": "Frontend service name",
171-
"value": "nodejs"
174+
"name": "CONTEXT_DIR",
175+
"description": "Set this to the relative path to your project if it is not in the root of your repository"
172176
},
173177
{
174178
"name": "FRONTEND_ROUTE",
175179
"description": "The exposed hostname that will route to the Node.js service",
176-
"value": "nodejs.apps"
177-
}
178-
],
179-
"labels": {
180-
"template": "nodejs-example"
181-
}
180+
"value": "nodejs.app"
181+
},
182+
{
183+
"name": "GITHUB_WEBHOOK_SECRET",
184+
"description": "A secret string used to configure the GitHub webhook",
185+
"generate": "expression",
186+
"from": "[a-zA-Z0-9]{40}"
187+
}
188+
]
182189
}

0 commit comments

Comments
 (0)