Fix storagesvc url in archive (#2982)
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
This commit is contained in:
@@ -104,11 +104,12 @@ func getArchiveURL(ctx context.Context, client cmd.Client, archiveID string, ser
|
|||||||
storageType := resp.Header.Get("X-FISSION-STORAGETYPE")
|
storageType := resp.Header.Get("X-FISSION-STORAGETYPE")
|
||||||
|
|
||||||
if storageType == "local" {
|
if storageType == "local" {
|
||||||
storagesvcURL, err := util.GetStorageURL(ctx, client)
|
storageSvc, err := util.GetSvcName(ctx, client.KubernetesClient, "fission-storage")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
client := storageSvcClient.MakeClient(storagesvcURL.String())
|
storagesvcURL := "http://" + storageSvc
|
||||||
|
client := storageSvcClient.MakeClient(storagesvcURL)
|
||||||
return client.GetUrl(archiveID), nil
|
return client.GetUrl(archiveID), nil
|
||||||
} else if storageType == "s3" {
|
} else if storageType == "s3" {
|
||||||
storageBucket := resp.Header.Get("X-FISSION-BUCKET")
|
storageBucket := resp.Header.Get("X-FISSION-BUCKET")
|
||||||
|
|||||||
@@ -511,6 +511,23 @@ func ConfigMapExists(ctx context.Context, m *metav1.ObjectMeta, kClient kubernet
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetSvcName(ctx context.Context, kClient kubernetes.Interface, application string) (string, error) {
|
||||||
|
appLabelSelector := "application=" + application
|
||||||
|
|
||||||
|
services, err := kClient.CoreV1().Services("").List(ctx, metav1.ListOptions{
|
||||||
|
LabelSelector: appLabelSelector,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(services.Items) > 1 || len(services.Items) == 0 {
|
||||||
|
return "", errors.Errorf("more than one service found for application=%s", application)
|
||||||
|
}
|
||||||
|
service := services.Items[0]
|
||||||
|
return service.Name + "." + service.Namespace, nil
|
||||||
|
}
|
||||||
|
|
||||||
// FunctionPodLogs : Get logs for a function directly from pod
|
// FunctionPodLogs : Get logs for a function directly from pod
|
||||||
func FunctionPodLogs(ctx context.Context, fnName, ns string, client cmd.Client) (err error) {
|
func FunctionPodLogs(ctx context.Context, fnName, ns string, client cmd.Client) (err error) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user