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: config-backend annotation also for TCP-Backends #1009

Merged
merged 1 commit into from
Jul 2, 2023

Conversation

genofire
Copy link
Contributor

No description provided.

@jcmoraisjr
Copy link
Owner

Great, thanks for the improvement. Please explore these scenarios by adding some tests, you can find a suggested diff below:

diff --git a/pkg/haproxy/instance_test.go b/pkg/haproxy/instance_test.go
index f9b43167..1cf1d2e8 100644
--- a/pkg/haproxy/instance_test.go
+++ b/pkg/haproxy/instance_test.go
@@ -1077,6 +1077,14 @@ frontend _front_https
 				"_back_d1_app_8080_idpathdef__prefix_02.map": "<default>#/app1 path02",
 			},
 		},
+		{
+			doconfig: func(c *config, h *hatypes.Host, b *hatypes.Backend) {
+				b.ModeTCP = true
+				b.CustomConfig = []string{"## custom for TCP backend"}
+			},
+			expected: `
+    ## custom for TCP backend`,
+		},
 	}
 	for _, test := range testCases {
 		c := setup(t)
@@ -3635,6 +3643,14 @@ func TestInstanceCustomProxy(t *testing.T) {
 	h.AddPath(b, "/", hatypes.MatchBegin)
 	h.SetSSLPassthrough(true)

+	var h2 *hatypes.Host
+	var b2 = c.config.Backends().AcquireBackend("d2", "app", "8080")
+	b2.Endpoints = []*hatypes.Endpoint{endpointS21}
+	b2.ModeTCP = true
+	h2 = c.config.Hosts().AcquireHost("d2.local")
+	h2.AddPath(b, "/", hatypes.MatchBegin)
+	h2.SetSSLPassthrough(true)
+
 	auth := &c.config.Frontend().AuthProxy
 	auth.Name = "_front__auth"
 	auth.RangeStart = 4001
@@ -3653,6 +3669,7 @@ func TestInstanceCustomProxy(t *testing.T) {
 		"_tcp_default_pgsql_5432": {"## custom for _tcp_default_pgsql_5432"},
 		"_auth_backend001_5000":   {"## custom for _auth_backend001_5000"},
 		"d1_app_8080":             {"## custom for d1_app_8080"},
+		"d2_app_8080":             {"## custom for d2_app_8080"},
 		"_redirect_https":         {"## custom for _redirect_https"},
 		"_error404":               {"## custom for _error404", "## line 2"},
 		"_auth_4001":              {"## custom for _auth_4001"},
@@ -3682,6 +3699,10 @@ backend d1_app_8080
     mode http
     ## custom for d1_app_8080
     server s1 172.17.0.11:8080 weight 100
+backend d2_app_8080
+    mode tcp
+    ## custom for d2_app_8080
+    server s21 172.17.0.121:8080 weight 100
 backend _redirect_https
     mode http
     ## custom for _redirect_https

@jcmoraisjr
Copy link
Owner

lgtm thanks! merging now

@jcmoraisjr jcmoraisjr merged commit d6b4caf into jcmoraisjr:master Jul 2, 2023
1 check passed
@genofire genofire deleted the patch-1 branch July 2, 2023 21:01
@genofire
Copy link
Contributor Author

genofire commented Jul 3, 2023

When do you release the next version?

@jcmoraisjr
Copy link
Owner

jcmoraisjr commented Jul 3, 2023 via email

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.

2 participants