-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
add support for flexible config (via env var) for the pipline service and UI, fix broken links (pointed to API vs UI service) #1293
Conversation
… and UI, fix broken links (pointed to API vs UI service)
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Hi @yaronha. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
1 similar comment
Hi @yaronha. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
/assign @gaoning777 |
@gaoning777 @Ark-kun any update on this (tiny) PR ? |
Sorry. We'll try to review it soon. @kevinbache WDYT? |
@Ark-kun any updates on it? waiting for ~20 days on a rather simple patch |
/ok-to-test |
Would you mind resolving the conflicts? There seems to be a recent PR that is in conflict with this PR. |
/lgtm |
@Ark-kun @gaoning777 test failed, but seem to be related to some CI/infra issue not in my code, can u give it a look? |
/test kubeflow-pipeline-e2e-test |
THe KFP also runs a sample test in the background, which shows "run-notebook-tfx-tests: AttributeError: 'Client' object has no attribute '_uihost'" detailed logs are: https://prow.k8s.io/view/gcs/kubernetes-jenkins/pr-logs/pull/kubeflow_pipelines/1293/kubeflow-pipeline-sample-test/1136281786020532224 |
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.
sdk/python/kfp/_client.py
Outdated
@@ -52,21 +55,23 @@ def __init__(self, host=None, client_id=None, namespace='kubeflow'): | |||
""" | |||
|
|||
self._host = host | |||
self._uihost = os.environ.get(KF_PIPELINES_UI_ENDPOINT_ENV, '') |
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.
Can default value be host? Otherwise, it will break currently local notebook + port forward use case.
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.
@hongye-sun i'm trying to make the UI and API ports configurable from the environment variables, this way we dont have to use proxy server when there is a proper API/UI gateway.
i wasnt clear about the port forward case, are you forwarding the UI port or the API port, currently the it seems like host
and config.host
identifies the API port and the current code is broken, im one place you have:
if in_cluster:
config.host = Client.IN_CLUSTER_DNS_NAME.format(namespace)
return config
(i.e. host == API port)
in another:
if config.host:
config.host = os.path.join(config.host, Client.KUBE_PROXY_PATH.format(namespace))
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.
@yaronha, it makes sense to have API and UI addresses as separate configurations. We have a wiki to guide user to local port-forward on ambassador (https://www.kubeflow.org/docs/other-guides/accessing-uis/), which is the gateway for both API and UIs. We also have a notebook tutorial (https://github.com/amygdala/examples/blob/cookbook/cookbook/pipelines/notebooks/kfp_remote_deploy-no-IAP.ipynb) to guide user to use the SDK with local port forward and I think the UI link is working at this time. IAP guide (https://github.com/amygdala/examples/blob/cookbook/cookbook/pipelines/notebooks/kfp_remote_deploy.ipynb) should probably work, too. I think we should make the existing tutorial continues working, which assumes API and UI are both from the same host. That's why I suggest to keep the host as uihost if the env var is missing.
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.
@hongye-sun the examples above fall into two categories, using Proxy and using proprietary Google API gateway (IAP), we or others may have our own UI/API gateway with strong identity management (like IAP) so need a way to specify the the path to it.
The API and UI can be different hosts, since the API can be an internal cluster/DNS name, while the UI is accessed from a remote browser and need a publicly exposed URL.
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.
@yaronha, thanks for letting me know your use cases. let's keep both host and uihost. The only thing missing in the PR is that it changes the behavior for uihost if user doesn't provide env var, which might cause existing tutorial break. Could you make sure that in case of env var is missing, the uihost equals to host, just like today?
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.
Thanks, i will update
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.
@hongye-sun did u review my changes?
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.
Sorry for the delay. One more comment.
sdk/python/kfp/_client.py
Outdated
@@ -52,21 +55,23 @@ def __init__(self, host=None, client_id=None, namespace='kubeflow'): | |||
""" | |||
|
|||
self._host = host |
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.
host or os.environ.get(KF_PIPELINES_ENDPOINT_ENV)?
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.
its a simple/standard way to say host if host else os.env...
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 mean if we should set _host to be the value from env var if it's missing? Either it's from parameter or env var, it should be the same thing.
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.
@hongye-sun i consolidated self._host
and self._uihost
since _host
wasnt used, now if no env var and host
is provided it will use host
(still not clear, how host
will open up the browser on the UI if its the remote API endpoint)
sdk/python/kfp/_client.py
Outdated
@@ -52,21 +55,23 @@ def __init__(self, host=None, client_id=None, namespace='kubeflow'): | |||
""" | |||
|
|||
self._host = host |
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.
probably change the name to _api_host
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 think host
is can be misleading here as people think they do not need the https://
schema. endpoint
or uri
might be more appropriate.
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.
@hongye-sun it seems like self._host
is not used anymore so maybe we should only keep one, once we clarify the use of API vs UI (above)
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 think we need two one for API and one for UI. API endpoint can be passed as parameter or env var. UI endpoint can only be customized via env var. The default value of UI endpoint if env var is missing is same as API host. This is useful if the endpoint is from ambassador use case.
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.
Oh, sorry. API endpoint, might not need env var support as we support namespace customization.
/test kubeflow-pipeline-e2e-test |
/test kubeflow-pipeline-e2e-test |
sdk/python/kfp/_client.py
Outdated
config = self._load_config(host, client_id, namespace) | ||
api_client = kfp_server_api.api_client.ApiClient(config) | ||
self._run_api = kfp_server_api.api.run_service_api.RunServiceApi(api_client) | ||
self._experiment_api = kfp_server_api.api.experiment_service_api.ExperimentServiceApi(api_client) | ||
|
||
def _load_config(self, host, client_id, namespace): | ||
config = kfp_server_api.configuration.Configuration() | ||
config.host = config.host or os.environ.get(KF_PIPELINES_ENDPOINT_ENV) |
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.
host = host or os.environ.get(KF_PIPELINES_ENDPOINT_ENV, None)
Otherwise, the code will fail if no host and env var are provided.
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.
@hongye-sun i don't think get
fails, will just return None
just try this: print('' or os.environ.get('SOMEKEY'))
on your laptop
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.
you are right on the environ.get. You still need to change the config.host to host or you should change rest of the method body to check against config.host instead of host.
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.
@hongye-sun you can see the line below, (if host: config.host = host
), host will take precedence over the env var, i'm not clear why it doesnt address the case ?
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.
Better to go with test cases:
For example, (host=None, os.environ.get(KF_PIPELINES_ENDPOINT_ENV)='https://iap-endpoint/', client_id=''), in ln 70, iap token won't be fetched.
Another example, (host=None, os.environ.get(KF_PIPELINES_ENDPOINT_ENV)='https://iap-endpoint/', client_id=None), in ln 79, it will ignore config.host and override it with either incluster DNS or the default kubu config's endpoint.
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.
@hongye-sun ok, got u, switched to host
, make more sense
@IronPan @gaoning777 can u look into this PR? |
/retest |
/ok-to-test |
/lgtm |
Could you resolve the conflicts? Sorry for the delay, I was OOO. |
@IronPan @gaoning777 i resolved the conflict, please review this before doing more changes on that file so i wont need to do the merge for the 4th time |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: IronPan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
provide a client SDK mechanism to override pipline API & UI service endpoint URLs via environment var
also fixes an issue of broken ui link when not using the default host (host is API ep and link is a UI ep)
this addresses issue #1235
This change is