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

[Bug]: kubesonic/test_k8s_join_disjoin.py failing with /bin/sh: 1: kubeadm: not found #16617

Open
arista-nwolfe opened this issue Jan 21, 2025 · 4 comments
Assignees
Labels

Comments

@arista-nwolfe
Copy link
Contributor

Issue Description

The test kubesonic/test_k8s_join_disjoin.py was added recently by #16364
This test requires the kubeadm package installed on the supervisor/LC but it doesn't appear to be present.

https://github.com/sonic-net/sonic-mgmt/blob/202405/tests/kubesonic/test_k8s_join_disjoin.py#L37

def check_dut_k8s_version_supported(duthost):
    logger.info("Check if the k8s version is supported")
    k8s_version = duthost.shell("kubeadm version -o short")["stdout"]
    if k8s_version != KUBERNETES_VERSION:
        log_msg = f"Need to update this kubesonic test plan, sonic k8s version is upgraded to {k8s_version}"
        pytest.skip(log_msg)
    logger.info(f"K8s version {k8s_version} is supported")
E           tests.common.errors.RunAnsibleModuleFail: run module shell failed, Ansible Results =>
E           failed = True
E           changed = True
E           rc = 127
E           cmd = kubeadm version -o short
E           start = 2025-01-19 09:49:08.180992
E           end = 2025-01-19 09:49:08.183862
E           delta = 0:00:00.002870
E           msg = non-zero return code
E           invocation = {'module_args': {'_raw_params': 'kubeadm version -o short', '_uses_shell': True, 'warn': False, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}
E           _ansible_no_log = None
E           stdout =
E           stderr =
E           /bin/sh: 1: kubeadm: not found

complex_args = {}
filename   = '/data/tests/common/devices/multi_asic.py'
function_name = '_run_on_asics'
index      = 0
line_number = 135
lines      = ['            return getattr(self.sonichost, self.multi_asic_attr)(*module_args, **complex_args)\n']
module_args = ['kubeadm version -o short']
module_async = False
module_ignore_errors = False
previous_frame = <frame at 0x7f6162b7f610, file '/data/tests/common/devices/multi_asic.py', line 135, code _run_on_asics>
res        = {'failed': True, 'changed': True, 'stdout': '', 'stderr': '/bin/sh: 1: kubeadm: not found', 'rc': 127, 'cmd': 'kubeadm...None, 'stdin': None}}, 'stdout_lines': [], 'stderr_lines': ['/bin/sh: 1: kubeadm: not found'], '_ansible_no_log': None}
self       = <SonicHost cmp227-4>
verbose    = True

Results you see

kubeadm isn't installed on our supervisor and LC

Results you expected to see

The test expects kubeadm to be installed on the supervisor/LC

Is it platform specific

generic

Relevant log output

Output of show version

Attach files (if any)

No response

@arlakshm
Copy link
Contributor

@lixiaoyuner, @bingwang-ms, do we have kubeadm present on all 202405 images?

@bingwang-ms
Copy link
Collaborator

@lixiaoyuner Can you please help check?

@lixiaoyuner
Copy link
Contributor

@arista-nwolfe , the k8s package is not installed in sonic images which built from public branches, need to skip this test case if the sonic image is based on public branches, I just skip public master branch in the conditional mark file(link). Which public branches of sonic image you are using? We may need to update the conditional mark file to filter all public branches.

@arista-nwolfe
Copy link
Contributor Author

arista-nwolfe commented Jan 23, 2025

@arista-nwolfe , the k8s package is not installed in sonic images which built from public branches, need to skip this test case if the sonic image is based on public branches, I just skip public master branch in the conditional mark file(link). Which public branches of sonic image you are using? We may need to update the conditional mark file to filter all public branches.

We are currently testing the 202405 branch. Looking through the other conditions in the yaml file I don't see anywhere they distinguish between public and internal images.
Is it possible to use the built_by variable indicated in the README.md:
"built_by": "AzDevOps@sonic-build-workers-000OU4",
Maybe something like built_by.split("@")[0] == AzDevOps?

Otherwise I've seen the check for public vs internal within the test code using get_image_type in #14888

    if get_image_type(duthost) == "public":
        pytest.skip("AZNG Migration is not supported on public image")

We could do something similar for the kubesonic test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

5 participants