Skip to content
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

[UI] Pass namespace to APIs #2676

Merged
merged 14 commits into from
Dec 17, 2019
Merged

[UI] Pass namespace to APIs #2676

merged 14 commits into from
Dec 17, 2019

Conversation

Bobgy
Copy link
Contributor

@Bobgy Bobgy commented Nov 28, 2019

Part of multi user support.

Changes:

  • Pass context got from kubeflow central dashboard to KFP UI
  • When creating a run, namespace is added as a resource reference
  • When getting log from pods, namespace is passed to find the pod by (name, namespace)
  • Refactor unit tests because new context api doesn't work with enzyme shallow testing, changed to mounting complete instances [UI] Consider migrating from enzyme to @testing-library/react #2732.

TODO:

  • add unit tests

/cc @gaoning777
/area frontend
/kind feature


This change is Reviewable

@Bobgy Bobgy changed the title [UI] Pass namespace to APIs [WIP] [UI] Pass namespace to APIs Nov 28, 2019
@Bobgy Bobgy changed the title [WIP] [UI] Pass namespace to APIs [UI] Pass namespace to APIs Dec 16, 2019
@Bobgy
Copy link
Contributor Author

Bobgy commented Dec 16, 2019

@gaoning777 This is ready for review.

if (!k8sV1Client) {
throw new Error('Cannot access kubernetes API');
}
return (k8sV1Client.readNamespacedPodLog(podName, namespace, 'main') as any).then(
return (k8sV1Client.readNamespacedPodLog(podName, podNamespace || namespace, 'main') as any).then(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to update the global variable: namespace such that the getArgoWorkflow and getK8sSecret also work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to support those one by one. Global variable is shared and could be modified during processing of a request.

I don't currently know where those methods are used. I guess I should double check and make sure other features don't break.

Copy link
Contributor

Choose a reason for hiding this comment

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

e.g. I searched that https://github.com/kubeflow/pipelines/blob/master/frontend/server/workflow-helper.ts#L147 is the usage of the workflow-helper calling the getArgoWorkflow. Could you proof-check if this functions are called in other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that was added in #2081 to get pod log using argo workflow log persistence capability. I don't think we need to support this in multi user mode right now

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 verified these methods are only used for the use case I mentioned above. It's fine we defer these support.

Copy link
Contributor

@gaoning777 gaoning777 Dec 18, 2019

Choose a reason for hiding this comment

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

Does it mean if the deployed cluster contains preemptible VMs, the FE can still get the logs regardless of the liveness of the VM that runs the pods?

@jingzhang36
Copy link
Contributor

/lgtm

@Bobgy
Copy link
Contributor Author

Bobgy commented Dec 17, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Bobgy

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Bobgy
Copy link
Contributor Author

Bobgy commented Dec 17, 2019

/test kubeflow-pipeline-sample-test

@k8s-ci-robot k8s-ci-robot removed the lgtm label Dec 17, 2019
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@Bobgy Bobgy added the lgtm label Dec 17, 2019
@k8s-ci-robot k8s-ci-robot merged commit e86e409 into kubeflow:master Dec 17, 2019
@Bobgy Bobgy deleted the add-ns-in-ui branch January 9, 2020 05:54
Jeffwan pushed a commit to Jeffwan/pipelines that referenced this pull request Dec 9, 2020
* Format other frontend code using prettier

* Regenerate frontend api clients

* Pass namespace to CreateRun api request

* Fetch logs from pod namespace

* Fix log handler cannot work with pod name only query bug

* Fix and refactor existing tests

* Unit test adding namespace to create run api call.

* Remove unneeded snapshot

* Fix lint errors

* Consistently use resource reference id for namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants