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

Get kubernetes version for all cloud providers + pytest refactor #927

Merged
merged 53 commits into from Dec 13, 2021

Conversation

iameskild
Copy link
Member

@iameskild iameskild commented Nov 17, 2021

Fixes | Closes | Resolves #854 #628

Please remove anything marked as optional that you don't need to fill in. Choose one of the keywords preceding to refer to the issue this PR solves, followed by the issue number (e.g Fixes # 666). If there is no issue, remove the line. Remove this note after reading.

Changes:

Besides adding/updating kubernetes_versions functions for all the cloud providers, I have made the following motivated changes:

  • Standardized how all of the kubernetes_versions functions behave. For all cloud providers, they return a list of available kubernetes versions from oldest to latest.
    • To avoid having to set cloud credentials and using the cloud provider SDK, set QHUB_K8S_VERSION environment variable.
  • If the user doesn't specify a kubernetes version during qhub init, the latest available version will be used.
  • If the user tries to specify an "unsupported" version, it will cause a ValueError
    • Now each render_config (qhub init and qhub render) will check the kubernetes version using the cloud provider SDK. This will require setting the appropriate credentials.
  • Updates to test suite include a setup_fixture which can be reused for any test that calls render_config, reducing the amount of duplicated code.

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

Requires testing

  • Yes
  • No

In case you checked yes, did you write tests?

  • Yes
  • No

Large test suit refactor.

Further comments (optional)

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered and more.

Copy link
Contributor

@viniciusdc viniciusdc left a comment

Choose a reason for hiding this comment

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

LGTM, but as I was already tired in the end, it should be interesting to have someone else inspect the pytest parts XD. But in general, that's an amazing job, thanks @iameskild !!!!

.github/workflows/test-provider.yaml Outdated Show resolved Hide resolved
docs/source/installation/usage.md Outdated Show resolved Hide resolved
docs/source/installation/usage.md Outdated Show resolved Hide resolved
docs/source/installation/usage.md Show resolved Hide resolved
docs/source/installation/usage.md Outdated Show resolved Hide resolved
qhub/initialize.py Outdated Show resolved Hide resolved
config["profiles"] = DEFAULT_PROFILES
config["environments"] = DEFAULT_ENVIRONMENTS
config["profiles"] = DEFAULT_PROFILES.copy()
config["environments"] = DEFAULT_ENVIRONMENTS.copy()

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to add the Kubernetes version checker here?

### Verify Kubernetes version
_set_kubernetes_version(config, kubernetes_version, cloud_provider)

Then we could have just one call for it, and remove it from the conditionals above

Copy link
Member Author

Choose a reason for hiding this comment

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

@viniciusdc the current state requires that cloud_provider be passed to the _set_kubernetes_version which means we can't simply replace all of these functions calls with one call. We might be able to do something like:

for cloud_provider in ["aws", "do", "azure", "gcp", "local"]:
    _set_kubernetes_version(config, kubernetes, cloud_provider)

qhub/initialize.py Outdated Show resolved Hide resolved
preserved_filename = preserved_directory / "file.txt"
preserved_filename.write_text("This is a test...")

yield (qhub_config_loc, render_config_inputs)
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM, but it would be good to have someone else to have a look as well

Copy link
Contributor

@danlester danlester left a comment

Choose a reason for hiding this comment

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

Excellent, thank you!

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

Successfully merging this pull request may close these issues.

[bug] Kubernetes version specifed in qhub-config.yaml not respected (AWS deployments)
3 participants