-
Notifications
You must be signed in to change notification settings - Fork 65
feat(ws): setup virtualservice to route traffic for workspaces #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: notebooks-v2
Are you sure you want to change the base?
Conversation
4dcf94e
to
50b6026
Compare
/ok-to-test |
50b6026
to
a39f413
Compare
a39f413
to
7d737a2
Compare
services[i].HttpService = &HttpService{ | ||
DisplayName: ptr.Deref(port.DisplayName, wskPodTemplatePorts[i].DefaultDisplayName), | ||
HttpPath: fmt.Sprintf("/workspace/%s/%s/%s/", ws.Namespace, ws.Name, port.Id), | ||
HttpPath: fmt.Sprintf("/workspace/connect/%s/%s/%s/", ws.Namespace, ws.Name, port.Id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, we should update all other instances which look like /workspace/...
path string formatters (do a search over the whole project)
In addition, we should update the doc string of the WorkspaceKind types (in controller) and the doc string of the WorkspaceKind same (which should usually match the go doc string anyway).
7d737a2
to
7992330
Compare
- Update the helper func with CopyDeepVirtualService Signed-off-by: Harshad Reddy Nalla <[email protected]>
7992330
to
b2571d9
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Harshad Reddy Nalla <[email protected]>
Signed-off-by: Harshad Reddy Nalla <[email protected]>
Signed-off-by: Harshad Reddy Nalla <[email protected]>
} | ||
|
||
// CopyVirtualServiceFields updates a target VirtualService with the fields from a desired VirtualService, returning true if an update is required. | ||
func CopyVirtualServiceFields(desired *istiov1.VirtualService, target *istiov1.VirtualService) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in meeting, we might want to do something like this (needs to be tested):
// CopyVirtualServiceFields updates a target VirtualService with the fields from a desired VirtualService, returning true if an update is required.
func CopyVirtualServiceFields(desired *istiov1.VirtualService, target *istiov1.VirtualService) bool {
requireUpdate := false
// copy `metadata.labels`
for k, v := range target.Labels {
if desired.Labels[k] != v {
requireUpdate = true
}
}
target.Labels = desired.Labels
// copy `metadata.annotations`
for k, v := range target.Annotations {
if desired.Annotations[k] != v {
requireUpdate = true
}
}
target.Annotations = desired.Annotations
// copy `spec`
// NOTE: we use proto.Equal to compare the specs of Istio resources are protobuf messages
// and messages with the same value are not considered equal with reflect.DeepEqual
if !proto.Equal(&target.Spec, &desired.Spec) {
target.Spec = *desired.Spec.DeepCopy()
requireUpdate = true
}
return requireUpdate
}
related: #37
follow-up: #42
Descriptions:
The PR allow controller to connect each workspace with an endpoint that is reachable under the istio mesh.
This virtualservice follow the pattern of unqiue name, so it doesnt collide with notebook v1, if running in the same cluster parallely.
Setup:
The setup require to set the istio deployment in places.
for initial setup:
deploy istio using from kubeflow manifest repo
After deployment of istio, deploy the controller with the image from PR content
make deploy IMG=quay.io/harshad16/nbcv2:controller-istio2
kubectl apply -k config/samples/
Port forward the istio ingress:
Open the browser, and goto:
localhost:8080//workspace/<namespace>/<workspace-name>/jupyterlab/lab
CRD change with port in podtemplate:
#507
demo:
Screencast from 2025-07-28 16-43-01.webm