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

Add proxy agent runner for kubeflow pipeline #988

Merged
merged 5 commits into from
Mar 22, 2019
Merged

Add proxy agent runner for kubeflow pipeline #988

merged 5 commits into from
Mar 22, 2019

Conversation

IronPan
Copy link
Member

@IronPan IronPan commented Mar 19, 2019

This is the initial change to add a proxy agent for a kubeflow pipeline cluster.

The container should be launched as a K8s Deployment in the same namespace that kubeflow is deployed.

The agent runner will register to the proxy server and store the metadata in a ConfigMap. In a failover case that the agent die, the new agent should pick up the metadata from the ConfigMap.


This change is Reviewable

@IronPan
Copy link
Member Author

IronPan commented Mar 19, 2019

/assign @ojarjur

@IronPan
Copy link
Member Author

IronPan commented Mar 19, 2019

/test kubeflow-pipeline-e2e-test

@IronPan
Copy link
Member Author

IronPan commented Mar 19, 2019

/assign @vicaire @hongye-sun @paveldournov

@IronPan
Copy link
Member Author

IronPan commented Mar 19, 2019

/test kubeflow-pipeline-e2e-test

@IronPan
Copy link
Member Author

IronPan commented Mar 19, 2019

/assign @abdallag

@k8s-ci-robot
Copy link
Contributor

@IronPan: GitHub didn't allow me to assign the following users: abdallag.

Note that only kubeflow members and repo collaborators can be assigned and that issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @abdallag

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
@k8s-ci-robot
Copy link
Contributor

@IronPan: GitHub didn't allow me to assign the following users: abdallag.

Note that only kubeflow members and repo collaborators can be assigned and that issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @abdallag

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.

Copy link
Contributor

@hongye-sun hongye-sun left a comment

Choose a reason for hiding this comment

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

The PR looks good to me. Just want to clarify several questions for the context of the PR.

proxy/Dockerfile Outdated Show resolved Hide resolved
@@ -0,0 +1,80 @@
#!/bin/bash
#
# Copyright 2017 Google Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

2019

Copy link
Member Author

Choose a reason for hiding this comment

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

done

proxy/Dockerfile Outdated
@@ -0,0 +1,21 @@
# Ping to a specific version of invert proxy agent
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add license header.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member Author

Choose a reason for hiding this comment

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

done

proxy/Dockerfile Outdated Show resolved Hide resolved
proxy/attempt-register-vm-on-proxy.sh Show resolved Hide resolved
status_code = requests.head(url).status_code
except requests.ConnectionError:
pass
expected_codes = frozenset([307, 401])
Copy link
Contributor

Choose a reason for hiding this comment

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

Not quite sure why those 2 codes are expected, especially for unauthorized.

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks! 307 is legit. 401 is not good. I'll remove it.

proxy/get_proxy_url.py Show resolved Hide resolved
except requests.ConnectionError:
pass
expected_codes = frozenset([307])
# 307 - Temporary Redirect, Proxy server sends this if VM has access rights.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: it's still weird that the endpoint only returns 307 as normal response status and not 200. Could you confirm if it's the case with the Jaas team?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah i double checked with slava earlier and this is intended behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

3xx codes are pretty normal.
Codes < 400 describe success.

Copy link
Contributor

@hongye-sun hongye-sun left a comment

Choose a reason for hiding this comment

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

/lgtm

@IronPan
Copy link
Member Author

IronPan commented Mar 20, 2019

/test kubeflow-pipeline-e2e-test

@IronPan
Copy link
Member Author

IronPan commented Mar 20, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot
Copy link
Contributor

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

@IronPan
Copy link
Member Author

IronPan commented Mar 20, 2019

/hold

@IronPan
Copy link
Member Author

IronPan commented Mar 20, 2019

wait for @ojarjur review

raise ValueError("No working URL found")


main()
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually the main() call is put inside

if __name__ == '__main__':

This way the module can be loaded and used like a library.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

status_code = requests.head(url).status_code
except requests.ConnectionError:
pass
expected_codes = frozenset([307])
Copy link
Contributor

Choose a reason for hiding this comment

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

JFYI, the plain set also exists.
Nothing wrong with frozenset (immutable) though.

Copy link
Member Author

Choose a reason for hiding this comment

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

ack. thanks

"""CLI tool that returns URL of the proxy for particular zone and version."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
Copy link
Contributor

Choose a reason for hiding this comment

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

JFYI, These imports are probably only needed for python 2.

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed. removed

@Ark-kun
Copy link
Contributor

Ark-kun commented Mar 20, 2019

Some general notes:

  • Is the root directory the best place for this program? Maybe we can have something like deployment directory and put all deployment-related files there.
  • From user's perspective, how are they supposed to use/launch this?

Copy link

@ojarjur ojarjur left a comment

Choose a reason for hiding this comment

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

I feel like there is enough logic in the get_proxy_url.py module to justify adding unit tests for it; at least something that exercises the url_for_zone method.

proxy/Dockerfile Outdated
@@ -0,0 +1,21 @@
# Ping to a specific version of invert proxy agent
Copy link

Choose a reason for hiding this comment

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

s/Ping/Pin/

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@IronPan
Copy link
Member Author

IronPan commented Mar 21, 2019

added the tests as @ojarjur suggested.

Is the root directory the best place for this program? Maybe we can have something like deployment directory and put all deployment-related files there.

I think adding to root is fine. Pipeline won't have its own deployment, and i'm considering moving this code to kubeflow repo once stable. Hosting here just for faster release.

From user's perspective, how are they supposed to use/launch this?

It's launched automatically as part of deployment. see kubeflow/kubeflow#2746

@Ark-kun
Copy link
Contributor

Ark-kun commented Mar 22, 2019

/lgtm

@IronPan
Copy link
Member Author

IronPan commented Mar 22, 2019

/hold cancel

@k8s-ci-robot k8s-ci-robot merged commit 44f6f93 into master Mar 22, 2019
@IronPan IronPan deleted the proxy branch March 27, 2019 17:54
@IronPan IronPan restored the proxy branch April 5, 2019 01:23
@IronPan IronPan deleted the proxy branch May 30, 2019 07:16
Linchin pushed a commit to Linchin/pipelines that referenced this pull request Apr 11, 2023
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.

7 participants