kubernetes-sigs / kubespray

Deploy a Production Ready Kubernetes Cluster
Apache License 2.0
16.21k stars 6.49k forks source link

Fix using the default network manager in reset.yml #11678

Open KubeKyrie opened 3 weeks ago

KubeKyrie commented 3 weeks ago

What type of PR is this?

/kind bug

What this PR does / why we need it: Restart network using the active network management service. Not the one that are default for the OS.

Which issue(s) this PR fixes:

Fixes https://github.com/kubernetes-sigs/kubespray/issues/11579

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Fix using the default network manager in reset.yml
k8s-ci-robot commented 3 weeks ago

Hi @KubeKyrie. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
KubeKyrie commented 3 weeks ago

Test results:

TASK [reset : Restart active network services] *********************************************************************
task path: /kubespray/roles/reset/tasks/main.yml:432
changed: [controller-1] => (item={'changed': False, 'stdout': 'active', 'stderr': '', 'rc': 0, 'cmd': 'systemctl is-active systemd-networkd', 'start': '2024-11-01 11:55:06.687265', 'end': '2024-11-01 11:55:06.703373', 'delta': '0:00:00.016108', 'msg': '', 'invocation': {'module_args': {'_raw_params': 'systemctl is-active systemd-networkd', '_uses_shell': True, 'expand_argument_vars': True, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}, 'stdout_lines': ['active'], 'stderr_lines': [], 'failed': False, 'item': 'systemd-networkd', 'ansible_loop_var': 'item'}) => {
    "ansible_loop_var": "item",
    "changed": true,
    "invocation": {
        "module_args": {
            "daemon_reexec": false,
            "daemon_reload": false,
            "enabled": null,
            "force": null,
            "masked": null,
            "name": "systemd-networkd",
            "no_block": false,
            "scope": "system",
            "state": "restarted"
        }
    },
    "item": {
        "ansible_loop_var": "item",
        "changed": false,
        "cmd": "systemctl is-active systemd-networkd",
        "delta": "0:00:00.016108",
        "end": "2024-11-01 11:55:06.703373",
        "failed": false,
        "invocation": {
            "module_args": {
                "_raw_params": "systemctl is-active systemd-networkd",
                "_uses_shell": true,
                "argv": null,
                "chdir": null,
                "creates": null,
                "executable": null,
                "expand_argument_vars": true,
                "removes": null,
                "stdin": null,
                "stdin_add_newline": true,
                "strip_empty_ends": true
            }
        },
        "item": "systemd-networkd",
        "msg": "",
        "rc": 0,
        "start": "2024-11-01 11:55:06.687265",
        "stderr": "",
        "stderr_lines": [],
        "stdout": "active",
        "stdout_lines": [
            "active"
        ]
    },
root@controller-1:~# systemctl status systemd-networkd
● systemd-networkd.service - Network Service
     Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-11-01 11:55:08 CST; 27s ago
TriggeredBy: ● systemd-networkd.socket
       Docs: man:systemd-networkd.service(8)
   Main PID: 1552329 (systemd-network)
     Status: "Processing requests..."
      Tasks: 1 (limit: 9440)
     Memory: 2.1M
     CGroup: /system.slice/systemd-networkd.service
             └─1552329 /lib/systemd/systemd-networkd
tico88612 commented 3 weeks ago

@KubeKyrie Thanks for the PR, but pre-commit has some failed messages. Could you check for this?

tico88612 commented 3 weeks ago

/ok-to-test

KubeKyrie commented 3 weeks ago

@tico88612 Ok, Thanks.

yankay commented 2 weeks ago

Great Idea, Thanks @KubeKyrie /approve

k8s-ci-robot commented 2 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KubeKyrie, yankay

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/kubespray/blob/master/OWNERS)~~ [yankay] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment