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

Standalone autopilot update logic #3406

Merged

Conversation

jnummelin
Copy link
Member

@jnummelin jnummelin commented Aug 23, 2023

Description

This PR introduces a fully standalone logic in autopilot to follow different update channels. The (upcoming) update server will host channels in this way:

  • latest: 1.28.0
  • stable/v1.27: 1.27.x (what ever is the latest in 1.27 series)
  • stable/v1.26: 1.26.x (what ever is the latest in 1.26 series)
  • unstable/v1.28: 1.28.0-beta.1 (what ever is the latest pre release in 1.28)

For each channel the update-server "protocol" is a simple yaml data:

channel: latest
version: v5.6.7
downloadURLs:
  - arch: amd64
    os: linux
    k0s: http://localhost/dist/k0s
    k0sSha: deadbeef
    airgapBundle: https://url.to.airgap/k0s-images-amd64.tgz
    airgapSha: deadbeef
  - arch: arm64
    os: linux
    k0s: http://localhost/dist/k0s
  - arch: arm
    os: linux
    k0s: http://localhost/dist/k0s

Essentially this offers an easy way for users to either always follow the latest version or stay up-to-date with some specific minor version.

Each time k0s checks for possible updates it sends some general cluster details to the update server to allow the server also to make some decisions which update to push. Following data is sent in HTTP Headers:

K0S_StorageType: etcd/kine
K0S_ClusterID: uuid of kube-system NS
K0S_ControlPlaneNodesCount: 3
K0S_WorkerData: base64 encoded json of worker node arch, OS type, container runtime type
K0S_Version: v1.27.2
K0S_CNIProvider: kuberouter/calico/custom

On top of the autopilot functionality there's a common component that will check if there's updates available and notifies cluster admin via Event. This checker does not perform any real updates, it's just a convenience way to inform admins there's new versions available. Neither does this component perform any checks if there is already a autopilot UpdateConfig in place.

Type of change

  • 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)
  • Documentation update

How Has This Been Tested?

  • Manual test
  • Auto test added

Checklist:

  • My code follows the style guidelines of this project
  • My commit messages are signed-off
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@jnummelin jnummelin force-pushed the feat/standalone-autopilot-updates branch 3 times, most recently from 52c5be8 to 316e9fc Compare August 24, 2023 10:56
@jnummelin jnummelin added this to the 1.28 milestone Aug 25, 2023
@jnummelin jnummelin force-pushed the feat/standalone-autopilot-updates branch from 316e9fc to 8624c3d Compare September 8, 2023 10:32
@jnummelin jnummelin marked this pull request as ready for review September 8, 2023 10:32
@jnummelin jnummelin requested a review from a team as a code owner September 8, 2023 10:32
@jnummelin jnummelin requested review from ncopa and kke September 8, 2023 10:32
@@ -25,6 +25,7 @@ require (
github.com/hashicorp/terraform-exec v0.18.1
github.com/imdario/mergo v0.3.16
github.com/k0sproject/dig v0.2.0
github.com/k0sproject/version v0.3.1-0.20220411075111-0270bb85e7f8
Copy link
Contributor

Choose a reason for hiding this comment

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

There's 0.4.1 which has version constraints like version.NewConstraint(">= v1.23.0+k0s.2").Check(k0sVersion)

limitations under the License.
*/

package context
Copy link
Contributor

Choose a reason for hiding this comment

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

This is going to be annoying because either this or stdlib context needs to be imported with a name. Maybe something like apcontext?

@jnummelin jnummelin force-pushed the feat/standalone-autopilot-updates branch 4 times, most recently from 032ce8a to c1093cf Compare September 18, 2023 08:37
This PR introduces a fully standalone logic in autopilot to follow different update channels.
The (upcoming) update server will host channels in this way:
latest: 1.28.0
stable/v1.27: 1.27.x (what ever is the latest in 1.27 series)
stable/v1.26: 1.26.x (what ever is the latest in 1.26 series)
unstable/v1.28: 1.28.0-beta.1 (what ever is the latest pre release in 1.28)

For each channel the update-server "protocol" is a simple yaml data:

```yaml
channel: latest
version: v5.6.7
downloadURLs:
  - arch: amd64
    os: linux
    k0s: http://localhost/dist/k0s
    k0sSha: deadbeef
    airgapBundle: https://url.to.airgap/k0s-images-amd64.tgz
    airgapSha: deadbeef
  - arch: arm64
    os: linux
    k0s: http://localhost/dist/k0s
  - arch: arm
    os: linux
    k0s: http://localhost/dist/k0s

```

Essentially this offers an easy way for users to either always follow the latest version or stay up-to-date with some specific minor version.

Each time k0s checks for possible updates it sends some general cluster details to the update server to allow the server also to make some decicions which update to push. Following data is sent in HTTP Headers:
```
K0S_StorageType: etcd/kine
K0S_ClusterID: uuid of kube-system NS
K0S_ControlPlaneNodesCount: 3
K0S_WorkerData: base64 encoded json of worker node arch, OS type, container runtime type
```

On top of the autopilot functionality there's a common component that will check if there's updates available and notifies cluster admin via Event. This checker does not perform any real updates, it's just a convenience way to inform admins there's new versions available. Neither does this component perform any checks if there is already a autopilot UpdateConfig in place.

Signed-off-by: Jussi Nummelin <jnummelin@mirantis.com>
@jnummelin jnummelin force-pushed the feat/standalone-autopilot-updates branch from c1093cf to a542a86 Compare September 21, 2023 10:55
@jnummelin jnummelin mentioned this pull request Sep 22, 2023
@jnummelin jnummelin merged commit c2495dd into k0sproject:main Sep 25, 2023
72 checks passed
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.

3 participants