Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Fix double http in the Spark Driver UI Link #347

Closed
wants to merge 5 commits into from

Conversation

mucahitkantepe
Copy link
Contributor

@mucahitkantepe mucahitkantepe commented Apr 26, 2023

Fixes flyteorg/flyte#3623

Spark operator code: https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/blob/5f2efd4ff97e7c0bfdb726a066118d3401576730/pkg/controller/sparkapplication/sparkui.go#L57

This change solves the problem by keeping Flyte compatible with older version of Spark Operator.
Another, simpler implentation is to just pass whatever spark operator gives. Browsers will add https automatically?

@welcome
Copy link

welcome bot commented Apr 26, 2023

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

Signed-off-by: mucahit-kantepe <[email protected]>
@kumare3
Copy link
Contributor

kumare3 commented Apr 27, 2023

a small code change suggested, then looks good

mucahitkantepe and others added 2 commits April 26, 2023 21:28
Co-authored-by: Ketan Umare <[email protected]>
Signed-off-by: Mücahit Kantepe <[email protected]>
Signed-off-by: Mücahit Kantepe <[email protected]>
@codecov
Copy link

codecov bot commented Apr 27, 2023

Codecov Report

Merging #347 (098fa3e) into master (63e1e45) will increase coverage by 1.31%.
The diff coverage is 100.00%.

❗ Current head 098fa3e differs from pull request most recent head 9fb2b0d. Consider uploading reports for the commit 9fb2b0d to get more accurate results

@@            Coverage Diff             @@
##           master     #347      +/-   ##
==========================================
+ Coverage   62.77%   64.08%   +1.31%     
==========================================
  Files         148      148              
  Lines       12434    10074    -2360     
==========================================
- Hits         7805     6456    -1349     
+ Misses       4034     3023    -1011     
  Partials      595      595              
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
go/tasks/plugins/k8s/spark/spark.go 79.44% <100.00%> (+1.88%) ⬆️

... and 130 files with indirect coverage changes

pingsutw
pingsutw previously approved these changes Apr 28, 2023
fmt
Signed-off-by: mucahit-kantepe <[email protected]>
Comment on lines +411 to +412
uri := strings.TrimPrefix(sj.Status.DriverInfo.WebUIIngressAddress, "http://")
customInfoMap[sparkDriverUI] = fmt.Sprintf("https://%s", uri)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To maintain backwards compatibility does it make sense to check for the prefix rather than removing it (noop if it doesn't exist) and then appending it? Maybe something like

uri := sj.Status.DriverInfo.WebUIIngressAddress
if !strings.HasPrefix("https://") {
    uri = fmt.Sprintf("https://%s", uri)
}
customInfoMap[sparkDriverUI] = uri

customInfoMap[sparkDriverUI] = fmt.Sprintf("https://%s", sj.Status.DriverInfo.WebUIIngressAddress)
// Older versions of spark-operator does not append http:// but newer versions do.
uri := strings.TrimPrefix(sj.Status.DriverInfo.WebUIIngressAddress, "http://")
customInfoMap[sparkDriverUI] = fmt.Sprintf("https://%s", uri)
Copy link
Contributor

@EngHabu EngHabu May 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't assume SSL all the time. Does spark enforce ssl?

uri := sj.Status.DriverInfo.WebUIIngressAddress
if !strings.HasPrefix("https://") && !strings.HasPrefix("http://") {
    uri = fmt.Sprintf("https://%s", uri)
}

customInfoMap[sparkDriverUI] = uri

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, so we should just pass the WebUIIngressAddress value along?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mucahitkantepe yes, and then if it does not contain https or http we can prepend with https as Haytham suggests.

@hamersaw
Copy link
Contributor

work completed in #389

@hamersaw hamersaw closed this Aug 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Spark Task Driver UI Link is broken
5 participants