Compare commits

...

2 Commits

Author SHA1 Message Date
Brian Picciano
b1fa3be970 Fix garage mc not getting default secret key set correctly 2022-11-13 20:14:16 +01:00
Brian Picciano
739e88d6c9 Add secret ability to specify zone 2022-11-13 20:09:03 +01:00
3 changed files with 21 additions and 13 deletions

View File

@ -36,15 +36,12 @@ var subCmdGarageMC = subCmd{
s3APIAddr := hostBootstrap.ChooseGaragePeer().S3APIAddr()
if *keyID == "" || *keySecret == "" {
if *keyID == "" {
*keyID = hostBootstrap.Garage.GlobalBucketS3APICredentials.ID
}
if *keyID == "" {
*keyID = hostBootstrap.Garage.GlobalBucketS3APICredentials.ID
}
if *keySecret == "" {
*keyID = hostBootstrap.Garage.GlobalBucketS3APICredentials.Secret
}
if *keySecret == "" {
*keySecret = hostBootstrap.Garage.GlobalBucketS3APICredentials.Secret
}
args := flags.Args()
@ -56,13 +53,15 @@ var subCmdGarageMC = subCmd{
args = append([]string{"mc"}, args...)
var (
mcHostVar = fmt.Sprintf(
"MC_HOST_garage=http://%s:%s@%s",
*keyID, *keySecret, s3APIAddr,
)
binPath = filepath.Join(envAppDirPath, "bin/mc")
cliEnv = append(
os.Environ(),
fmt.Sprintf(
"MC_HOST_garage=http://%s:%s@%s",
*keyID, *keySecret, s3APIAddr,
),
mcHostVar,
// The garage docs say this is necessary, though nothing bad
// seems to happen if we leave it out *shrug*

View File

@ -265,9 +265,14 @@ func garageApplyLayout(
id := bootstrapGarageHostForAlloc(thisHost, alloc).ID
zone := hostName
if alloc.Zone != "" {
zone = alloc.Zone
}
clusterLayout[id] = peerLayout{
Capacity: alloc.Capacity / 100,
Zone: hostName,
Zone: zone,
Tags: []string{},
}
}

View File

@ -36,6 +36,10 @@ type ConfigStorageAllocation struct {
S3APIPort int `yaml:"s3_api_port"`
RPCPort int `yaml:"rpc_port"`
AdminPort int `yaml:"admin_port"`
// Zone is a secret option which makes it easier to test garage bugs, but
// which we don't want users to otherwise know about.
Zone string `yaml:"zone"`
}
// Config describes the structure of the daemon config file.