-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
#1329 update the operator to allow subpaths to be used with the spark ui ingress. #1330
#1329 update the operator to allow subpaths to be used with the spark ui ingress. #1330
Conversation
@liyinan926 would you mind having a look at this when you get a chance? I'm not sure what documentation I should add here, because I consider this more of a bugfix then a new feature |
…ble which is passed around, and configure the Ingress manifest to work with subpaths Signed-off-by: Tom Hellier <me@tomhellier.com>
bf00835
to
6d47b89
Compare
I think this also resolves #1259 . The integration test appears to have failed because of some intermittent problem, but I cant seem to trigger a re-run. helm/kind-action#42 applying this seems to fix the kind issue |
d2cb1f0
to
96c4129
Compare
ingressURL, err := getSparkUIingressURL(c.ingressURLFormat, app.GetName(), app.GetNamespace()) | ||
if err != nil { | ||
glog.Errorf("failed to run get ingress url %s/%s: %v", app.Namespace, app.Name, err) | ||
} |
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.
An else
should be used here as the code below should only be run if err == nil.
if err != nil { | ||
return nil, err | ||
} | ||
var ingressURLPath = ingressURL.Path |
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.
ingressURLPath := ingressURI.Path
} | ||
var ingressURLPath = ingressURL.Path | ||
// If we're serving on a subpath, we need to ensure we create capture groups | ||
if ingressURL.Path != "" && ingressURL.Path != "/" { |
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.
Use ingressURLPath
here.
@@ -115,11 +120,19 @@ func createSparkUIIngress(app *v1beta2.SparkApplication, service SparkService, i | |||
if len(ingressResourceAnnotations) != 0 { | |||
ingress.ObjectMeta.Annotations = ingressResourceAnnotations | |||
} | |||
|
|||
// If we're serving on a subpath, we need to ensure we use the capture groups | |||
if ingressURL.Path != "" && ingressURL.Path != "/" { |
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.
Ditto, use ingressURLPath
.
@@ -542,7 +554,10 @@ func TestCreateSparkUIIngress(t *testing.T) { | |||
app: app1, | |||
expectedIngress: SparkIngress{ | |||
ingressName: fmt.Sprintf("%s-ui-ingress", app1.GetName()), | |||
ingressURL: "ingress.clusterName.com/" + app1.GetNamespace() + "/" + app1.GetName(), | |||
ingressURL: parseURLAndAssertError("ingress.clusterName.com/"+app1.GetNamespace()+"/"+app1.GetName(), t), |
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.
do you know if this will also work when there is no hostname, eg:
ingressUrlFormat="/{{$appNamespace}}/{{$appName}}"
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.
I tried this in the test and looks like it does! 🎉
app.Spec.SparkConf = make(map[string]string) | ||
} | ||
app.Spec.SparkConf["spark.ui.proxyBase"] = ingressURL.Path | ||
app.Spec.SparkConf["spark.ui.proxyRedirectUri"] = "/" |
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.
might be worth covering this in a test?
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.
I've written a test which covers this (sort of)... however, it looks like when I'm writing to SparkConf here, the contents of SparkConf isn't written back to the kubernetes resource. I'm unsure whether it is worth syncing this contents back to the SparkApplication when this has been done
…e subpath condition, and protect against empty paths Signed-off-by: Tom Hellier <me@tomhellier.com>
96c4129
to
e3b0b5e
Compare
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.
🥳
i'm really missing this feature! can we merge it? |
…he spark ui ingress. (kubeflow#1330) * Slightly restructure the way the ingressURL is created, and the variable which is passed around, and configure the Ingress manifest to work with subpaths Signed-off-by: Tom Hellier <me@tomhellier.com> * fix kubeflow#1329 unit tests now capture groups are being added in the subpath condition, and protect against empty paths Signed-off-by: Tom Hellier <me@tomhellier.com>
Slightly restructure the way the ingressURL is created, and the variable which is passed around, and configure the Ingress manifest to work with subpaths
Fixes #1329
This allows me to use the following ingressUrlFormat
spark.example.com/sparkjobs/{{$appName}}
, and the urlspark.example.com/sparkjobs/spark-pi-1629482011066826445 now displays the spark ui correctly.