Use network fallback loop for pod IP lookup in swiftStorage#464
Conversation
Instead of using error handling for control flow when looking up pod IPs, iterate over preferred networks (storage, storagemgmt) and return an explicit error only when no network has an IP at all. Related: OSPRH-21545 Signed-off-by: Christian Schwede <cschwede@redhat.com>
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/41cf3d3bbd76489688ac95a3d8588ee4 ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 44m 13s |
| if err != nil { | ||
| previousErr := err | ||
| dnsIP, err = getPodIPInNetwork(swiftPod, instance.Namespace, "storage") | ||
| for _, network := range []string{"storage", "storagemgmt"} { |
There was a problem hiding this comment.
@cschwede quick question here: I see we invert storage and storagemgmt in the loop compared to the previous code. Is the expectations to normally see an IP address in the storage network and eventually fallback to storagemgt?
If so, it makes sense to me the break on L448 to avoid dnsIP being overwritten in case both storage and storagemgmt are passed.
There was a problem hiding this comment.
@fmount Yes, exactly. storage should be the default nowadays, storagemgmt is kept for backward compatibility.
|
recheck |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cschwede, fmount The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
8c382e6
into
openstack-k8s-operators:main
Instead of using error handling for control flow when looking up pod IPs, iterate over preferred networks (storage, storagemgmt) and return an explicit error only when no network has an IP at all.
Related: OSPRH-21545