Configure timeout while resolving public-ip
While testing use-cases where we modify the external-ip
of the Gateway node, it was seen that public-ip resolution
is sometimes getting stuck for 15 mins. This PR explicitly
configures a 30 secs timeout while resolving the public-ip.
Fixes:
@@ -91,8 +91,11 @@ func getPublicIP(submSpec *types.SubmarinerSpecification, k8sClient kubernetes.I
func publicAPI(clientset kubernetes.Interface, namespace, value string) (string, error) {
url := "https://" + value
- //nolint:gosec // we really need to get from a non-predefined const URL
- response, err := http.Get(url)
+ httpClient := http.Client{
+ Timeout: 30 * time.Second,
+ }
+
+ response, err := httpClient.Get(url)
if err != nil {
return "", errors.Wrapf(err, "retrieving public IP from %s", url)
}
