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

fix: skip multus when not defined #10934

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

darkobas2
Copy link
Contributor

@darkobas2 darkobas2 commented Feb 17, 2024

/kind bug

when multus is not installed/defined cluster playbook run would fail:

TASK [kubernetes-apps/network_plugin/multus : Multus | Start resources] 
fatal: [host -> {{ groups['kube_control_plane'][0] }}]: FAILED! => 
{"msg": "Error in jmespath.search in json_query filter plugin:
'ansible.vars.hostvars.HostVarsVars object' has no attribute 'multus_manifest_2'"}
Fix: skip multus when not defined

The default=[] part ensures that if multus_manifest_2 is not defined or doesn't have the 'results' attribute, it defaults to an empty list ([]).
This prevents potential errors that might occur if trying to access attributes on an undefined variable.

fix task failure:
TASK [kubernetes-apps/network_plugin/multus : Multus | Start resources] ************************************************
fatal: [hfal12k8n1 -> {{ groups['kube_control_plane'][0] }}]: FAILED! => {"msg": "Error in jmespath.search in json_query filter plugin:\n'ansible.vars.hostvars.HostVarsVars object' has no attribute 'multus_manifest_2'"}
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 17, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @darkobas2. 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. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 17, 2024
@yankay
Copy link
Member

yankay commented Feb 18, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 18, 2024
Copy link
Contributor

@mzaian mzaian left a comment

Choose a reason for hiding this comment

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

Hello @darkobas2

Thanks for your PR, could you please write a proper description to the PR. maybe use the default template.

@darkobas2
Copy link
Contributor Author

Hello @darkobas2

Thanks for your PR, could you please write a proper description to the PR. maybe use the default template.

Hi,
I have updated commit description. is it OK now ?

@blackliner
Copy link
Contributor

What is the workaround? I can't run kubespray anymore with v2.24.1

@nicolas-goudry
Copy link
Contributor

nicolas-goudry commented Mar 18, 2024

What is the workaround? I can't run kubespray anymore with v2.24.1

You could patch your local kubespray installation with this diff and command:

diff --git a/roles/kubernetes-apps/network_plugin/multus/tasks/main.yml b/roles/kubernetes-apps/network_plugin/multus/tasks/main.yml
index fdbede55a..54dd1ed61 100644
--- a/roles/kubernetes-apps/network_plugin/multus/tasks/main.yml
+++ b/roles/kubernetes-apps/network_plugin/multus/tasks/main.yml
@@ -9,7 +9,7 @@
     state: "latest"
   delegate_to: "{{ groups['kube_control_plane'][0] }}"
   run_once: true
-  with_items: "{{ multus_manifest_1.results + (multus_nodes_list | map('extract', hostvars, 'multus_manifest_2') | list | json_query('[].results')) }}"
+  with_items: "{{ (multus_manifest_1.results | default([])) + (multus_nodes_list | map('extract', hostvars, 'multus_manifest_2.results') | default([]) | list) }}"
   loop_control:
     label: "{{ item.item.name if item != None else 'skipped' }}"
   vars:
patch --strip 1 --forward --merge --directory "<local-kubespray-directory>" \
    --input "<path-to-patch-file>"

I’m currently using this patch in my kubespray installations and I can confirm everything is working fine now.

IMO this is needed and should be released as soon as possible since it’s failing installations with 2.24.x.

@bakito
Copy link
Contributor

bakito commented May 22, 2024

Is there any update on this? v2.25.0 is already out with this still not fixed.

@relip
Copy link

relip commented Jul 1, 2024

I'm also getting not item is skipped' failed. The error was: The 'skipped' test expects a dictionary error when limiting the nodes and I need to patch the fix every time I need to update my cluster. I hope this PR's going to be merged soon... @mzaian

Copy link
Contributor

@cyclinder cyclinder left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

/lgtm

/cc @yankay Could you approvel these changes? thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 1, 2024
@ant31
Copy link
Contributor

ant31 commented Aug 6, 2024

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ant31, cyclinder, darkobas2

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 6, 2024
@k8s-ci-robot k8s-ci-robot merged commit 1968db9 into kubernetes-sigs:master Aug 6, 2024
65 checks passed
@yankay yankay mentioned this pull request Aug 28, 2024
ThisIsQasim added a commit to ThisIsQasim/kubespray that referenced this pull request Sep 6, 2024
k8s-ci-robot pushed a commit that referenced this pull request Sep 9, 2024
* Update multus to v4.1.0 and clarify cilium compatibility

* Fix: bug introduced by #10934 where the template would break if multus was defined

* Set priorityClassName to system-node-critical for multus pods
unai-ttxu pushed a commit to Stratio/kubespray that referenced this pull request Sep 10, 2024
fix task failure:
TASK [kubernetes-apps/network_plugin/multus : Multus | Start resources] ************************************************
fatal: [hfal12k8n1 -> {{ groups['kube_control_plane'][0] }}]: FAILED! => {"msg": "Error in jmespath.search in json_query filter plugin:\n'ansible.vars.hostvars.HostVarsVars object' has no attribute 'multus_manifest_2'"}
kpoxo6op pushed a commit to kpoxo6op/kubespray that referenced this pull request Dec 27, 2024
fix task failure:
TASK [kubernetes-apps/network_plugin/multus : Multus | Start resources] ************************************************
fatal: [hfal12k8n1 -> {{ groups['kube_control_plane'][0] }}]: FAILED! => {"msg": "Error in jmespath.search in json_query filter plugin:\n'ansible.vars.hostvars.HostVarsVars object' has no attribute 'multus_manifest_2'"}
kpoxo6op pushed a commit to kpoxo6op/kubespray that referenced this pull request Dec 27, 2024
…sigs#11434)

* Update multus to v4.1.0 and clarify cilium compatibility

* Fix: bug introduced by kubernetes-sigs#10934 where the template would break if multus was defined

* Set priorityClassName to system-node-critical for multus pods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants