Skip to content

Add util function for getting IP address from gateway #821

@azgabur

Description

@azgabur

Currently this pattern is used for extracting loadbalancer IP address or hostname from a gateway gateway.external_ip().split(":")[0]

Two problems:

  1. the name external_ip is misleading as it can also be a hostname (on AWS clusters)
  2. If it would return an IPv6 IP address this split would not work see example IPv6 address: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 or with port [2001:db8:4006:812::200e]:8080 (I do not know how Openshift loadbalanced service handles IPv6 addresses if those are even used at all)

Its used currently in multiple places in mutlicluster tests:

./testsuite/tests/multicluster/coredns/two_clusters/test_delegate_false.py:102:        dns.resolver.resolve(hostname2.hostname)[0].address == gateway2.external_ip().split(":")[0]
./testsuite/tests/multicluster/coredns/two_clusters/test_delegate_false.py:105:        gateway2.external_ip().split(":")[0] not in dns_ips
./testsuite/tests/multicluster/load_balanced/test_change_default_geo.py:21:    assert resolver.resolve(hostname.hostname)[0].address == gateway.external_ip().split(":")[0]
./testsuite/tests/multicluster/load_balanced/test_change_default_geo.py:32:    assert resolver.resolve(hostname.hostname)[0].address == gateway2.external_ip().split(":")[0]
./testsuite/tests/multicluster/load_balanced/test_change_strategy.py:17:    assert resolver.resolve(hostname.hostname)[0].address == gateway.external_ip().split(":")[0]
./testsuite/tests/multicluster/load_balanced/test_change_strategy.py:20:    assert resolver.resolve(hostname.hostname)[0].address == gateway2.external_ip().split(":")[0]
./testsuite/tests/multicluster/load_balanced/test_change_strategy.py:35:    assert resolver.resolve(hostname.hostname)[0].address == gateway.external_ip().split(":")[0]
./testsuite/tests/multicluster/load_balanced/test_load_balanced_geo.py:21:    assert resolver.resolve(hostname.hostname)[0].address == gateway.external_ip().split(":")[0]
./testsuite/tests/multicluster/load_balanced/test_load_balanced_geo.py:24:    assert resolver.resolve(hostname.hostname)[0].address == gateway2.external_ip().split(":")[0]
./testsuite/tests/multicluster/load_balanced/test_load_balanced_geo.py:27:    assert resolver.resolve(hostname.hostname)[0].address == gateway.external_ip().split(":")[0]
./testsuite/tests/multicluster/test_simple_strategy.py:26:    gw1_ip, gw2_ip = gateway.external_ip().split(":")[0], gateway2.external_ip().split(":")[0]

To solve this

An util function should be implemented to do the extraction correctly and/or method for extracting IP address from gateway be re-done that will solve the problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to existing testgood first issueGood for newcomersrefactorRefactor with same functionality

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions