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

Share Kubernetes Version Through Relation Data #164

Merged
merged 7 commits into from
Nov 13, 2024
Merged

Conversation

mateoflorido
Copy link
Member

Overview

Share the Kubernetes version through the Juju cluster relation databag.

Rationale

To add the refresh mechanism, we need a way to share the installed k8s bversion of our nodes via relation data. This will help the charm determine if the cluster is ready for an upgrade to a new version. Currently, the charm is blocked if there's a version mismatch within the cluster. In future PRs, we will add mechanisms to deliver these upgrades.

Testing

The databag shows how the version is shared by the charm units, with the leader announcing the Kubernetes version in the application databag.

k8s/1:
  workload-version: 1.31.2
  machine: "1"
  opened-ports:
  - 6443/tcp
  public-address: 10.65.65.158
  charm: local:k8s-0
  leader: true
  life: alive
  relation-info:
  - relation-id: 1
    endpoint: cluster
    related-endpoint: cluster
    application-data:
      k8s/0: joined-juju-055675-0
      k8s/1: joined-juju-055675-1
      version: 1.31.2
    local-unit:
      in-scope: true
      data:
        cluster-name: 201487f2-b9ad-4bc9-9942-48b44459db04
        egress-subnets: 10.65.65.158/32
        ingress-address: 10.65.65.158
        joined: 201487f2-b9ad-4bc9-9942-48b44459db04
        node-name: juju-055675-1
        private-address: 10.65.65.158
        version: 1.31.2
    related-units:
      k8s/0:
        in-scope: true
        data:
          egress-subnets: 10.65.65.15/32
          ingress-address: 10.65.65.15
          joined: 201487f2-b9ad-4bc9-9942-48b44459db04
          node-name: juju-055675-0
          private-address: 10.65.65.15
          version: 1.31.2
  - relation-id: 2
    endpoint: k8s-cluster
    related-endpoint: cluster
    application-data: {}
    related-units:
      k8s-worker/0:
        in-scope: true
        data:
          egress-subnets: 10.65.65.247/32
          ingress-address: 10.65.65.247
          joined: 201487f2-b9ad-4bc9-9942-48b44459db04
          node-name: juju-055675-2
          private-address: 10.65.65.247
          version: 1.31.2
      k8s-worker/1:
        in-scope: true
        data:
          egress-subnets: 10.65.65.62/32
          ingress-address: 10.65.65.62
          joined: 201487f2-b9ad-4bc9-9942-48b44459db04
          node-name: juju-055675-3
          private-address: 10.65.65.62
          version: 1.31.2

@mateoflorido mateoflorido requested a review from a team as a code owner November 12, 2024 21:56
Copy link
Contributor

@HomayoonAlimohammadi HomayoonAlimohammadi left a comment

Choose a reason for hiding this comment

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

Great work! Thanks a lot @mateoflorido! Overall LGTM, just some minor comments and questions. I also leave the approval to someone that actually knows something about k8s-operator :D

charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/charm.py Show resolved Hide resolved
charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/token_distributor.py Outdated Show resolved Hide resolved
@mateoflorido mateoflorido force-pushed the KU-2055/cluster-version branch from 022c11d to ce65a3f Compare November 13, 2024 14:11
Copy link
Contributor

@addyess addyess left a comment

Choose a reason for hiding this comment

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

Looks pretty straight forward here. I have a few questions naturally

charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/charm.py Outdated Show resolved Hide resolved
charms/worker/k8s/src/token_distributor.py Outdated Show resolved Hide resolved
@mateoflorido mateoflorido force-pushed the KU-2055/cluster-version branch from 7028e7c to 9d273a3 Compare November 13, 2024 18:00
Copy link
Contributor

@addyess addyess left a comment

Choose a reason for hiding this comment

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

LGTM. Its up to you to use ReconcilerError or leave the asserts. whatever you think is cleaner

This comment was marked as resolved.

@mateoflorido mateoflorido requested a review from addyess November 13, 2024 20:20
Copy link
Contributor

@addyess addyess left a comment

Choose a reason for hiding this comment

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

LGTM

@addyess addyess merged commit 4716542 into main Nov 13, 2024
50 checks passed
@addyess addyess deleted the KU-2055/cluster-version branch November 13, 2024 20:26
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.

4 participants