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

Explicitly set a host when using NodePort Service #352

Closed
wants to merge 12 commits into from

Conversation

andersbogsnes
Copy link
Contributor

Previously, if the service type was a NodePort, KubeCluster would attempt to discover the IP address by listing nodes. This is a set of permissions that not all users will have, so this PR adds the ability to explicitly set a known host.

Closes #348

Previously, if the service type was a NodePort, KubeCluster would
attempt to discover the IP address by listing nodes. This is a set of
permissions that not all users will have, so this PR adds the ability to
explicitly set a known host.
@andersbogsnes
Copy link
Contributor Author

I'm unsure about how to test this implementation, as I can't see a means of getting the node IP address when using pytest-kind.

Even docker inspect gives me a blank IP Adress

Copy link
Member

@jacobtomlinson jacobtomlinson left a comment

Choose a reason for hiding this comment

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

Thanks so much for raising this @andersbogsnes.

I think for testing it will be tricky as the Kubernetes cluster is inside a docker container and I expect it will not be possible to access the nodeport directly. I would perhaps add some check that the external_address attribute gets set correctly when the nodeport IP is provided. But I do not expect to actually be able to connect to it.

I've added some comments below because you seem to be reusing the host kwarg which is used for a different purpose.

.gitignore Outdated Show resolved Hide resolved
dask_kubernetes/core.py Outdated Show resolved Hide resolved
@andersbogsnes
Copy link
Contributor Author

Thanks for the review! I'll focus on testing some verifications that the correct values have been set.

In terms of the API - since we don't want to reuse the host arg, and we can currently only set scheduler type in the config, I see two options.

  • Set scheduler-type and NodePort-host in the config
  • Have both available as kwargs in the init.

Personal preference is #2, but I fully appreciate the danger of a million-param init

@jacobtomlinson
Copy link
Member

jacobtomlinson commented Jul 29, 2021

The host arg is used for a different purpose. I see no harm in adding an additional kwarg for this. We should also support this in the config.

Added the option to set scheduler_service_type in the KubeCluster init
Added the nodeport_host option to KubeCluster which allows the enduser
to override the default behaviour of listing all nodes to get the IP of a node.
Simulates running _start, as kind doesn't support NodePorts
@andersbogsnes
Copy link
Contributor Author

I've implemented the two keywords nodeport_host and scheduler_service_type. I've modified the test to simulate calling KubeCluster._start() as closely as possible, as actually calling it will cause the test to fail, since it can't connect to the Kind cluster with a NodePort

dask_kubernetes/core.py Outdated Show resolved Hide resolved
dask_kubernetes/core.py Outdated Show resolved Hide resolved
dask_kubernetes/utils.py Outdated Show resolved Hide resolved
dask_kubernetes/tests/test_async.py Outdated Show resolved Hide resolved
@jacobtomlinson
Copy link
Member

Hey @andersbogsnes. This PR is still marked as a draft. Is it ready for a full review yet?

@andersbogsnes andersbogsnes marked this pull request as ready for review October 19, 2021 19:19
@andersbogsnes
Copy link
Contributor Author

@jacobtomlinson Thanks for the ping - had left this one a bit fallow! I believe so, incorporated your previous suggestions, though could never get through the CI tests - they would hang and time out, despite working fine locally

@jacobtomlinson
Copy link
Member

Thanks @andersbogsnes. We recently resolved some CI issues so I'll pull in the latest changes here and see if we can get CI passing.

@jacobtomlinson
Copy link
Member

Looks like a valid failure in CI now related to this PR. @andersbogsnes would you mind taking a look?

@andersbogsnes
Copy link
Contributor Author

Progress 😀

I'll have a look

@jacobtomlinson
Copy link
Member

Sorry we never got to merging this. The project has changed a lot since this was raised so going to close it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to set NodePort IP manually
2 participants