-
Notifications
You must be signed in to change notification settings - Fork 8
/
rahti-ml-example-template.yaml
165 lines (153 loc) · 4.13 KB
/
rahti-ml-example-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
apiVersion: v1
kind: Template
labels:
app: ${NAME}
template: ${NAME}
message: |-
A simple Machine Learning example (sentiment detection) service has been scheduled for creation in your project, and should be soon available at: https://${NAME}.${APPLICATION_DOMAIN_SUFFIX}
Building images takes some minutes to complete, so please be patient. You can follow progress on your projects overview page.
metadata:
annotations:
description: This template deploys A simple Machine Learning (sentiment detection) service.
iconClass: fa fa-robot
openshift.io/display-name: ML Example
openshift.io/documentation-url: https://github.com/CSCfi/rahti-ml-examples
openshift.io/support-url: https://www.csc.fi/contact-info
openshift.io/long-description:
openshift.io/provider-display-name: CSC
tags: rahti-ml-examples
template.openshift.io/bindable: "false"
name: rahti-ml-examples
objects:
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
annotations:
description: Defines how the service is built.
labels:
app: ${NAME}
name: ${NAME}-bc
spec:
output:
to:
kind: ImageStreamTag
name: ${NAME}:latest
source:
git:
ref: ${SOURCE_REPOSITORY_REF}
uri: ${SOURCE_REPOSITORY_URL}
type: Git
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: python:3.8
namespace: openshift
type: Source
triggers:
- type: ImageChange
- type: ConfigChange
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
annotations:
description: Reference for latest service image.
labels:
app: ${NAME}
name: ${NAME}
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
annotations:
description: Defines how the service is deployed.
labels:
app: ${NAME}
name: ${NAME}-dc
spec:
replicas: 1
strategy:
type: Rolling
template:
metadata:
labels:
app: ${NAME}
spec:
containers:
- name: ${NAME}
image: ${NAME}:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
nvidia.com/gpu: ${GPU_RESOURCE_LIMIT}
triggers:
- imageChangeParams:
automatic: true
containerNames:
- ${NAME}
from:
kind: ImageStreamTag
name: ${NAME}:latest
type: ImageChange
- type: ConfigChange
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
description: Exposes the services to public.
labels:
app: ${NAME}
name: ${NAME}-route
spec:
port:
targetPort: 8080-tcp
to:
kind: Service
name: ${NAME}-srv
weight: 100
wildcardPolicy: None
- apiVersion: v1
kind: Service
metadata:
annotations:
description: Defines an internal proxy.
labels:
app: ${NAME}
name: ${NAME}-srv
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
deploymentconfig: ${NAME}-dc
####################
parameters:
- description: Unique identifier for your application.
displayName: Application Name
name: NAME
value: rahti-ml-examples
required: true
- description: The URL of repository with the application code (change the default only if you know what you are doing).
displayName: Source Repository URL
name: SOURCE_REPOSITORY_URL
value: https://github.com/CSCfi/rahti-ml-examples
required: true
- description: The branch of the source repository (tf2-imdb, onnx-imdb).
displayName: Source Repository Branch
name: SOURCE_REPOSITORY_REF
value: tf2-imdb
required: true
- description: The exposed hostname suffix that will be used to create routes for app
displayName: Application Hostname Suffix
name: APPLICATION_DOMAIN_SUFFIX
required: true
value: rahtiapp.fi
- description: GPU resource limit (change the default if you are sure GPU is available)
displayName: GPU resource limit
name: GPU_RESOURCE_LIMIT
required: true
value: '0'