mirror of
https://github.com/minio/minio.git
synced 2025-01-26 14:13:16 -05:00
Enable config for NAS gateway mode (#7948)
Starting with #7751 we don't store config in etcd anymore, allow NAS to honor config on disk.
This commit is contained in:
parent
e40c29e834
commit
d744865dc6
@ -23,6 +23,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio/cmd/logger"
|
"github.com/minio/minio/cmd/logger"
|
||||||
"github.com/minio/minio/pkg/quick"
|
"github.com/minio/minio/pkg/quick"
|
||||||
@ -101,6 +102,25 @@ func (sys *ConfigSys) Load(objAPI ObjectLayer) error {
|
|||||||
return sys.Init(objAPI)
|
return sys.Init(objAPI)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WatchConfigNASDisk - watches nas disk on periodic basis.
|
||||||
|
func (sys *ConfigSys) WatchConfigNASDisk(objAPI ObjectLayer) {
|
||||||
|
configInterval := globalRefreshIAMInterval
|
||||||
|
watchDisk := func() {
|
||||||
|
ticker := time.NewTicker(configInterval)
|
||||||
|
defer ticker.Stop()
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-GlobalServiceDoneCh:
|
||||||
|
return
|
||||||
|
case <-ticker.C:
|
||||||
|
loadConfig(objAPI)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Refresh configSys in background for NAS gateway.
|
||||||
|
go watchDisk()
|
||||||
|
}
|
||||||
|
|
||||||
// Init - initializes config system from config.json.
|
// Init - initializes config system from config.json.
|
||||||
func (sys *ConfigSys) Init(objAPI ObjectLayer) error {
|
func (sys *ConfigSys) Init(objAPI ObjectLayer) error {
|
||||||
if objAPI == nil {
|
if objAPI == nil {
|
||||||
|
@ -158,7 +158,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
registerSTSRouter(router)
|
registerSTSRouter(router)
|
||||||
}
|
}
|
||||||
|
|
||||||
enableConfigOps := globalEtcdClient != nil && gatewayName == "nas"
|
enableConfigOps := gatewayName == "nas"
|
||||||
enableIAMOps := globalEtcdClient != nil
|
enableIAMOps := globalEtcdClient != nil
|
||||||
|
|
||||||
// Enable IAM admin APIs if etcd is enabled, if not just enable basic
|
// Enable IAM admin APIs if etcd is enabled, if not just enable basic
|
||||||
@ -236,6 +236,10 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
|
|
||||||
// Load globalServerConfig from etcd
|
// Load globalServerConfig from etcd
|
||||||
logger.LogIf(context.Background(), globalConfigSys.Init(newObject))
|
logger.LogIf(context.Background(), globalConfigSys.Init(newObject))
|
||||||
|
|
||||||
|
// Start watching disk for reloading config, this
|
||||||
|
// is only enabled for "NAS" gateway.
|
||||||
|
globalConfigSys.WatchConfigNASDisk(newObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load logger subsystem
|
// Load logger subsystem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user