Repository: envoyproxy/gateway

Issue:
Flaky k8s provider test
*Description*:
```log
--- FAIL: TestProvider (7.37s)
    kubernetes_test.go:67: 
        	Error Trace:	/home/runner/work/gateway/gateway/internal/provider/kubernetes/kubernetes_test.go:67
        	Error:      	Received unexpected error:
        	            	failed to create manager: error listening on :8081: listen tcp :8081: bind: address already in use
        	Test:       	TestProvider
```
https://github.com/envoyproxy/gateway/actions/runs/14034588432/job/39289584814
https://github.com/envoyproxy/gateway/actions/runs/13982303837/job/39149826928

I suggest to disable health probe listener in tests to avoid this issue. This can be done by declaring a `healthProbeBindAddress` package variable and overriding it in tests to "". WDYT?

Hints from issue comments:
@shawnh2: this is related to #5149

Solution patch:
diff --git a/internal/provider/kubernetes/kubernetes.go b/internal/provider/kubernetes/kubernetes.go
index fb42b76d4..024153942 100644
--- a/internal/provider/kubernetes/kubernetes.go
+++ b/internal/provider/kubernetes/kubernetes.go
@@ -35,6 +35,9 @@ type Provider struct {
 	manager manager.Manager
 }
 
+// Exposed to allow disabling health probe listener in tests.
+var healthProbeBindAddress = ":8081"
+
 // New creates a new Provider from the provided EnvoyGateway.
 func New(ctx context.Context, restCfg *rest.Config, svrCfg *ec.Server, resources *message.ProviderResources) (*Provider, error) {
 	// TODO: Decide which mgr opts should be exposed through envoygateway.provider.kubernetes API.
@@ -42,7 +45,7 @@ func New(ctx context.Context, restCfg *rest.Config, svrCfg *ec.Server, resources
 	mgrOpts := manager.Options{
 		Scheme:                  envoygateway.GetScheme(),
 		Logger:                  svrCfg.Logger.Logger,
-		HealthProbeBindAddress:  ":8081",
+		HealthProbeBindAddress:  healthProbeBindAddress,
 		LeaderElectionID:        "5b9825d2.gateway.envoyproxy.io",
 		LeaderElectionNamespace: svrCfg.Namespace,
 	}



Test patch:
diff --git a/internal/provider/kubernetes/kubernetes_test.go b/internal/provider/kubernetes/kubernetes_test.go
index 5daf6fba6..c4a62fcd6 100644
--- a/internal/provider/kubernetes/kubernetes_test.go
+++ b/internal/provider/kubernetes/kubernetes_test.go
@@ -51,6 +51,7 @@ func TestMain(m *testing.M) {
 	skipNameValidation = func() *bool {
 		return ptr.To(true)
 	}
+	healthProbeBindAddress = "" // Disable health probe listener to avoid "address already in use" error.
 	os.Exit(m.Run())
 }