Archives bigger than 256K size need env variable for uploading (#697)

For archives bigger than 256K, the Storage service was called from the client side, this needed few environment variables to be set. This change uses port forwarding to achieve the same and does not need environment variables to be set.
This commit is contained in:
Vishal
2018-06-14 01:12:06 +05:30
committed by GitHub
parent ef7d4ae385
commit 6d08e6e0bc
8 changed files with 72 additions and 19 deletions
+25
View File
@@ -19,6 +19,7 @@ package client
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
apiv1 "k8s.io/api/core/v1"
@@ -72,3 +73,27 @@ func (c *Client) ConfigMapGet(m *metav1.ObjectMeta) (*apiv1.ConfigMap, error) {
return &configMap, nil
}
func (c *Client) GetSvcURL(label string) (string, error) {
url := fmt.Sprintf("%s/proxy/svcname?"+label, c.Url)
resp, err := http.Get(url)
if err != nil {
return "", err
}
if resp == nil {
return "", fmt.Errorf("Failed to find service for given label: %v", label)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
storageSvc := string(body)
return storageSvc, err
}