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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user