forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scoped-router.yaml
96 lines (93 loc) · 1.78 KB
/
scoped-router.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
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Pod
metadata:
name: router
labels:
test: router
spec:
containers:
- name: router
image: openshift/origin-haproxy-router
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args: ["--namespace=$(POD_NAMESPACE)", "--loglevel=4", "--labels=select=first"]
ports:
- containerPort: 80
- containerPort: 443
- containerPort: 1936
name: stats
protocol: TCP
serviceAccountName: default
# ensure the router can access routes and endpoints
- apiVersion: v1
kind: RoleBinding
metadata:
name: view
subjects:
- kind: ServiceAccount
name: default
roleRef:
name: view
# two routes that differ only by their labels and names
- apiVersion: v1
kind: Route
metadata:
name: route-1
labels:
test: router
select: first
spec:
host: first.example.com
to:
name: endpoints
ports:
- targetPort: 8080
- apiVersion: v1
kind: Route
metadata:
name: route-2
labels:
test: router
select: second
spec:
host: second.example.com
to:
name: endpoints
ports:
- targetPort: http
# a service to be routed to
- apiVersion: v1
kind: Service
metadata:
name: endpoints
labels:
test: router
spec:
selector:
test: router
endpoints: router
ports:
- port: 8080
# a pod that serves a response
- apiVersion: v1
kind: Pod
metadata:
name: endpoint-1
labels:
test: router
endpoints: router
spec:
containers:
- name: test
image: openshift/hello-openshift
ports:
- containerPort: 8080
name: http
- containerPort: 100
protocol: UDP