Charmed-Kubernetes/kubernetes-control-plane/hooks/relations/kube-masters/README.md

1.2 KiB

kube-masters interface

This interface provides communication amongst kubernetes-control-planes in a cluster.

States

  • kube-masters.connected

    Enabled when any kubernetes-master unit has joined the relation.

  • kube-masters.cohorts.ready

    Enabled when all peers have snap cohort data.

Methods and Properties

  • kube-masters.set_cohort_keys(cohort_keys)

    Set a dictionary of cohort keys created by the snap layer.

  • kube-masters.cohort_keys

    Dictionary of all cohort keys sent by peers.

Examples


@when('kube-masters.connected')
def agree_on_cohorts():
    kube_control_planes = endpoint_from_flag('kube-masters.connected')
    cohort_keys = create_cohorts_for_my_snaps()
    kube_control_planes.set_cohort_keys(cohort_keys)

@when('kube-masters.cohorts.ready',
      'kube-control.connected')
def send_cohorts_to_workers():
    kube_control_planes = endpoint_from_flag('kube-masters.cohorts.ready')
    cohort_keys = kube_control_planes.cohort_keys

    kube_control = endpoint_from_flag('kube-control.connected')
    # The following set method is defined in interface-kube-control
    kube_control.set_cohort_keys(cohort_keys)