mirror of
https://github.com/pgsty/minio.git
synced 2026-07-21 21:20:23 +03:00
Add functionality to add old buckets to etcd on startup
Buckets already present on a Minio server before it joins a bucket federated deployment will now be added to etcd during startup. In case of a bucket name collision, admin is informed via Minio server console message. Added configuration migration for configuration stored in etcd backend. Also, environment variables are updated and ListBucket path style request is no longer forwarded.
This commit is contained in:
+12
-3
@@ -17,6 +17,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -45,9 +46,17 @@ func checkUpdate(mode string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize and load config from remote etcd or local config directory
|
||||
func initConfig() {
|
||||
if globalEtcdClient != nil {
|
||||
if err := loadConfig(); err != nil {
|
||||
kapi := etcdc.NewKeysAPI(globalEtcdClient)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
_, err := kapi.Get(ctx, getConfigFile(), nil)
|
||||
cancel()
|
||||
if err == nil {
|
||||
logger.FatalIf(migrateConfig(), "Config migration failed.")
|
||||
logger.FatalIf(loadConfig(), "Unable to load config version: '%s'.", serverConfigVersion)
|
||||
} else {
|
||||
if etcdc.IsKeyNotFound(err) {
|
||||
logger.FatalIf(newConfig(), "Unable to initialize minio config for the first time.")
|
||||
logger.Info("Created minio configuration file successfully at", globalEtcdClient.Endpoints())
|
||||
@@ -58,11 +67,11 @@ func initConfig() {
|
||||
return
|
||||
}
|
||||
|
||||
// Config file does not exist, we create it fresh and return upon success.
|
||||
if isFile(getConfigFile()) {
|
||||
logger.FatalIf(migrateConfig(), "Config migration failed")
|
||||
logger.FatalIf(loadConfig(), "Unable to load the configuration file")
|
||||
} else {
|
||||
// Config file does not exist, we create it fresh and return upon success.
|
||||
logger.FatalIf(newConfig(), "Unable to initialize minio config for the first time")
|
||||
logger.Info("Created minio configuration file successfully at " + getConfigDir())
|
||||
}
|
||||
@@ -159,7 +168,7 @@ func handleCommonEnvVars() {
|
||||
logger.FatalIf(err, "Unable to initialize etcd with %s", etcdEndpoints)
|
||||
}
|
||||
|
||||
globalDomainIP = os.Getenv("MINIO_DOMAIN_IP")
|
||||
globalDomainIP = os.Getenv("MINIO_PUBLIC_IP")
|
||||
if globalDomainName != "" && globalDomainIP != "" && globalEtcdClient != nil {
|
||||
var err error
|
||||
globalDNSConfig, err = dns.NewCoreDNS(globalDomainName, globalDomainIP, globalMinioPort, globalEtcdClient)
|
||||
|
||||
Reference in New Issue
Block a user