mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 04:30:26 +03:00
Add periodic callhome functionality (#14918)
* Add periodic callhome functionality Periodically (every 24hrs by default), fetch callhome information and upload it to SUBNET. New config keys under the `callhome` subsystem: enable - Set to `on` for enabling callhome. Default `off` frequency - Interval between callhome cycles. Default `24h` * Improvements based on review comments - Update `enableCallhome` safely - Rename pctx to ctx - Block during execution of callhome - Store parsed proxy URL in global subnet config - Store callhome URL(s) in constants - Use existing global transport - Pass auth token to subnetPostReq - Use `config.EnableOn` instead of `"on"` * Use atomic package instead of lock * Use uber atomic package * Use `Cancel` instead of `cancel` Co-authored-by: Harshavardhana <harsha@minio.io> Co-authored-by: Harshavardhana <harsha@minio.io> Co-authored-by: Aditya Manthramurthy <donatello@users.noreply.github.com>
This commit is contained in:
@@ -18,10 +18,9 @@
|
||||
package subnet
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"github.com/minio/minio/internal/config"
|
||||
"github.com/minio/pkg/env"
|
||||
xnet "github.com/minio/pkg/net"
|
||||
)
|
||||
|
||||
// DefaultKVS - default KV config for subnet settings
|
||||
@@ -49,7 +48,7 @@ type Config struct {
|
||||
APIKey string `json:"api_key"`
|
||||
|
||||
// The HTTP(S) proxy URL to use for connecting to SUBNET
|
||||
Proxy string `json:"proxy"`
|
||||
ProxyURL *xnet.URL `json:"proxy_url"`
|
||||
}
|
||||
|
||||
// LookupConfig - lookup config and override with valid environment settings if any.
|
||||
@@ -58,10 +57,12 @@ func LookupConfig(kvs config.KVS) (cfg Config, err error) {
|
||||
return cfg, err
|
||||
}
|
||||
|
||||
cfg.Proxy = env.Get(config.EnvMinIOSubnetProxy, kvs.Get(config.Proxy))
|
||||
_, err = url.Parse(cfg.Proxy)
|
||||
if err != nil {
|
||||
return cfg, err
|
||||
proxy := env.Get(config.EnvMinIOSubnetProxy, kvs.Get(config.Proxy))
|
||||
if len(proxy) > 0 {
|
||||
cfg.ProxyURL, err = xnet.ParseHTTPURL(proxy)
|
||||
if err != nil {
|
||||
return cfg, err
|
||||
}
|
||||
}
|
||||
|
||||
cfg.License = env.Get(config.EnvMinIOSubnetLicense, kvs.Get(config.License))
|
||||
|
||||
Reference in New Issue
Block a user