-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtemplate.yaml
235 lines (229 loc) · 8.1 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
---
apiVersion: v1
kind: Template
labels:
app: nlu-code-pattern
template: nlu-code-pattern
message: |-
The ${APP_NAME} service has been created in your project.
For more information about using this quickstart see https://github.com/watson-developer-cloud/natural-language-understanding-code-pattern/tree/master.
metadata:
annotations:
description: 'An example Node.js application demonstrating the Watson Natural Language Understanding API. For more information about using this template see https://github.com/watson-developer-cloud/natural-language-understanding-code-pattern/tree/master/.'
iconClass: icon-nodejs
openshift.io/display-name: Natural Language Understanding Code Pattern
openshift.io/documentation-url: https://github.com/watson-developer-cloud/natural-language-understanding-code-pattern/tree/master
openshift.io/provider-display-name: IBM
tags: quickstart,nodejs,watson,natural-language-understanding,code-pattern
name: nlu-code-pattern
objects:
- apiVersion: v1
kind: Service
metadata:
name: '${APP_NAME}'
spec:
ports:
- name: web
port: 5000
targetPort: 5000
selector:
name: '${APP_NAME}'
- apiVersion: v1
kind: Route
metadata:
name: '${APP_NAME}'
spec:
host: '${APPLICATION_DOMAIN}'
to:
kind: Service
name: '${APP_NAME}'
- apiVersion: v1
kind: ImageStream
metadata:
annotations:
description: Keeps track of changes in the application image
name: '${APP_NAME}'
- apiVersion: v1
kind: BuildConfig
metadata:
annotations:
description: Defines how to build the application
template.alpha.openshift.io/wait-for-ready: 'true'
name: '${APP_NAME}'
spec:
source:
type: Git
git:
uri: '${SOURCE_REPOSITORY_URL}'
ref: '${SOURCE_REPOSITORY_REF}'
contextDir: '${CONTEXT_DIR}'
strategy:
type: Source
sourceStrategy:
from:
kind: DockerImage
name: docker.io/centos/nodejs-12-centos7:latest
env:
- name: NPM_MIRROR
value: '${NPM_MIRROR}'
output:
to:
kind: ImageStreamTag
name: '${APP_NAME}:latest'
triggers:
- type: ImageChange
- type: ConfigChange
- type: GitHub
github:
secret: '${GITHUB_WEBHOOK_SECRET}'
- type: Generic
generic:
secret: '${GENERIC_WEBHOOK_SECRET}'
- apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
description: Defines how to deploy the application server
template.alpha.openshift.io/wait-for-ready: 'true'
name: '${APP_NAME}'
spec:
replicas: 1
selector:
name: '${APP_NAME}'
strategy:
type: Rolling
template:
metadata:
labels:
name: '${APP_NAME}'
name: '${APP_NAME}'
spec:
containers:
- name: nlu-code-pattern
image: ' '
ports:
- containerPort: 5000
env:
- name: NATURAL_LANGUAGE_UNDERSTANDING_BEARER_TOKEN
value: '${NATURAL_LANGUAGE_UNDERSTANDING_BEARER_TOKEN}'
- name: NATURAL_LANGUAGE_UNDERSTANDING_URL
value: '${NATURAL_LANGUAGE_UNDERSTANDING_URL}'
- name: NATURAL_LANGUAGE_UNDERSTANDING_AUTH_TYPE
value: '${NATURAL_LANGUAGE_UNDERSTANDING_AUTH_TYPE}'
- name: NATURAL_LANGUAGE_UNDERSTANDING_APIKEY
value: '${NATURAL_LANGUAGE_UNDERSTANDING_APIKEY}'
- name: NATURAL_LANGUAGE_UNDERSTANDING_USERNAME
value: '${NATURAL_LANGUAGE_UNDERSTANDING_USERNAME}'
- name: NATURAL_LANGUAGE_UNDERSTANDING_PASSWORD
value: '${NATURAL_LANGUAGE_UNDERSTANDING_PASSWORD}'
- name: NATURAL_LANGUAGE_UNDERSTANDING_AUTH_URL
value: '${NATURAL_LANGUAGE_UNDERSTANDING_AUTH_URL}'
- name: NATURAL_LANGUAGE_UNDERSTANDING_AUTH_DISABLE_SSL
value: 'true'
- name: NATURAL_LANGUAGE_UNDERSTANDING_DISABLE_SSL
value: 'true'
livenessProbe:
httpGet:
path: '/health'
port: 5000
initialDelaySeconds: 30
timeoutSeconds: 3
readinessProbe:
httpGet:
path: '/health'
port: 5000
initialDelaySeconds: 3
timeoutSeconds: 3
resources:
limits:
memory: '256Mi'
triggers:
- imageChangeParams:
automatic: true
containerNames:
- nlu-code-pattern
from:
kind: ImageStreamTag
name: '${APP_NAME}:latest'
type: ImageChange
- type: ConfigChange
parameters:
- description: The name assigned to all of the frontend objects defined in this template.
displayName: Name
name: APP_NAME
required: true
value: nlu-code-pattern
- displayName: Authorization type
description: 'How to authenticate with the NLU service, possible values are: iam, cp4d, bearerToken'
name: NATURAL_LANGUAGE_UNDERSTANDING_AUTH_TYPE
value: 'bearerToken'
required: true
- displayName: Service URL
description: The service URL.
name: NATURAL_LANGUAGE_UNDERSTANDING_URL
required: true
# Bearer Token
- displayName: Cloud Pak for Data bearer token
description: Cloud Pak for Data bearer token. Use when AUTH_TYPE is bearerToken
name: NATURAL_LANGUAGE_UNDERSTANDING_BEARER_TOKEN
required: false
# IAM
- displayName: IAM apikey
description: IBM Cloud IAM apikey from the service instance page. Use when AUTH_TYPE is iam
name: NATURAL_LANGUAGE_UNDERSTANDING_APIKEY
required: false
# CP4D
- displayName: Cloud Pak for Data username
description: Cloud Pak for Data username of user with access to the service instance. Use when AUTH_TYPE is cp4d
name: NATURAL_LANGUAGE_UNDERSTANDING_USERNAME
required: false
- displayName: Cloud Pak for Data password
description: Cloud Pak for Data password of user with access to the service instance. Use when AUTH_TYPE is cp4d
name: NATURAL_LANGUAGE_UNDERSTANDING_PASSWORD
required: false
- displayName: Authorization URL
description: The authorization URL. Use when AUTH_TYPE is cp4d
name: NATURAL_LANGUAGE_UNDERSTANDING_AUTH_URL
required: false
- description: The OpenShift Namespace where the ImageStream resides.
displayName: Namespace
name: NAMESPACE
required: true
value: openshift
- description:
The exposed hostname that will route to the Node.js service, if left
blank a value will be defaulted.
displayName: Application Hostname
name: APPLICATION_DOMAIN
value: 'nlu-code-pattern'
- name: SOURCE_REPOSITORY_URL
displayName: Git Repository URL
description: The URL of the repository with your application source code.
required: true
value: https://github.com/watson-developer-cloud/natural-language-understanding-code-pattern
- name: SOURCE_REPOSITORY_REF
displayName: Git Reference
description:
Set this to a branch name, tag or other ref of your repository if you
are not using the default branch.
- name: CONTEXT_DIR
displayName: Context Directory
description:
Set this to the relative path to your project if it is not in the root
of your repository.
- name: GITHUB_WEBHOOK_SECRET
displayName: GitHub Webhook Secret
description:
Github trigger secret. A difficult to guess string encoded as part
of the webhook URL. Not encrypted.
generate: expression
from: '[a-zA-Z0-9]{40}'
- name: GENERIC_WEBHOOK_SECRET
displayName: Generic Webhook Secret
description: A secret string used to configure the Generic webhook.
generate: expression
from: '[a-zA-Z0-9]{40}'
- name: NPM_MIRROR
displayName: Custom NPM Mirror URL
description: The custom NPM mirror URL
value: ''