Skip to content
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

fix(balancer) remove old host when deleting target #7045

Closed
wants to merge 2 commits into from

Conversation

GoneGo1ng
Copy link

When deleting target, the old host should be removed. Instead of forcibly recreating a balancer.

Fix #6983

When deleting target, the old host should be removed. Instead of forcibly recreating a balancer.

Fix Kong#6983
@CLAassistant
Copy link

CLAassistant commented Apr 15, 2021

CLA assistant check
All committers have signed the CLA.

When deleting target, the old host should be removed. Instead of forcibly recreating a balancer.

Fix Kong#6983
@GoneGo1ng
Copy link
Author

@fffonion please review this change.

@gszr gszr requested a review from locao April 16, 2021 16:50
@gszr
Copy link
Member

gszr commented May 28, 2021

As #6983 turned out to be a documentation issue, and is now closed, this seems unrelated. @GoneGo1ng, please add further info. Thanks!

@gszr gszr added the stale label May 28, 2021
@stale stale bot closed this Jun 4, 2021
@GoneGo1ng
Copy link
Author

@gszr Sorry, I replied too late.

This is my upstream details.

curl -X GET http://172.16.192.153:8001/upstreams/test | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   901  100   901    0     0   9963      0 --:--:-- --:--:-- --:--:--  9901
{
    "algorithm": "round-robin",
    "client_certificate": null,
    "created_at": 1624244553,
    "hash_fallback": "none",
    "hash_fallback_header": null,
    "hash_on": "none",
    "hash_on_cookie": null,
    "hash_on_cookie_path": "/",
    "hash_on_header": null,
    "healthchecks": {
        "active": {
            "concurrency": 10,
            "healthy": {
                "http_statuses": [
                    200,
                    302
                ],
                "interval": 5,
                "successes": 1
            },
            "http_path": "/hello",
            "https_sni": null,
            "https_verify_certificate": false,
            "timeout": 1,
            "type": "http",
            "unhealthy": {
                "http_failures": 1,
                "http_statuses": [
                    429,
                    404,
                    500,
                    501,
                    502,
                    503,
                    504,
                    505
                ],
                "interval": 5,
                "tcp_failures": 1,
                "timeouts": 1
            }
        },
        "passive": {
            "healthy": {
                "http_statuses": [
                    200,
                    201,
                    202,
                    203,
                    204,
                    205,
                    206,
                    207,
                    208,
                    226,
                    300,
                    301,
                    302,
                    303,
                    304,
                    305,
                    306,
                    307,
                    308
                ],
                "successes": 0
            },
            "type": "http",
            "unhealthy": {
                "http_failures": 0,
                "http_statuses": [
                    429,
                    500,
                    503
                ],
                "tcp_failures": 0,
                "timeouts": 0
            }
        },
        "threshold": 0
    },
    "host_header": null,
    "id": "ce249d0b-073f-4eef-a9f1-ccfbefee623a",
    "name": "test",
    "slots": 1000,
    "tags": null
}

Then, I updated "http_path".

curl -H "Content-Type:application/json" -X PATCH http://172.16.192.153:8001/upstreams/test -d \
> '{"healthchecks": {"active": {"http_path": "/ping"}},"name": "test"}' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   967  100   900  100    67  11048    822 --:--:-- --:--:-- --:--:-- 11111
{
    "algorithm": "round-robin",
    "client_certificate": null,
    "created_at": 1624244553,
    "hash_fallback": "none",
    "hash_fallback_header": null,
    "hash_on": "none",
    "hash_on_cookie": null,
    "hash_on_cookie_path": "/",
    "hash_on_header": null,
    "healthchecks": {
        "active": {
            "concurrency": 10,
            "healthy": {
                "http_statuses": [
                    200,
                    302
                ],
                "interval": 5,
                "successes": 1
            },
            "http_path": "/ping",
            "https_sni": null,
            "https_verify_certificate": false,
            "timeout": 1,
            "type": "http",
            "unhealthy": {
                "http_failures": 1,
                "http_statuses": [
                    429,
                    404,
                    500,
                    501,
                    502,
                    503,
                    504,
                    505
                ],
                "interval": 5,
                "tcp_failures": 1,
                "timeouts": 1
            }
        },
        "passive": {
            "healthy": {
                "http_statuses": [
                    200,
                    201,
                    202,
                    203,
                    204,
                    205,
                    206,
                    207,
                    208,
                    226,
                    300,
                    301,
                    302,
                    303,
                    304,
                    305,
                    306,
                    307,
                    308
                ],
                "successes": 0
            },
            "type": "http",
            "unhealthy": {
                "http_failures": 0,
                "http_statuses": [
                    429,
                    500,
                    503
                ],
                "tcp_failures": 0,
                "timeouts": 0
            }
        },
        "threshold": 0
    },
    "host_header": null,
    "id": "ce249d0b-073f-4eef-a9f1-ccfbefee623a",
    "name": "test",
    "slots": 1000,
    "tags": null
}

Something strange happened. When I update http_path, the old http_path is still being requested. So I created this PR to solve this issue.

[GIN] 2021/06/21 - 15:27:51 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:27:51 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:27:56 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:27:56 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:28:00 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:28:01 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:28:05 | 200 |            0s |  172.16.192.153 |GET      "/ping"
[GIN] 2021/06/21 - 15:28:05 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:28:05 | 200 |            0s |  172.16.192.153 |GET      "/ping"
[GIN] 2021/06/21 - 15:28:10 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:28:10 | 200 |            0s |  172.16.192.153 |GET      "/ping"
[GIN] 2021/06/21 - 15:28:15 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:28:15 | 200 |            0s |  172.16.192.153 |GET      "/ping"
[GIN] 2021/06/21 - 15:28:20 | 404 |            0s |  172.16.192.153 |GET      "/hello"
[GIN] 2021/06/21 - 15:28:20 | 200 |            0s |  172.16.192.153 |GET      "/ping"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Target has been Stopped but Kong still detects it is Healthy
4 participants