CLI to operate archives managed by Storage Service (#2450)

* Add API for listing storage service archives
If id is mentioned we allow user to download specific
archive. If id is not mentioned we list all archives
present with storage service.
This will allow us to build CLI with storage service
and help users to debug storage service.
* Added commands for storagesvc cli and functionalities
* Reusing code and added geturl and download.
* Fixed geturl for localstorage.
* Fixed description of fission archive command
* Added unit tests for function getstorageurl
* Added integration test for archive cli




Co-authored-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Ankit Chawla
2022-06-15 18:53:36 +05:30
committed by GitHub
co-authored by Sanket Sudake
parent 7f21b708e7
commit 21ea35b02a
17 changed files with 636 additions and 31 deletions
+5 -4
View File
@@ -18,8 +18,9 @@ package util
// fission-cli options
const (
SPEC_IGNORE_FILE = ".specignore"
COMMIT_LABEL = "commit"
FISSION_AUTH_URI = "/auth/login"
FISSION_AUTH_TOKEN = "FISSION_AUTH_TOKEN"
SPEC_IGNORE_FILE = ".specignore"
COMMIT_LABEL = "commit"
FISSION_AUTH_URI = "/auth/login"
FISSION_AUTH_TOKEN = "FISSION_AUTH_TOKEN"
FISSION_STORAGE_URI = "/v1/archive"
)
+15
View File
@@ -18,6 +18,7 @@ package util
import (
"fmt"
"net/url"
"os"
"os/user"
"path/filepath"
@@ -443,3 +444,17 @@ func ApplyLabelsAndAnnotations(input cli.Input, objectMeta *metav1.ObjectMeta) e
}
return nil
}
func GetStorageURL(kubeContext string) (*url.URL, error) {
storageLocalPort, err := SetupPortForward(GetFissionNamespace(), "application=fission-storage", kubeContext)
if err != nil {
return nil, err
}
serverURL, err := url.Parse("http://127.0.0.1:" + storageLocalPort)
if err != nil {
return nil, err
}
return serverURL, nil
}