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

Dynamic update of Kubespray and K8s [#10] #11

Conversation

michaelspedersen
Copy link
Collaborator

Description

Adds dynamic update of Kubespray at provisioning stage.
The version will be the most recent release of Kubespray. In addition, the Kubernetes version is based on the most recent supported version in Kubespray.

The Kubernetes version is fetched during the generate_config stage, while Kubespray is updated in the provision stage.

To utilize the dynamic update, release type must be specified as "kubespray" when generating the configuration file

/k8s-infra/bin/k8sinfra generate_config (...) --release-type=kubespray (...)

In addition to the dynamic update, a few patches to the Kubespray code are also included.

Context

With the existing image, the newest (stable) Kubernetes release is deployed. While this might be unofficially supported in the most recent Kubespray release, this cannot be guaranteed.

The changes are done based on observations in CNF Testbed, which deploys Kubernetes with Multus and CNI plugins by default. Due to this, a small set of patches are included to the Kubespray code, when deploying with the "kubespray" release-type.

Issues:

#10
cncf/cnf-testbed#344
cncf/cnf-testbed#345

How Has This Been Tested?

  • Covered by existing integration testing
  • Added integration testing to cover
  • Tested with trigger client against
    • cidev.cncf.ci
    • dev.cncf.ci
    • staging.cncf.ci
    • cncf.ci (production)
  • Tested locally
  • Have not tested

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • No updates required.

Adds support for latest Kubespray release and supported K8s version
@michaelspedersen michaelspedersen added the enhancement New feature or request label May 1, 2020
@michaelspedersen michaelspedersen self-assigned this May 1, 2020
@@ -153,6 +153,10 @@ class K8sInfra < Thor
if options['dry-run'] then
puts "Dry-run successfully completed"
else
if @cluster_hash['k8s_infra']["release_type"]=="kubespray" then
latest = ks.latest_kubespray_release
Copy link
Contributor

Choose a reason for hiding this comment

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

indent these lines

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the file it looks as follows - I think that's correct?

      else
        if @cluster_hash['k8s_infra']["release_type"]=="kubespray" then
	  latest = ks.latest_kubespray_release
	  ks.update_kubespray(latest)
        end

@@ -153,6 +153,10 @@ class K8sInfra < Thor
if options['dry-run'] then
puts "Dry-run successfully completed"
else
if @cluster_hash['k8s_infra']["release_type"]=="kubespray" then
latest = ks.latest_kubespray_release
ks.update_kubespray(latest)
Copy link
Contributor

Choose a reason for hiding this comment

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

updating kubespray itself every time might be a good idea even if using the latest stable K8s release from upstream.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That can be done. What about the addition of Multus and CNI plugins in the installation? Should that be part of default, or should it be kept as a separate e.g. "release" similar to how it is with dynamic Kubespray/K8s now?

ks = Kubespray.new(@cluster_hash)
ks_version = ks.latest_kubespray_release
k8s_version = ks.latest_supported_kubernetes(ks_version)
kubernetes_release = k8s_version + "\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

are the newlines necessary?

Copy link
Collaborator Author

@michaelspedersen michaelspedersen May 7, 2020

Choose a reason for hiding this comment

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

It is used to ensure the configuration file prints properly. I noticed lines were combined without it. I added it here as it is only a problem when kubernetes_release and stable_k8s_release are fetched dynamically.

With the release of v2.13, previous issues have been fixed
@michaelspedersen
Copy link
Collaborator Author

Previous workarounds for Kubespray v2.12 have been removed, since they are all fixed with the most recent v2.13

@taylor taylor merged commit 842b2c3 into crosscloudci:dynamic-kubespray-update May 7, 2020
@taylor taylor mentioned this pull request May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants