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

BUG/MINOR: prevents port conflicts on startup when using hostNetwork #568

Merged

Conversation

fabianonunes
Copy link
Contributor

@fabianonunes fabianonunes commented Sep 2, 2023

This PR fixes #566.

Creates new binds (instead of editing them) of the healthz and stats frontends to avoid port conflicts at the first start of the HAProxy when using hostNetwork: true.

Since these bind directives are not required, the first start of HAProxy is not affected.

The http and https frontends were already being created before this PR.

@fabianonunes fabianonunes force-pushed the avoid-port-conflicts-host-mode branch 3 times, most recently from a51e3c7 to 4c7efe3 Compare September 2, 2023 12:02
@ivanmatmati
Copy link
Collaborator

Hi @fabianonunes , I was able to make the controller start even with a 8080 already occupied just by simply removing the bindings from the two frontends. Can you elaborate on the further changes in your PR ? For example, why removing the peer ? Why replacing the edit function by their creation counterpart ? For semantic consistency ?

@fabianonunes
Copy link
Contributor Author

fabianonunes commented Sep 5, 2023

Hi, Ivan!

For example, why removing the peer ?

Well spotted. It seems that localpeer isn't activated during the initial HAProxy startup, so there's no need for concern. I'll remove these changes from PR.

We only need remove from the frontends. Since we can have other service listening to the ports 1042 (healthz) and 1024 (stats), these should be removed too from initial config.

We can change these ports with the CLI flags healthz-bind-port and stats-bind-port. However, it's worth noting that these flags take effect only after the first reload. During the initial startup, HAProxy listens on the ports specified in the haproxy.cfg template.

To reproduce this conflict, run a process on host listening on port 1042. Then, run haproxy-controller with the flag --healthz-bind-port=5000. You will get the following error:

[ALERT]    (310) : Binding [/etc/haproxy/haproxy.cfg:41] for frontend healthz: cannot bind socket (Address in use) for [127.0.0.1:1042]
[ALERT]    (310) : [/usr/local/sbin/haproxy.main()] Some protocols failed to start their listeners! Exiting.

@fabianonunes fabianonunes force-pushed the avoid-port-conflicts-host-mode branch from 4c7efe3 to fd4bd0f Compare September 5, 2023 16:14
@ivanmatmati
Copy link
Collaborator

Can you recheck your PR because it has a failed test:

2023/09/06 10:04:30 PANIC controller.go:197 31: Bind v4 already exists in frontend healthz
panic: 31: Bind v4 already exists in frontend healthz

@fabianonunes
Copy link
Contributor Author

fabianonunes commented Sep 6, 2023

@ivanmatmati, can you run the test again?

I couldn't reproduce this bug. On my fork, on the same commit, I've repeated the tests twice without errors.

I'm not an expert on GitHub CI, but is it possible that this issue could be related to caching?

The error message itself, Bind v4 already exists in frontend healthz, doesn't seem to make sense, as this PR removes the healthz intial bind.

@fabianonunes
Copy link
Contributor Author

fabianonunes commented Sep 6, 2023

I couldn't reproduce it locally either:

(these sections are collapsible. click on the title to expand)

$ deploy/tests/create.sh
Deleting cluster "dev" ...
Deleted nodes: ["dev-control-plane"]
Creating cluster "dev" ...
 ✓ Ensuring node image (kindest/node:v1.27.3) 🖼
 ✓ Preparing nodes 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
Set kubectl context to "kind-dev"
You can now use your cluster with:

kubectl cluster-info --context kind-dev

Thanks for using kind! 😊
building image for ingress controller
[+] Building 5.7s (17/17) FINISHED                                                                                           docker:default
 => [internal] load build definition from Dockerfile                                                                                   0.0s
 => => transferring dockerfile: 3.54kB                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                      0.0s
 => => transferring context: 83B                                                                                                       0.0s
 => [internal] load metadata for docker.io/haproxytech/haproxy-alpine:2.7                                                              5.6s
 => [internal] load metadata for docker.io/library/golang:1.20-alpine                                                                  5.6s
 => [stage-1 1/4] FROM docker.io/haproxytech/haproxy-alpine:2.7@sha256:8f7499b138c5de6dc6083b3acb05df1ec7642763417129665af2f88850735f  0.0s
 => [builder 1/7] FROM docker.io/library/golang:1.20-alpine@sha256:03278bc16e1a5b4fb6cdd3462108c060aa1e9c2353ce4d15d744b3c40168677d    0.0s
 => [internal] load build context                                                                                                      0.0s
 => => transferring context: 144.66kB                                                                                                  0.0s
 => CACHED [stage-1 2/4] COPY /fs /                                                                                                    0.0s
 => CACHED [stage-1 3/4] RUN apk --no-cache add socat openssl util-linux htop tzdata curl libcap &&     rm -f /usr/local/bin/dataplan  0.0s
 => CACHED [builder 2/7] RUN apk --no-cache add git openssh                                                                            0.0s
 => CACHED [builder 3/7] COPY /go.mod /src/go.mod                                                                                      0.0s
 => CACHED [builder 4/7] COPY /go.sum /src/go.sum                                                                                      0.0s
 => CACHED [builder 5/7] RUN cd /src && go mod download                                                                                0.0s
 => CACHED [builder 6/7] COPY / /src                                                                                                   0.0s
 => CACHED [builder 7/7] RUN mkdir -p /var/run/vars &&     cd /src &&     git config --get remote.origin.url > /var/run/vars/GIT_REPO  0.0s
 => CACHED [stage-1 4/4] COPY --from=builder /src/fs/haproxy-ingress-controller .                                                      0.0s
 => exporting to image                                                                                                                 0.0s
 => => exporting layers                                                                                                                0.0s
 => => writing image sha256:6ad97e7cd227069284dfd54906e2c97b8bed5fd8cccecdaf40b69b6aef932976                                           0.0s
 => => naming to docker.io/haproxytech/kubernetes-ingress                                                                              0.0s
loading image of ingress controller in kind
Image: "haproxytech/kubernetes-ingress:latest" with ID "sha256:6ad97e7cd227069284dfd54906e2c97b8bed5fd8cccecdaf40b69b6aef932976" not yet present on node "dev-control-plane", loading...
================================================================================
[+] Building 0.7s (16/16) FINISHED                                                                                           docker:default
 => [internal] load .dockerignore                                                                                                      0.0s
 => => transferring context: 2B                                                                                                        0.0s
 => [internal] load build definition from Dockerfile                                                                                   0.0s
 => => transferring dockerfile: 338B                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/alpine:3                                                                            0.6s
 => [internal] load metadata for docker.io/library/golang:1.17-alpine                                                                  0.4s
 => [builder 1/4] FROM docker.io/library/golang:1.17-alpine@sha256:99ddec1bbfd6d6bca3f9804c02363daee8c8524dae50df7942e8e60788fd17c9    0.0s
 => [stage-1 1/6] FROM docker.io/library/alpine:3@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a              0.0s
 => [internal] load build context                                                                                                      0.0s
 => => transferring context: 121B                                                                                                      0.0s
 => CACHED [stage-1 2/6] RUN apk --no-cache add openssl                                                                                0.0s
 => CACHED [stage-1 3/6] WORKDIR /app                                                                                                  0.0s
 => CACHED [builder 2/4] COPY *.go /src/                                                                                               0.0s
 => CACHED [builder 3/4] COPY go.mod /src/go.mod                                                                                       0.0s
 => CACHED [builder 4/4] RUN cd /src && go build -o echo-http                                                                          0.0s
 => CACHED [stage-1 4/6] COPY --from=builder /src/echo-http .                                                                          0.0s
 => CACHED [stage-1 5/6] COPY generate-cert.sh .                                                                                       0.0s
 => CACHED [stage-1 6/6] RUN chmod +x generate-cert.sh                                                                                 0.0s
 => exporting to image                                                                                                                 0.0s
 => => exporting layers                                                                                                                0.0s
 => => writing image sha256:e88e09a940a39d0762c55b4a26eea77429ae4b0c010024d8060cb4642c499562                                           0.0s
 => => naming to docker.io/haproxytech/http-echo                                                                                       0.0s
loading image http-echo in kind
Image: "haproxytech/http-echo:latest" with ID "sha256:e88e09a940a39d0762c55b4a26eea77429ae4b0c010024d8060cb4642c499562" not yet present on node "dev-control-plane", loading...
================================================================================
Install custom resource definitions ...
customresourcedefinition.apiextensions.k8s.io/backends.core.haproxy.org created
customresourcedefinition.apiextensions.k8s.io/defaults.core.haproxy.org created
customresourcedefinition.apiextensions.k8s.io/globals.core.haproxy.org created
================================================================================
deploying Ingress Controller ...
namespace/haproxy-controller created
serviceaccount/haproxy-kubernetes-ingress created
clusterrole.rbac.authorization.k8s.io/haproxy-kubernetes-ingress created
clusterrolebinding.rbac.authorization.k8s.io/haproxy-kubernetes-ingress created
configmap/haproxy-kubernetes-ingress created
deployment.apps/haproxy-kubernetes-ingress created
service/haproxy-kubernetes-ingress created
deployment.apps/http-echo created
service/http-echo created
ingress.networking.k8s.io/http-echo created
================================================================================
wait --for=condition=ready ...
No resources found in haproxy-controller namespace.
No resources found in haproxy-controller namespace.
haproxy-controller/haproxy-kubernetes-ingress Pending 0s
haproxy-controller/haproxy-kubernetes-ingress ContainerCreating 2s
haproxy-controller/haproxy-kubernetes-ingress Running 4s
pod/haproxy-kubernetes-ingress-7585c8dfc7-gddw7 condition met

$ go clean -testcache
# empty output
$ go test ./... -v --tags=e2e_parallel --tags=e2e_https
?   	github.com/haproxytech/kubernetes-ingress	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/api/core/v1alpha1	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/converters	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/fake	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/scheme	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/typed/core/v1alpha1	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/api/core/v1alpha2	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/typed/core/v1alpha1/fake	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/typed/core/v1alpha2	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/typed/core/v1alpha2/fake	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/converters	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions/core	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions/core/v1alpha1	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions/core/v1alpha2	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions/internalinterfaces	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/listers/core/v1alpha1	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/listers/core/v1alpha2	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations/common	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations/ingress	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations/service	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/controller	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/gateways	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/handler	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/api	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/certs	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/env	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/maps	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/process	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/ingress	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/k8s	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/route	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/service	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/status	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations/global	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/utils	[no test files]
=== RUN   TestHTTPSSuite
=== RUN   TestHTTPSSuite/Test_HTTPS_Offload
=== RUN   TestHTTPSSuite/Test_HTTPS_Passthrough
=== RUN   TestHTTPSSuite/Test_HTTPS_Passthrough/Reach_Backend
=== RUN   TestHTTPSSuite/Test_HTTPS_Passthrough/Ingress_annotations
=== RUN   TestHTTPSSuite/Test_HTTPS_Redirect
=== RUN   TestHTTPSSuite/Test_HTTPS_Redirect/implicit_via_TLS
=== RUN   TestHTTPSSuite/Test_HTTPS_Redirect/custom_code
=== RUN   TestHTTPSSuite/Test_HTTPS_Redirect/disabled
--- PASS: TestHTTPSSuite (31.34s)
    --- PASS: TestHTTPSSuite/Test_HTTPS_Offload (2.10s)
    --- PASS: TestHTTPSSuite/Test_HTTPS_Passthrough (8.50s)
        --- PASS: TestHTTPSSuite/Test_HTTPS_Passthrough/Reach_Backend (2.31s)
        --- PASS: TestHTTPSSuite/Test_HTTPS_Passthrough/Ingress_annotations (6.10s)
    --- PASS: TestHTTPSSuite/Test_HTTPS_Redirect (10.37s)
        --- PASS: TestHTTPSSuite/Test_HTTPS_Redirect/implicit_via_TLS (4.09s)
        --- PASS: TestHTTPSSuite/Test_HTTPS_Redirect/custom_code (2.10s)
        --- PASS: TestHTTPSSuite/Test_HTTPS_Redirect/disabled (2.09s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e/https	31.351s
=== RUN   TestCustomResource
=== RUN   TestCustomResource/TestGlobalCR
    suite_test.go:55: temporary configuration dir /tmp/ut-TestGlobalCR-3675306529
2023/09/06 14:23:28 ERROR   builder.go:167 incorrect podName format: ''
=== RUN   TestCustomResource/TestGlobalCR/Adding_a_global_CR_creates_global_and_logTargets_objects
=== RUN   TestCustomResource/TestGlobalCR/Deleting_a_global_CR_removes_global_and_logTargets_objects
--- PASS: TestCustomResource (0.01s)
    --- PASS: TestCustomResource/TestGlobalCR (0.01s)
        --- PASS: TestCustomResource/TestGlobalCR/Adding_a_global_CR_creates_global_and_logTargets_objects (0.00s)
        --- PASS: TestCustomResource/TestGlobalCR/Deleting_a_global_CR_removes_global_and_logTargets_objects (0.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/integration/customresources	0.018s
=== RUN   TestUseBackend
=== RUN   TestUseBackend/TestUseBackend
    suite_test.go:62: temporary configuration dir /tmp/tnr-TestUseBackend-81539719
2023/09/06 14:23:28 ERROR   builder.go:167 incorrect podName format: ''
=== RUN   TestUseBackend/TestUseBackend/Modifying_service_annotations_should_not_duplicate_use_backend_clause
--- PASS: TestUseBackend (0.03s)
    --- PASS: TestUseBackend/TestUseBackend (0.03s)
        --- PASS: TestUseBackend/TestUseBackend/Modifying_service_annotations_should_not_duplicate_use_backend_clause (0.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/tnr/routeacl	0.046s
=== RUN   TestGatewayClassEquality
--- PASS: TestGatewayClassEquality (0.00s)
=== RUN   TestRouteNamespacesEquality
--- PASS: TestRouteNamespacesEquality (0.00s)
=== RUN   TestAllowedRoutesEquality
--- PASS: TestAllowedRoutesEquality (0.00s)
=== RUN   TestListenerEquality
--- PASS: TestListenerEquality (0.00s)
=== RUN   TestGatewayEquality
--- PASS: TestGatewayEquality (0.00s)
=== RUN   TestBackendRefEquality
--- PASS: TestBackendRefEquality (0.00s)
=== RUN   TestTCPRouteEquality
--- PASS: TestTCPRouteEquality (0.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/pkg/store	0.005s
=== RUN   Test_DisableConfigSnippets
=== RUN   Test_DisableConfigSnippets/No_meaningful_value
2023/09/06 14:23:28 ERROR   annotations/cfgSnippet.go:105 wrong config snippet type 'invalid' in disable-config-snippets arg in command line
=== RUN   Test_DisableConfigSnippets/all
=== RUN   Test_DisableConfigSnippets/frontend_only
=== RUN   Test_DisableConfigSnippets/backend_only
=== RUN   Test_DisableConfigSnippets/global_only
=== RUN   Test_DisableConfigSnippets/frontend_and_backend
=== RUN   Test_DisableConfigSnippets/frontend_and_global,_whitespaces
=== RUN   Test_DisableConfigSnippets/frontend_global,_backend
--- PASS: Test_DisableConfigSnippets (0.00s)
    --- PASS: Test_DisableConfigSnippets/No_meaningful_value (0.00s)
    --- PASS: Test_DisableConfigSnippets/all (0.00s)
    --- PASS: Test_DisableConfigSnippets/frontend_only (0.00s)
    --- PASS: Test_DisableConfigSnippets/backend_only (0.00s)
    --- PASS: Test_DisableConfigSnippets/global_only (0.00s)
    --- PASS: Test_DisableConfigSnippets/frontend_and_backend (0.00s)
    --- PASS: Test_DisableConfigSnippets/frontend_and_global,_whitespaces (0.00s)
    --- PASS: Test_DisableConfigSnippets/frontend_global,_backend (0.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/test/annotations	0.005s
$ echo $?
0
$ go test ./... -v -p 1 --tags=e2e_sequential
?   	github.com/haproxytech/kubernetes-ingress	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/api/core/v1alpha1	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/api/core/v1alpha2	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/converters	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/fake	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/scheme	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/typed/core/v1alpha1	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/typed/core/v1alpha1/fake	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/typed/core/v1alpha2	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/clientset/versioned/typed/core/v1alpha2/fake	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/converters	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions/core	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions/core/v1alpha1	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions/core/v1alpha2	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/informers/externalversions/internalinterfaces	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/listers/core/v1alpha1	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/crs/generated/listers/core/v1alpha2	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e	[no test files]
=== RUN   TestAccessControlSuite
=== RUN   TestAccessControlSuite/Test_Blacklist
=== RUN   TestAccessControlSuite/Test_Blacklist/Inline
=== RUN   TestAccessControlSuite/Test_Blacklist/Inline_deprecated_annotation_name
=== RUN   TestAccessControlSuite/Test_Blacklist/Inline:_when_new_and_deprecated_annotation_names_are_defined_then_only_new_name_is_considered
=== RUN   TestAccessControlSuite/Test_Blacklist/Patternfile
=== RUN   TestAccessControlSuite/Test_Blacklist/Patternfile_deprecated_annotation_name
=== RUN   TestAccessControlSuite/Test_Blacklist/Patternfile:_when_new_and_deprecated_annotation_names_are_defined_then_only_new_name_is_considered
=== RUN   TestAccessControlSuite/Test_Whitelist
=== RUN   TestAccessControlSuite/Test_Whitelist/Inline
=== RUN   TestAccessControlSuite/Test_Whitelist/Inline_deprecated_annotation_name
=== RUN   TestAccessControlSuite/Test_Whitelist/Inline:_when_new_and_deprecated_annotation_names_are_defined_then_only_new_name_is_considered
=== RUN   TestAccessControlSuite/Test_Whitelist/Patternfile
=== RUN   TestAccessControlSuite/Test_Whitelist/Patternfile_deprecated_annotation_name
=== RUN   TestAccessControlSuite/Test_Whitelist/Patternfile:_when_new_and_deprecated_annotation_names_are_defined_then_only_new_name_is_considered
--- PASS: TestAccessControlSuite (60.12s)
    --- PASS: TestAccessControlSuite/Test_Blacklist (24.86s)
        --- PASS: TestAccessControlSuite/Test_Blacklist/Inline (4.11s)
        --- PASS: TestAccessControlSuite/Test_Blacklist/Inline_deprecated_annotation_name (4.10s)
        --- PASS: TestAccessControlSuite/Test_Blacklist/Inline:_when_new_and_deprecated_annotation_names_are_defined_then_only_new_name_is_considered (4.09s)
        --- PASS: TestAccessControlSuite/Test_Blacklist/Patternfile (4.18s)
        --- PASS: TestAccessControlSuite/Test_Blacklist/Patternfile_deprecated_annotation_name (4.18s)
        --- PASS: TestAccessControlSuite/Test_Blacklist/Patternfile:_when_new_and_deprecated_annotation_names_are_defined_then_only_new_name_is_considered (4.19s)
    --- PASS: TestAccessControlSuite/Test_Whitelist (24.85s)
        --- PASS: TestAccessControlSuite/Test_Whitelist/Inline (4.10s)
        --- PASS: TestAccessControlSuite/Test_Whitelist/Inline_deprecated_annotation_name (4.10s)
        --- PASS: TestAccessControlSuite/Test_Whitelist/Inline:_when_new_and_deprecated_annotation_names_are_defined_then_only_new_name_is_considered (4.10s)
        --- PASS: TestAccessControlSuite/Test_Whitelist/Patternfile (4.18s)
        --- PASS: TestAccessControlSuite/Test_Whitelist/Patternfile_deprecated_annotation_name (4.19s)
        --- PASS: TestAccessControlSuite/Test_Whitelist/Patternfile:_when_new_and_deprecated_annotation_names_are_defined_then_only_new_name_is_considered (4.19s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e/access-control	60.126s
=== RUN   TestCorsSuite
=== RUN   TestCorsSuite/Test_Configmap_Alone
=== RUN   TestCorsSuite/Test_Configmap_Alone/Default
=== RUN   TestCorsSuite/Test_Configmap_Alone/CorsOriginAlone
=== RUN   TestCorsSuite/Test_Configmap_Alone/CorsMethodsAlone
=== RUN   TestCorsSuite/Test_Configmap_Alone/CorsMethodsHeadersAlone
=== RUN   TestCorsSuite/Test_Configmap_Alone/CorsMethodsAgeAlone
=== RUN   TestCorsSuite/Test_Configmap_Alone/CorsMethodsCredentialAlone
=== RUN   TestCorsSuite/Test_Configmap_Alone/CorsDisable
=== RUN   TestCorsSuite/Test_Configmap_Alone/CorsMethodsCredentialDisable
=== RUN   TestCorsSuite/Test_Ingress_Alone
=== RUN   TestCorsSuite/Test_Ingress_Alone/Default
=== RUN   TestCorsSuite/Test_Ingress_Alone/CorsOriginAlone
=== RUN   TestCorsSuite/Test_Ingress_Alone/CorsMethodsAlone
=== RUN   TestCorsSuite/Test_Ingress_Alone/CorsMethodsHeadersAlone
=== RUN   TestCorsSuite/Test_Ingress_Alone/CorsMethodsAgeAlone
=== RUN   TestCorsSuite/Test_Ingress_Alone/CorsMethodsCredentialAlone
=== RUN   TestCorsSuite/Test_Ingress_Alone/CorsDisable
=== RUN   TestCorsSuite/Test_Ingress_Alone/CorsMethodsCredentialDisable
--- PASS: TestCorsSuite (46.12s)
    --- PASS: TestCorsSuite/Test_Configmap_Alone (18.81s)
        --- PASS: TestCorsSuite/Test_Configmap_Alone/Default (4.09s)
        --- PASS: TestCorsSuite/Test_Configmap_Alone/CorsOriginAlone (2.09s)
        --- PASS: TestCorsSuite/Test_Configmap_Alone/CorsMethodsAlone (2.09s)
        --- PASS: TestCorsSuite/Test_Configmap_Alone/CorsMethodsHeadersAlone (2.09s)
        --- PASS: TestCorsSuite/Test_Configmap_Alone/CorsMethodsAgeAlone (2.09s)
        --- PASS: TestCorsSuite/Test_Configmap_Alone/CorsMethodsCredentialAlone (2.09s)
        --- PASS: TestCorsSuite/Test_Configmap_Alone/CorsDisable (2.09s)
        --- PASS: TestCorsSuite/Test_Configmap_Alone/CorsMethodsCredentialDisable (2.09s)
    --- PASS: TestCorsSuite/Test_Ingress_Alone (16.77s)
        --- PASS: TestCorsSuite/Test_Ingress_Alone/Default (2.10s)
        --- PASS: TestCorsSuite/Test_Ingress_Alone/CorsOriginAlone (2.09s)
        --- PASS: TestCorsSuite/Test_Ingress_Alone/CorsMethodsAlone (2.09s)
        --- PASS: TestCorsSuite/Test_Ingress_Alone/CorsMethodsHeadersAlone (2.09s)
        --- PASS: TestCorsSuite/Test_Ingress_Alone/CorsMethodsAgeAlone (2.10s)
        --- PASS: TestCorsSuite/Test_Ingress_Alone/CorsMethodsCredentialAlone (2.10s)
        --- PASS: TestCorsSuite/Test_Ingress_Alone/CorsDisable (2.09s)
        --- PASS: TestCorsSuite/Test_Ingress_Alone/CorsMethodsCredentialDisable (2.10s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e/cors	46.128s
=== RUN   TestEndpointsSuite
=== RUN   TestEndpointsSuite/Test_HTTP_Reach
=== RUN   TestEndpointsSuite/Test_HTTP_Reach/4-replicas
=== RUN   TestEndpointsSuite/Test_HTTP_Reach/8-replicas
=== RUN   TestEndpointsSuite/Test_HTTP_Reach/2-replicas
=== RUN   TestEndpointsSuite/Test_HTTP_Reach/0-replicas
=== RUN   TestEndpointsSuite/Test_HTTP_Reach/3-replicas
=== RUN   TestEndpointsSuite/Test_Non_Ready_Endpoints
=== RUN   TestEndpointsSuite/Test_TCP_Reach
--- PASS: TestEndpointsSuite (43.40s)
    --- PASS: TestEndpointsSuite/Test_HTTP_Reach (26.61s)
        --- PASS: TestEndpointsSuite/Test_HTTP_Reach/4-replicas (6.10s)
        --- PASS: TestEndpointsSuite/Test_HTTP_Reach/8-replicas (6.10s)
        --- PASS: TestEndpointsSuite/Test_HTTP_Reach/2-replicas (6.10s)
        --- PASS: TestEndpointsSuite/Test_HTTP_Reach/0-replicas (2.10s)
        --- PASS: TestEndpointsSuite/Test_HTTP_Reach/3-replicas (2.10s)
    --- PASS: TestEndpointsSuite/Test_Non_Ready_Endpoints (4.21s)
    --- PASS: TestEndpointsSuite/Test_TCP_Reach (2.19s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e/endpoints	43.405s
=== RUN   TestGlobalConfigSuite
=== RUN   TestGlobalConfigSuite/TestMaxconn
=== RUN   TestGlobalConfigSuite/Test_Proxy_Protocol
=== RUN   TestGlobalConfigSuite/Test_Proxy_Protocol/Source_IP_OK
=== RUN   TestGlobalConfigSuite/Test_Proxy_Protocol/Source_IP_KO
    proxy_protocol.go:46: Result: HTTP/1.1 400 Bad request
        Content-length: 90
        Cache-Control: no-cache
        Connection: close
        Content-Type: text/html
        
        <html><body><h1>400 Bad request</h1>
        Your browser sent an invalid request.
        </body></html>
--- PASS: TestGlobalConfigSuite (13.62s)
    --- PASS: TestGlobalConfigSuite/TestMaxconn (4.18s)
    --- PASS: TestGlobalConfigSuite/Test_Proxy_Protocol (4.27s)
        --- PASS: TestGlobalConfigSuite/Test_Proxy_Protocol/Source_IP_OK (2.09s)
        --- PASS: TestGlobalConfigSuite/Test_Proxy_Protocol/Source_IP_KO (2.09s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e/global-config	13.628s
=== RUN   TestMapUpdateSuite
=== RUN   TestMapUpdateSuite/Test_Update
=== RUN   TestMapUpdateSuite/Test_Update/Update
    update_test.go:39: 701
--- PASS: TestMapUpdateSuite (16.57s)
    --- PASS: TestMapUpdateSuite/Test_Update (2.12s)
        --- PASS: TestMapUpdateSuite/Test_Update/Update (2.12s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e/map-updates	16.572s
=== RUN   TestTLSAuthSuite
=== RUN   TestTLSAuthSuite/Test_Client_TLS_Auth
=== RUN   TestTLSAuthSuite/Test_Client_TLS_Auth/no_client_cert
    client_auth.go:31: Get "https://e2e-tests-tls-auth.test": remote error: tls: certificate required
=== RUN   TestTLSAuthSuite/Test_Client_TLS_Auth/correct_client_cert
=== RUN   TestTLSAuthSuite/Test_Client_TLS_Auth/wrong_client_cert
--- PASS: TestTLSAuthSuite (13.55s)
    --- PASS: TestTLSAuthSuite/Test_Client_TLS_Auth (6.01s)
        --- PASS: TestTLSAuthSuite/Test_Client_TLS_Auth/no_client_cert (2.00s)
        --- PASS: TestTLSAuthSuite/Test_Client_TLS_Auth/correct_client_cert (2.01s)
        --- PASS: TestTLSAuthSuite/Test_Client_TLS_Auth/wrong_client_cert (2.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/e2e/tls-auth	13.560s
=== RUN   TestCustomResource
=== RUN   TestCustomResource/TestGlobalCR
    suite_test.go:55: temporary configuration dir /tmp/ut-TestGlobalCR-3675306529
2023/09/06 14:23:28 ERROR   builder.go:167 incorrect podName format: ''
=== RUN   TestCustomResource/TestGlobalCR/Adding_a_global_CR_creates_global_and_logTargets_objects
=== RUN   TestCustomResource/TestGlobalCR/Deleting_a_global_CR_removes_global_and_logTargets_objects
--- PASS: TestCustomResource (0.01s)
    --- PASS: TestCustomResource/TestGlobalCR (0.01s)
        --- PASS: TestCustomResource/TestGlobalCR/Adding_a_global_CR_creates_global_and_logTargets_objects (0.00s)
        --- PASS: TestCustomResource/TestGlobalCR/Deleting_a_global_CR_removes_global_and_logTargets_objects (0.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/integration/customresources	(cached)
=== RUN   TestUseBackend
=== RUN   TestUseBackend/TestUseBackend
    suite_test.go:62: temporary configuration dir /tmp/tnr-TestUseBackend-81539719
2023/09/06 14:23:28 ERROR   builder.go:167 incorrect podName format: ''
=== RUN   TestUseBackend/TestUseBackend/Modifying_service_annotations_should_not_duplicate_use_backend_clause
--- PASS: TestUseBackend (0.03s)
    --- PASS: TestUseBackend/TestUseBackend (0.03s)
        --- PASS: TestUseBackend/TestUseBackend/Modifying_service_annotations_should_not_duplicate_use_backend_clause (0.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/deploy/tests/tnr/routeacl	(cached)
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations/common	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations/global	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations/ingress	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/annotations/service	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/controller	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/gateways	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/handler	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/api	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/certs	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/env	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/maps	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/process	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/haproxy/rules	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/ingress	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/k8s	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/route	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/service	[no test files]
?   	github.com/haproxytech/kubernetes-ingress/pkg/status	[no test files]
=== RUN   TestGatewayClassEquality
--- PASS: TestGatewayClassEquality (0.00s)
=== RUN   TestRouteNamespacesEquality
--- PASS: TestRouteNamespacesEquality (0.00s)
=== RUN   TestAllowedRoutesEquality
--- PASS: TestAllowedRoutesEquality (0.00s)
=== RUN   TestListenerEquality
--- PASS: TestListenerEquality (0.00s)
=== RUN   TestGatewayEquality
--- PASS: TestGatewayEquality (0.00s)
=== RUN   TestBackendRefEquality
--- PASS: TestBackendRefEquality (0.00s)
=== RUN   TestTCPRouteEquality
--- PASS: TestTCPRouteEquality (0.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/pkg/store	(cached)
?   	github.com/haproxytech/kubernetes-ingress/pkg/utils	[no test files]
=== RUN   Test_DisableConfigSnippets
=== RUN   Test_DisableConfigSnippets/No_meaningful_value
2023/09/06 14:23:28 ERROR   annotations/cfgSnippet.go:105 wrong config snippet type 'invalid' in disable-config-snippets arg in command line
=== RUN   Test_DisableConfigSnippets/all
=== RUN   Test_DisableConfigSnippets/frontend_only
=== RUN   Test_DisableConfigSnippets/backend_only
=== RUN   Test_DisableConfigSnippets/global_only
=== RUN   Test_DisableConfigSnippets/frontend_and_backend
=== RUN   Test_DisableConfigSnippets/frontend_and_global,_whitespaces
=== RUN   Test_DisableConfigSnippets/frontend_global,_backend
--- PASS: Test_DisableConfigSnippets (0.00s)
    --- PASS: Test_DisableConfigSnippets/No_meaningful_value (0.00s)
    --- PASS: Test_DisableConfigSnippets/all (0.00s)
    --- PASS: Test_DisableConfigSnippets/frontend_only (0.00s)
    --- PASS: Test_DisableConfigSnippets/backend_only (0.00s)
    --- PASS: Test_DisableConfigSnippets/global_only (0.00s)
    --- PASS: Test_DisableConfigSnippets/frontend_and_backend (0.00s)
    --- PASS: Test_DisableConfigSnippets/frontend_and_global,_whitespaces (0.00s)
    --- PASS: Test_DisableConfigSnippets/frontend_global,_backend (0.00s)
PASS
ok  	github.com/haproxytech/kubernetes-ingress/test/annotations	(cached)

$ echo $?
0

@fabianonunes fabianonunes force-pushed the avoid-port-conflicts-host-mode branch 2 times, most recently from 306c496 to de65bf9 Compare September 7, 2023 20:53
@fabianonunes
Copy link
Contributor Author

fabianonunes commented Sep 7, 2023

Hi, @ivanmatmati.

I've identified the error. Between my fork and my PR, a commit 247199b added a new haproxyConfig in base-suite.go for use in other tests.

This explains why my fork was passing while it's failing here.

Sorry.

Creates new binds (instead of editing them) of the healthz and stats
frontends to avoid port conflicts at the first start of the HAProxy
when using hostNetwork: true.

Since these bind directives are not required, the first start of
HAProxy is not affected.
@fabianonunes fabianonunes force-pushed the avoid-port-conflicts-host-mode branch from de65bf9 to 85445b3 Compare September 7, 2023 20:57
@ivanmatmati
Copy link
Collaborator

Good, we can proceed now.

@fabianonunes
Copy link
Contributor Author

Hi, @ivanmatmati.

Is there anything I can do to help you with this issue?

@ivanmatmati
Copy link
Collaborator

No, it's ok we're about to merge your PR. Thanks.

@oktalz oktalz merged commit 2b7484e into haproxytech:master Oct 10, 2023
7 checks passed
@oktalz
Copy link
Member

oktalz commented Oct 10, 2023

@fabianonunes thanks!

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

Successfully merging this pull request may close these issues.

Ports in haproxy.cfg not configurable; Port 8080 unavailable
3 participants