-
Notifications
You must be signed in to change notification settings - Fork 138
⚠️ Improve priority and validation of input variables consumed in wait_for_interface_or_ip #788
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: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 @mchiappero. Thanks for your PR. I'm waiting for a github.com 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. |
85381e6 to
4b626bc
Compare
tuminoid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
/ok-to-test |
|
Also, isn't this the same as #787 ? |
The PRs are stacked, as far as I can see it's not possible to set a different branch, but I should have mentioned that in the description. Let me fix it... along with the proposed changes (thanks for reviewing!). |
Sure. But before squashing I'd like to make sure the change is fully understood, though. By the way, IRONIC_IP is not documented in https://github.com/metal3-io/ironic-image/blob/main/README.md, while it probably should. Also, which variables take precedence is also not documented either, nor logged by the scripts. I guess maybe something to discuss at the weekly meeting. Let me know what you think! |
The value of host_ip is determined twice within the ironic.conf.j2 template file, by means of a relatively hard to read set of conditions. Avoid this duplication and improve readability by exporting the correct value once in scripts/configure-ironic.sh. This also leave more room for more complex evaluations should these be needed in the future (e.g. IPv6) Signed-off-by: Marco Chiappero <[email protected]>
4b626bc to
b26391c
Compare
|
/hold |
Whether IRONIC_IP or PROVISIONIG_IP is provided to ironic-image, any such address should be checked for validity and, if needed, properly formatted. For this reason, this commit introduces parse_ip_address to be consumed inside wait_for_interface_or_ip. Signed-off-by: Marco Chiappero <[email protected]>
Add a new get_interface_of_ip function that returns the name of the interface of a given IP, and use it to determine if the PROVISIONING_IP address is actually present on a network interface. This improves the code readability and enables additional debugging output. Signed-off-by: Marco Chiappero <[email protected]>
Commit 2742439 added logic to tentatively identify the interface name in get_provisioning_interface if the PROVISIONING_IP is provided. However the same process in then repeated in wait_for_interface_or_ip. Signed-off-by: Marco Chiappero <[email protected]>
Introduce an explicit check for IRONIC_IP, allowing PROVISIONING_INTERFACE to be tested separately, to improve quality and readability. Moreover, whenever PROVISIONING_INTERFACE is not set by the user, function get_provisioning_interface attempts to determine one, or provide "provisioning" as default value. However this can cause confusing errors down the line. So, also remove this default value and fail gracefully, with proper logging, if the PROVISIONING_INTERFACE value is not detected. Signed-off-by: Marco Chiappero <[email protected]>
Up to now wait_for_interface_or_ip has parse the values in the following order: PROVISIONING_IP, IRONIC_IP, PROVISIONING_INTERFACE. However IRONIC_IP should likely be considered as overriding any PROVISIONING_* value. Thus, make sure IRONIC_IP is evaluated at the beginning of the chain. Signed-off-by: Marco Chiappero <[email protected]>
b26391c to
a3971ce
Compare
What this PR does / why we need it:
The current logic in wait_for_interface_or_ip deals with the input IP addresses or interfaces, according to the following order: PROVISIONING_IP, IRONIC_IP, PROVISIONING_INTERFACE. The improvements this PR introduces are:
What the PR does not address is logging a warning in case of multiple input variables set and one taking inevitably precedence over the another(s).
NOTE: based on PR #787
Checklist: