Skip to content

[Issue-12242]-Verify whether main_access_ip is present inside the hostvars dictionary when using the --limit option #12248

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kartsank
Copy link
Contributor

@kartsank kartsank commented May 22, 2025

…ionary

What type of PR is this?
/kind bug

What this PR does / why we need it:
Verify whether main_access_ip is present inside the hostvars dictionary while creating host list from inventory

Which issue(s) this PR fixes:
Fixes #12242

Special notes for your reviewer:
NONE
Does this PR introduce a user-facing change?:
NONE

NONE

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 22, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kartsank
Once this PR has been reviewed and has the lgtm label, please assign vannten for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@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 May 22, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @kartsank. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 22, 2025
@ant31
Copy link
Contributor

ant31 commented May 23, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 23, 2025
@chadswen
Copy link
Member

/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 May 27, 2025
@VannTen
Copy link
Contributor

VannTen commented Jun 5, 2025

This is not the correct fix, this simply bypass the problem.
the variable should be defined, => this is why you need to run the facts playbook before scaling up.

@ant31
Copy link
Contributor

ant31 commented Jun 5, 2025

@VannTen Do you have it working with --limit ? I m not. so maybe there are some command / configuration with ansible ?

In all cases, it's the only blocking point for using --limit,
we should be allowed to scale-up without having to fact fetch 100s of nodes before.
It should only requires one control-plane, and the new nodes

@VannTen
Copy link
Contributor

VannTen commented Jun 5, 2025 via email

@kartsank
Copy link
Contributor Author

kartsank commented Jun 12, 2025

Don't disagree that we need to scrap the whole etc/hosts stuff if we can, but in that case there is no reason to patch it up, better to cleanly remove it than still doing it but with missing stuff. I haven't tested limit recently, it's the start of the busy period here.

Just back from vacation. Thanks for the comments.

This is not new fix I just add this if check from previous version of this file. see the file roles/kubernetes/preinstall/tasks/0090-etchosts.yml on line 6 on PR.

https://github.com/kubernetes-sigs/kubespray/pull/11953/files#diff-9c190d5e9ce1325bf9227a5326358978dce36b74bfc6baeda861eb2ccafe4239L6

{% if 'access_ip' in hostvars[item] or 'ip' in hostvars[item] or 'ansible_default_ipv4' in hostvars[item] -%} {%- if ('ansible_hostname' in hostvars[item] and item != hostvars[item]['ansible_hostname']) %} {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }} {{ hostvars[item]['ansible_hostname'] }} {% else %} {{ item }}.{{ dns_domain }} {{ item }} {% endif %}

Agree if we run facts.yml it will gather the vars or I can use skip tags ( --skip-tags=etchosts) to skip the etchosts update.

but if we are running ansible on docker container. I can't keep facts cache on my next execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. release-note-none Denotes a PR that doesn't merit a release note. 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.

Check if main_access_ip exists within the hostvars dictionary with --limit option.
5 participants