Skip to content

Commit 69a6f97

Browse files
author
Liav Weiss (EXT-Nokia)
committed
feat(ws): Define k8s workload manifest for backend component + istio - #324
Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]>
1 parent eab1ce7 commit 69a6f97

17 files changed

+209
-85
lines changed

workspaces/backend/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ $(GOLANGCI_LINT): $(LOCALBIN)
155155

156156
.PHONY: deploy
157157
deploy: kustomize ## Deploy backend to the K8s cluster specified in ~/.kube/config.
158-
cd manifests/kustomize/base && $(KUSTOMIZE) edit set image nb-backend=${IMG}
159-
$(KUSTOMIZE) build manifests/kustomize/base | $(KUBECTL) apply -f -
158+
cd manifests/kustomize/overlays/istio && $(KUSTOMIZE) edit set image workspaces-backend=${IMG}
159+
$(KUBECTL) apply -k manifests/kustomize/overlays/istio
160160

161161
.PHONY: undeploy
162162
undeploy: kustomize ## Undeploy backend from the K8s cluster specified in ~/.kube/config.
163-
$(KUSTOMIZE) build manifests/kustomize/base | $(KUBECTL) delete --ignore-not-found=true -f -
163+
$(KUBECTL) delete -k manifests/kustomize/overlays/istio --ignore-not-found=true
164164

165165

166166
##@ Dependencies

workspaces/backend/manifests/kustomize/base/deployment.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: backend
4+
name: workspaces-backend
55
spec:
66
replicas: 1
77
selector:
@@ -15,21 +15,21 @@ spec:
1515
metadata:
1616
labels: {}
1717
spec:
18-
serviceAccountName: backend
18+
serviceAccountName: workspaces-backend
1919
securityContext:
2020
runAsNonRoot: true
2121
terminationGracePeriodSeconds: 30
2222
containers:
23-
- name: nb-backend
24-
image: nb-backend
23+
- name: workspaces-backend
24+
image: workspaces-backend
2525
imagePullPolicy: IfNotPresent
2626
securityContext:
2727
allowPrivilegeEscalation: false
2828
capabilities:
2929
drop:
3030
- "ALL"
3131
ports:
32-
- name: http-backend
32+
- name: http-api
3333
containerPort: 4000
3434
env:
3535
- name: PORT
@@ -44,7 +44,7 @@ spec:
4444
livenessProbe:
4545
httpGet:
4646
path: /api/v1/healthcheck
47-
port: http-backend
47+
port: http-api
4848
scheme: HTTP
4949
initialDelaySeconds: 30
5050
periodSeconds: 20
@@ -54,10 +54,10 @@ spec:
5454
readinessProbe:
5555
httpGet:
5656
path: /api/v1/healthcheck
57-
port: http-backend
57+
port: http-api
5858
scheme: HTTP
5959
initialDelaySeconds: 10
6060
periodSeconds: 10
6161
timeoutSeconds: 5
6262
failureThreshold: 3
63-
successThreshold: 1
63+
successThreshold: 1
Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33

4-
namespace: kubeflow-system
5-
namePrefix: nb-
4+
namespace: kubeflow-workspaces
65

76
resources:
8-
- service_account.yaml
9-
- rbac.yaml
10-
- service.yaml
11-
- deployment.yaml
12-
13-
images:
14-
- name: nb-backend
15-
16-
labels:
17-
- includeSelectors: true
18-
pairs:
19-
app.kubernetes.io/name: kubeflow-notebooks
20-
app.kubernetes.io/component: backend
21-
app.kubernetes.io/managed-by: kustomize
7+
- namespace.yaml
8+
- service_account.yaml
9+
- rbac.yaml
10+
- service.yaml
11+
- deployment.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

workspaces/backend/manifests/kustomize/base/rbac.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: backend-clusterrole
4+
name: workspaces-backend
55
rules:
66
- apiGroups:
77
- kubeflow.org
@@ -16,16 +16,24 @@ rules:
1616
- update
1717
- patch
1818
- delete
19+
- apiGroups:
20+
- ""
21+
resources:
22+
- namespaces
23+
verbs:
24+
- get
25+
- list
26+
- watch
1927
---
2028
apiVersion: rbac.authorization.k8s.io/v1
2129
kind: ClusterRoleBinding
2230
metadata:
23-
name: backend-clusterrolebinding
31+
name: workspaces-backend
2432
roleRef:
2533
apiGroup: rbac.authorization.k8s.io
2634
kind: ClusterRole
27-
name: backend-clusterrole
35+
name: workspaces-backend
2836
subjects:
2937
- kind: ServiceAccount
30-
name: nb-backend
31-
namespace: kubeflow-system
38+
name: workspaces-backend
39+
namespace: kubeflow-workspaces
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4-
name: backend
4+
name: workspaces-backend
55
spec:
66
selector: {}
77
ports:
8-
- name: http-backend
8+
- name: http-api
99
port: 4000
10-
targetPort: http-backend
11-
type: ClusterIP
10+
targetPort: http-api
11+
type: ClusterIP
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apiVersion: v1
22
kind: ServiceAccount
33
metadata:
4-
name: backend
4+
name: workspaces-backend
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-backend
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-backend
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-backend
5+
spec:
6+
host: workspaces-backend.kubeflow-workspaces.svc.cluster.local
7+
trafficPolicy:
8+
tls:
9+
mode: DISABLE

0 commit comments

Comments
 (0)