示例#1
0
def test_upgrade_apply_user_lock(provision, platform, kubectl, skuba):
    """
    Starting from an outdated cluster, check what node upgrade apply reports.
    """

    # lock kured
    kubectl_cmd = (
        "-n kube-system annotate ds kured weave.works/kured-node-lock="
        "'{\"nodeID\":\"manual\"}'")
    kubectl.run_kubectl(kubectl_cmd)

    for role in ("master", "worker"):
        num_nodes = platform.get_num_nodes(role)
        for n in range(0, num_nodes):
            # disable skuba-update.timer
            platform.ssh_run(
                role, n, "sudo systemctl disable --now skuba-update.timer")
            assert node_is_ready(platform, kubectl, role, n)
            result = skuba.node_upgrade("apply", role, n)
            assert result.find("successfully upgraded") != -1
            assert node_is_upgraded(kubectl, platform, role, n)
            ssh_cmd = "sudo systemctl is-enabled skuba-update.timer || :"
            assert platform.ssh_run(role, n, ssh_cmd).find("disabled") != -1

    kubectl_cmd = (r"-n kube-system get ds/kured -o jsonpath="
                   r"'{.metadata.annotations.weave\.works/kured-node-lock}'")
    result = wait(kubectl.run_kubectl,
                  kubectl_cmd,
                  wait_backoff=30,
                  wait_retries=3,
                  wait_allow=(RuntimeError))
    assert result.find("manual") != -1
示例#2
0
def test_upgrade_apply_from_previous(deployment, platform, skuba, kubectl):
    """
    Starting from an outdated cluster, check what node upgrade apply reports.
    """

    for role in ("master", "worker"):
        num_nodes = platform.get_num_nodes(role)
        for n in range(0, num_nodes):
            assert node_is_ready(platform, kubectl, role, n)
            result = skuba.node_upgrade("apply", role, n)
            assert result.find("successfully upgraded") != -1
            assert node_is_upgraded(kubectl, platform, role, n)
示例#3
0
def test_upgrade_plan_from_previous_with_upgraded_control_plane(deployment, skuba, kubectl, platform):
    """
    Starting from an updated control plane, check what cluster/node plan report.
    """

    masters = platform.get_num_nodes("master")
    for n in range(0, masters):
        assert node_is_ready(platform, kubectl, "master", n)
        master = skuba.node_upgrade("apply", "master", n)
        assert master.find("successfully upgraded") != -1
        assert node_is_upgraded(kubectl, platform, "master", n)

    workers = platform.get_num_nodes("worker")
    for n in range(0, workers):
        worker = skuba.node_upgrade("plan", "worker", n)
        assert worker.find(
            "Current Kubernetes cluster version: {pv}".format(pv=PREVIOUS_VERSION))
        assert worker.find("Latest Kubernetes version: {cv}".format(
            cv=CURRENT_VERSION)) != -1
        assert worker.find(" - kubelet: {pv} -> {cv}".format(
            pv=PREVIOUS_VERSION, cv=CURRENT_VERSION)) != -1