This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit c2131ca00858848fb01264f4c08ab67cc2243385
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Fri Jan 7 12:48:08 2022 +0100

    chore(e2e): Set NO_PROXY with the Kubernetes service cluster IPs
---
 e2e/common/build/maven_http_proxy_test.go | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/e2e/common/build/maven_http_proxy_test.go 
b/e2e/common/build/maven_http_proxy_test.go
index ace8aa8..ef7a6f3 100644
--- a/e2e/common/build/maven_http_proxy_test.go
+++ b/e2e/common/build/maven_http_proxy_test.go
@@ -31,6 +31,7 @@ import (
        "fmt"
        "math/big"
        rand2 "math/rand"
+       "strings"
        "testing"
        "time"
 
@@ -294,14 +295,24 @@ ProxyVia Off
                        }),
                ))
 
+               svc := Service("default", "kubernetes")()
+               Expect(svc).NotTo(BeNil())
+
+               // It may be needed to populate the values from the cluster, 
machine and service network CIDRs
+               noProxy := []string{
+                       ".cluster.local",
+                       ".svc",
+                       "localhost",
+               }
+               noProxy = append(noProxy, svc.Spec.ClusterIPs...)
+
                // Install Camel K with the HTTP proxy
                Expect(Kamel("install", "-n", ns,
                        "--operator-env-vars", 
fmt.Sprintf("HTTP_PROXY=http://%s";, hostname),
                        // FIXME: TLS handshake issue
                        // "--operator-env-vars", 
fmt.Sprintf("HTTPS_PROXY=https://%s";, hostname),
                        // "--maven-ca-secret", 
secret.Name+"/"+corev1.TLSCertKey,
-                       // FIXME: use the cluster network CIDR
-                       "--operator-env-vars", 
"NO_PROXY=.cluster.local,.svc,10.0.0.0/16,127.0.0.1,172.17.0.0/18,172.21.0.0/16",
+                       "--operator-env-vars", 
"NO_PROXY="+strings.Join(noProxy, ","),
                ).Execute()).To(Succeed())
 
                Eventually(PlatformPhase(ns), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))

Reply via email to