Skip to content

Commit a2a8b17

Browse files
committed
feat(ws): Define k8s workload manifest for frontend component #404
Signed-off-by: Noa <[email protected]>
1 parent bd66a26 commit a2a8b17

File tree

10 files changed

+282
-0
lines changed

10 files changed

+282
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: workspaces-frontend
5+
spec:
6+
selector:
7+
matchLabels: {}
8+
replicas: 1
9+
strategy:
10+
type: RollingUpdate
11+
rollingUpdate:
12+
maxUnavailable: 0
13+
maxSurge: 1
14+
template:
15+
spec:
16+
terminationGracePeriodSeconds: 30
17+
containers:
18+
- name: workspaces-frontend
19+
image: workspaces-frontend
20+
imagePullPolicy: IfNotPresent
21+
securityContext:
22+
allowPrivilegeEscalation: false
23+
capabilities:
24+
drop:
25+
- "ALL"
26+
ports:
27+
- name: http-ui
28+
containerPort: 8080
29+
env:
30+
- name: PORT
31+
value: "8080"
32+
resources:
33+
limits:
34+
cpu: "1"
35+
memory: 512Mi
36+
requests:
37+
cpu: 100m
38+
memory: 256Mi
39+
livenessProbe:
40+
httpGet:
41+
path: /
42+
port: http-ui
43+
scheme: HTTP
44+
initialDelaySeconds: 15
45+
periodSeconds: 20
46+
timeoutSeconds: 5
47+
failureThreshold: 3
48+
readinessProbe:
49+
httpGet:
50+
path: /
51+
port: http-ui
52+
scheme: HTTP
53+
initialDelaySeconds: 5
54+
periodSeconds: 10
55+
timeoutSeconds: 3
56+
failureThreshold: 3
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
namespace: kubeflow-workspaces
5+
6+
resources:
7+
- namespace.yaml
8+
- deployment.yaml
9+
- service.yaml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: kubeflow-workspaces
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: workspaces-frontend
5+
spec:
6+
ports:
7+
- name: http-ui
8+
port: 8080
9+
targetPort: http-ui
10+
type: ClusterIP
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
4+
labels:
5+
- includeSelectors: true
6+
pairs:
7+
app.kubernetes.io/component: workspaces-frontend
8+
app.kubernetes.io/managed-by: kustomize
9+
app.kubernetes.io/name: kubeflow-workspaces
10+
app.kubernetes.io/part-of: kubeflow
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: security.istio.io/v1beta1
2+
kind: AuthorizationPolicy
3+
metadata:
4+
name: workspaces-frontend
5+
spec:
6+
action: ALLOW
7+
selector:
8+
matchLabels: {}
9+
rules:
10+
- {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: networking.istio.io/v1beta1
2+
kind: DestinationRule
3+
metadata:
4+
name: workspaces-frontend
5+
spec:
6+
host: workspaces-frontend.kubeflow-workspaces.svc.cluster.local
7+
trafficPolicy:
8+
tls:
9+
mode: DISABLE
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kustomize.config.k8s.io/v1alpha1
2+
kind: Component
3+
4+
resources:
5+
- destination-rule.yaml
6+
- virtual-service.yaml
7+
- authorization-policy.yaml
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: networking.istio.io/v1beta1
2+
kind: VirtualService
3+
metadata:
4+
name: workspaces-frontend
5+
spec:
6+
gateways:
7+
- kubeflow/kubeflow-gateway
8+
hosts:
9+
- '*'
10+
http:
11+
# Case 1: Exact match for /workspaces → rewrite to /
12+
- match:
13+
- uri:
14+
exact: /workspaces
15+
rewrite:
16+
uri: /
17+
route:
18+
- destination:
19+
host: workspaces-frontend.kubeflow-workspaces.svc.cluster.local
20+
port:
21+
number: 8080
22+
# Case 2: Prefix match for /workspaces/ → strip prefix by rewriting to /
23+
- match:
24+
- uri:
25+
prefix: /workspaces/
26+
rewrite:
27+
uri: /
28+
route:
29+
- destination:
30+
host: workspaces-frontend.kubeflow-workspaces.svc.cluster.local
31+
port:
32+
number: 8080
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
namespace: kubeflow-workspaces
5+
6+
resources:
7+
- ../../base
8+
9+
components:
10+
- ../../components/istio
11+
- ../../components/common
12+
13+
replacements:
14+
- source:
15+
fieldPath: metadata.namespace
16+
kind: Deployment
17+
name: workspaces-frontend
18+
targets:
19+
- fieldPaths:
20+
- metadata.name
21+
select:
22+
kind: Namespace
23+
name: kubeflow-workspaces
24+
- source:
25+
fieldPath: metadata.name
26+
kind: Service
27+
name: workspaces-frontend
28+
version: v1
29+
targets:
30+
- fieldPaths:
31+
- spec.http.0.route.0.destination.host
32+
options:
33+
delimiter: .
34+
select:
35+
group: networking.istio.io
36+
kind: VirtualService
37+
name: workspaces-frontend
38+
version: v1beta1
39+
- fieldPaths:
40+
- spec.http.1.route.0.destination.host
41+
options:
42+
delimiter: .
43+
select:
44+
group: networking.istio.io
45+
kind: VirtualService
46+
name: workspaces-frontend
47+
version: v1beta1
48+
- fieldPaths:
49+
- spec.host
50+
options:
51+
delimiter: .
52+
select:
53+
group: networking.istio.io
54+
kind: DestinationRule
55+
name: workspaces-frontend
56+
version: v1beta1
57+
- source:
58+
fieldPath: metadata.namespace
59+
kind: Service
60+
name: workspaces-frontend
61+
version: v1
62+
targets:
63+
- fieldPaths:
64+
- spec.http.0.route.0.destination.host
65+
options:
66+
delimiter: .
67+
index: 1
68+
select:
69+
group: networking.istio.io
70+
kind: VirtualService
71+
name: workspaces-frontend
72+
version: v1beta1
73+
- fieldPaths:
74+
- spec.http.1.route.0.destination.host
75+
options:
76+
delimiter: .
77+
index: 1
78+
select:
79+
group: networking.istio.io
80+
kind: VirtualService
81+
name: workspaces-frontend
82+
version: v1beta1
83+
- fieldPaths:
84+
- spec.host
85+
options:
86+
delimiter: .
87+
index: 1
88+
select:
89+
group: networking.istio.io
90+
kind: DestinationRule
91+
name: workspaces-frontend
92+
version: v1beta1
93+
- source:
94+
fieldPath: spec.ports.[name=http-ui].port
95+
kind: Service
96+
name: workspaces-frontend
97+
version: v1
98+
targets:
99+
- fieldPaths:
100+
- spec.http.0.route.0.destination.port.number
101+
select:
102+
group: networking.istio.io
103+
kind: VirtualService
104+
name: workspaces-frontend
105+
version: v1beta1
106+
- fieldPaths:
107+
- spec.http.1.route.0.destination.port.number
108+
select:
109+
group: networking.istio.io
110+
kind: VirtualService
111+
name: workspaces-frontend
112+
version: v1beta1
113+
- source:
114+
fieldPath: spec.selector.matchLabels
115+
kind: Deployment
116+
name: workspaces-frontend
117+
targets:
118+
- fieldPaths:
119+
- spec.selector.matchLabels
120+
select:
121+
kind: AuthorizationPolicy
122+
name: workspaces-frontend
123+
124+
patches:
125+
- patch: |-
126+
- op: remove
127+
path: /metadata/labels/app.kubernetes.io~1component
128+
- op: remove
129+
path: /metadata/labels/app.kubernetes.io~1name
130+
- op: add
131+
path: /metadata/labels/istio-injection
132+
value: enabled
133+
target:
134+
kind: Namespace
135+
name: kubeflow-workspaces

0 commit comments

Comments
 (0)