From b97c0cb0aec84c86dbed354403772f675429eabb Mon Sep 17 00:00:00 2001 From: Gaius Date: Thu, 11 May 2023 20:03:12 +0800 Subject: [PATCH] feat: remove deprecated field in manager and scheduler (#2345) Signed-off-by: Gaius --- manager/config/config.go | 8 -------- scheduler/config/config.go | 32 -------------------------------- 2 files changed, 40 deletions(-) diff --git a/manager/config/config.go b/manager/config/config.go index 709af5074..9dc15286a 100644 --- a/manager/config/config.go +++ b/manager/config/config.go @@ -249,9 +249,6 @@ type MetricsConfig struct { } type GRPCConfig struct { - // DEPRECATED: Please use the `listenIP` field instead. - Listen string `mapstructure:"listen" yaml:"listen"` - // AdvertiseIP is advertise ip. AdvertiseIP net.IP `yaml:"advertiseIP" mapstructure:"advertiseIP"` @@ -601,11 +598,6 @@ func (cfg *Config) Convert() error { cfg.Database.Redis.Addrs = []string{fmt.Sprintf("%s:%d", cfg.Database.Redis.Host, cfg.Database.Redis.Port)} } - // TODO Compatible with deprecated fields listen. - if cfg.Server.GRPC.Listen != "" && cfg.Server.GRPC.ListenIP == nil { - cfg.Server.GRPC.ListenIP = net.ParseIP(cfg.Server.GRPC.Listen) - } - if cfg.Server.GRPC.AdvertiseIP == nil { if cfg.Network.EnableIPv6 { cfg.Server.GRPC.AdvertiseIP = ip.IPv6 diff --git a/scheduler/config/config.go b/scheduler/config/config.go index 6bd1a4579..7c0f48e75 100644 --- a/scheduler/config/config.go +++ b/scheduler/config/config.go @@ -78,12 +78,6 @@ type Config struct { } type ServerConfig struct { - // DEPRECATED: Please use the `advertiseIP` field instead. - IP string `yaml:"ip" mapstructure:"ip"` - - // DEPRECATED: Please use the `listenIP` field instead. - Listen string `yaml:"listen" mapstructure:"listen"` - // AdvertiseIP is advertise ip. AdvertiseIP net.IP `yaml:"advertiseIP" mapstructure:"advertiseIP"` @@ -124,12 +118,6 @@ type SchedulerConfig struct { // Algorithm is scheduling algorithm used by the scheduler. Algorithm string `yaml:"algorithm" mapstructure:"algorithm"` - // DEPRECATED: Please use the `backToSourceCount` field instead. - BackSourceCount int `yaml:"backSourceCount" mapstructure:"backSourceCount"` - - // DEPRECATED: Please use the `retryBackToSourceLimit` field instead. - RetryBackSourceLimit int `yaml:"retryBackSourceLimit" mapstructure:"retryBackSourceLimit"` - // BackToSourceCount is single task allows the peer to back-to-source count. BackToSourceCount int `yaml:"backToSourceCount" mapstructure:"backToSourceCount"` @@ -613,16 +601,6 @@ func (cfg *Config) Validate() error { } func (cfg *Config) Convert() error { - // TODO Compatible with deprecated fields backSourceCount. - if cfg.Scheduler.BackSourceCount != 0 { - cfg.Scheduler.BackToSourceCount = cfg.Scheduler.BackSourceCount - } - - // TODO Compatible with deprecated fields retryBackSourceLimit. - if cfg.Scheduler.RetryBackSourceLimit != 0 { - cfg.Scheduler.RetryBackToSourceLimit = cfg.Scheduler.RetryBackSourceLimit - } - // TODO Compatible with deprecated fields address of redis of job. if len(cfg.Database.Redis.Addrs) == 0 && len(cfg.Job.Redis.Addrs) != 0 { cfg.Database.Redis.Addrs = cfg.Job.Redis.Addrs @@ -658,16 +636,6 @@ func (cfg *Config) Convert() error { cfg.Database.Redis.BackendDB = cfg.Job.Redis.BackendDB } - // TODO Compatible with deprecated fields ip. - if cfg.Server.IP != "" && cfg.Server.AdvertiseIP == nil { - cfg.Server.AdvertiseIP = net.ParseIP(cfg.Server.IP) - } - - // TODO Compatible with deprecated fields listen. - if cfg.Server.Listen != "" && cfg.Server.ListenIP == nil { - cfg.Server.ListenIP = net.ParseIP(cfg.Server.Listen) - } - if cfg.Server.AdvertiseIP == nil { if cfg.Network.EnableIPv6 { cfg.Server.AdvertiseIP = ip.IPv6