forked from kubeflow/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.jsonnet
87 lines (82 loc) · 1.92 KB
/
ui.jsonnet
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
local env = std.extVar("__ksonnet/environments");
local params = std.extVar("__ksonnet/params").components.ui;
local k = import "k.libsonnet";
local name = params.name;
local namespace = env.namespace;
local updatedParams = {
serviceType: "ClusterIP",
image: "gcr.io/kubeflow-images-public/issue-summarization-ui:latest",
modelUrl: "http://issue-summarization.kubeflow.svc.cluster.local:8000/api/v0.1/predictions",
} + params;
local service = {
apiVersion: "v1",
kind: "Service",
metadata: {
name: "issue-summarization-ui",
namespace: env.namespace,
annotations: {
"getambassador.io/config": "---\napiVersion: ambassador/v0\nkind: Mapping\nname: issue_summarization_ui\nprefix: /issue-summarization/\nrewrite: /\nservice: issue-summarization-ui:80\n",
},
},
spec: {
ports: [
{
port: 80,
targetPort: 80,
},
],
selector: {
app: "issue-summarization-ui",
},
type: updatedParams.serviceType,
},
};
local deployment = {
apiVersion: "apps/v1beta1",
kind: "Deployment",
metadata: {
name: "issue-summarization-ui",
namespace: env.namespace,
},
spec: {
replicas: 1,
template: {
metadata: {
labels: {
app: "issue-summarization-ui",
},
},
spec: {
containers: [
{
args: [
"app.py",
"--model_url",
updatedParams.modelUrl,
],
command: [
"python",
],
image: updatedParams.image,
env: [
{
name: "GITHUB_TOKEN",
value: updatedParams.githubToken,
}
],
name: "issue-summarization-ui",
ports: [
{
containerPort: 80,
},
],
},
],
},
},
},
};
k.core.v1.list.new([
service,
deployment,
])