-
Notifications
You must be signed in to change notification settings - Fork 6.7k
fix: GatewayAPI installation, condition not satisfied when role called with delegate_to and run_once #12279
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
base: master
Are you sure you want to change the base?
Conversation
…d with delegate_to and run_once
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aviral-agarwal The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @aviral-agarwal. 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 Once the patch is verified, the new status will be reflected by the 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-sigs/prow repository. |
/ok-to-test |
@aviral-agarwal I can't reproduce the problem you described, can you provide the inventory and variables? |
Sure, only one variable relevant to GatewayAPI (not sure if any other is effecting this particular flow. The variables used in the tasks were properly picked up and use defaults) inventory.inijust removed ssh authentication related details but the order of the nodes remains the same
|
Providing the output as well for reference I added tasks to debug at the start and end of the role Debug Tasksat the beginning of
|
run_once + delegate_to will delegate to the mentioned host, actually. The problem, I think, is here:
Note that the first of those task is delegated, not the second. kubespray/roles/download/tasks/download_file.yml Lines 45 to 71 in b1fc870
(Yeah the download role is in dire need of a refactor) |
In role output of tasks (which have the
Correct me if I am wrong, but
Why is vm4-private (not the first control plane node) being selected? Maybe the delegation issue in the |
No, as explained, run_once + delegate_to run on the delegated host, once, (instead of one for each host in the play).
|
I agree, tasks will run once on delegate_to host and not for each host but tasks are not being executed because condition I debugged Please note the following distinction between
|
Run_once does not select necessarily the first host, it's random (or at least, undefined). But yes, you're correct IIRC than the variables are still those of the original host, in particular But I think the conflicting delegate_to (in the import in the gateway api role and directly in the download role imported file) are also problematic (Haven't tested though) |
Yeah, I do see the multiple delegation problem here If not, then we can
|
I'm facing this issue, the task is being delegated to my first worker node in the inventory [worker01]. Here you can see the file
|
What type of PR is this?
/kind bug
What this PR does / why we need it:
GatewayAPI is not installed even when
gateway_api_enabled
is set to trueFollowing is the Root Cause:
gateway_api_enabled
is set to true, GatewayAPI is installed using rolekubernetes-apps/gateway_api
delegate_to: "{{ groups['kube_control_plane'][0] }}"
i.e. first control plane noderun_once: true
i.e., selectfirst host available
out of the nodes mentioned inhosts
of the ansible task in which the role is called, and execute the role on that nodeInvoke kubeadm and install a CNI
, in which rolekubernetes-apps/gateway_api
is called, hashosts: k8s_cluster
(which has control plane+working nodes)run_once
,first host available
is selected (not necessarily the first control plane node) and the ansible variableinventory_hostname
is set to that node(In my case, it was the first worker node, though I did not explore in depth how exactly
k8s_cluster
is formed)gateway_api_enabled
is set to true as the tasks were skippedWhich issue(s) this PR fixes:
I did not open any issue for this, nor could I find any open ones
I saw comments to the same effect in PR #12189
Special notes for your reviewer:
delegate_to
: Host to execute task instead of the target (inventory_hostname). Connection vars from the delegated host will also be used for the task.run_once
: Boolean that will bypass the host loop, forcing the task to attempt to execute on the first host available and afterward apply any results and facts to all active hosts in the same batch.delegate_to
already ensures that the first control plane node executes the task, irrespective of where the role runs (selected byrun_once
, different from delegate_to, an Ansible nuance it seems)We do not need the
when
condition anywayDoes this PR introduce a user-facing change?: