-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
145 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package s3 | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
// Implements Mounter | ||
type rcloneMounter struct { | ||
bucket *bucket | ||
url string | ||
region string | ||
accessKeyID string | ||
secretAccessKey string | ||
} | ||
|
||
const ( | ||
rcloneCmd = "rclone" | ||
) | ||
|
||
func newRcloneMounter(b *bucket, cfg *Config) (Mounter, error) { | ||
return &rcloneMounter{ | ||
bucket: b, | ||
url: cfg.Endpoint, | ||
region: cfg.Region, | ||
accessKeyID: cfg.AccessKeyID, | ||
secretAccessKey: cfg.SecretAccessKey, | ||
}, nil | ||
} | ||
|
||
func (rclone *rcloneMounter) Stage(stageTarget string) error { | ||
return nil | ||
} | ||
|
||
func (rclone *rcloneMounter) Unstage(stageTarget string) error { | ||
return nil | ||
} | ||
|
||
func (rclone *rcloneMounter) Mount(source string, target string) error { | ||
args := []string{ | ||
"mount", | ||
fmt.Sprintf(":s3:%s/%s", rclone.bucket.Name, rclone.bucket.FSPath), | ||
fmt.Sprintf("%s", target), | ||
"--daemon", | ||
"--s3-provider=AWS", | ||
"--s3-env-auth=true", | ||
fmt.Sprintf("--s3-region=%s", rclone.region), | ||
fmt.Sprintf("--s3-endpoint=%s", rclone.url), | ||
"--allow-other", | ||
// TODO: make this configurable | ||
"--vfs-cache-mode=writes", | ||
} | ||
os.Setenv("AWS_ACCESS_KEY_ID", rclone.accessKeyID) | ||
os.Setenv("AWS_SECRET_ACCESS_KEY", rclone.secretAccessKey) | ||
return fuseMount(target, rcloneCmd, args) | ||
} | ||
|
||
func (rclone *rcloneMounter) Unmount(target string) error { | ||
return fuseUnmount(target, rcloneCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM ctrox/csi-s3:1.0.1-alpha | ||
FROM ctrox/csi-s3:dev | ||
LABEL maintainers="Cyrill Troxler <[email protected]>" | ||
LABEL description="csi-s3 testing image" | ||
|
||
|