Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify cluster for resource download/upload #106

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/beach/cmd/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,14 @@ func retrieveCloudStorageCredentials(instanceIdentifier string, projectNamespace
log.Info("Retrieving cloud storage access data from instance")

internalHost := "beach@" + instanceIdentifier + "." + projectNamespace
jumpHost := ""
if projectCluster != "" {
jumpHost = "beach@ssh." + projectCluster + ".flownative.cloud"
} else {
jumpHost = "[email protected]"
}
output, err := exec.RunCommand("ssh", []string{
"-J", "[email protected]", internalHost,
"-J", jumpHost, internalHost,
"/bin/bash", "-c", "env | grep BEACH_GOOGLE_CLOUD_STORAGE_",
})
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/beach/cmd/resource-download.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Notes:
func init() {
resourceDownloadCmd.Flags().StringVar(&instanceIdentifier, "instance", "", "instance identifier of the Beach instance to download from, eg. 'instance-123abc45-def6-7890-abcd-1234567890ab'")
resourceDownloadCmd.Flags().StringVar(&projectNamespace, "namespace", "", "The project namespace of the Beach instance to download from, eg. 'beach-project-123abc45-def6-7890-abcd-1234567890ab'")
resourceDownloadCmd.Flags().StringVar(&projectCluster, "cluster", "", "The cluster name of the Beach instance to download from, eg. 'h9acc4'")
kdambekalns marked this conversation as resolved.
Show resolved Hide resolved
resourceDownloadCmd.Flags().StringVar(&bucketName, "bucket", "", "name of the bucket to download resources from")
resourceDownloadCmd.Flags().StringVar(&resourcesPath, "resources-path", "", "custom path where to store the downloaded resources, e.g. 'Data/Persistent/Protected'")
_ = resourceDownloadCmd.MarkFlagRequired("instance")
Expand Down
3 changes: 2 additions & 1 deletion cmd/beach/cmd/resource-upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"google.golang.org/api/option"
)

var instanceIdentifier, projectNamespace, bucketName, resourcesPath, resumeWithFile string
var instanceIdentifier, projectNamespace, projectCluster, bucketName, resourcesPath, resumeWithFile string
var force bool

// resourceUploadCmd represents the resource-upload command
Expand Down Expand Up @@ -62,6 +62,7 @@ Notes:
func init() {
resourceUploadCmd.Flags().StringVar(&instanceIdentifier, "instance", "", "instance identifier of the Beach instance to upload to, eg. 'instance-123abc45-def6-7890-abcd-1234567890ab'")
resourceUploadCmd.Flags().StringVar(&projectNamespace, "namespace", "", "The project namespace of the Beach instance to upload to, eg. 'beach-project-123abc45-def6-7890-abcd-1234567890ab'")
resourceUploadCmd.Flags().StringVar(&projectCluster, "cluster", "", "The cluster name of the Beach instance to upload to, eg. 'h9acc4'")
resourceUploadCmd.Flags().BoolVar(&force, "force", false, "Force uploading resources which already exist in the target bucket")
resourceUploadCmd.Flags().StringVar(&resumeWithFile, "resume-with-file", "", "If specified, resume uploading resources starting with the given filename, eg. '12dcde4c13142942288c5a973caf0fa720ed2794'")
_ = resourceUploadCmd.MarkFlagRequired("instance")
Expand Down