diff --git a/server/config/config.go b/server/config/config.go index dee41b86de5..8cb3c7869f3 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -216,6 +216,13 @@ type ServerConfig struct { // VerifyBootstrap sanity-checks the initial config for bootstrap case // and returns an error for things that should never happen. func (c *ServerConfig) VerifyBootstrap() error { + // Print deprecation warnings first + if warnings := c.checkDeprecatedOptions(); len(warnings) > 0 { + for _, warning := range warnings { + c.Logger.Warn(warning) + } + } + if err := c.hasLocalMember(); err != nil { return err } @@ -234,8 +241,13 @@ func (c *ServerConfig) VerifyBootstrap() error { // VerifyJoinExisting sanity-checks the initial config for join existing cluster // case and returns an error for things that should never happen. func (c *ServerConfig) VerifyJoinExisting() error { - // The member has announced its peer urls to the cluster before starting; no need to - // set the configuration again. + // Print deprecation warnings first + if warnings := c.checkDeprecatedOptions(); len(warnings) > 0 { + for _, warning := range warnings { + c.Logger.Warn(warning) + } + } + if err := c.hasLocalMember(); err != nil { return err } @@ -365,3 +377,21 @@ func (c *ServerConfig) BackendPath() string { return datadir.ToBackendFileName(c func (c *ServerConfig) MaxRequestBytesWithOverhead() uint { return c.MaxRequestBytes + grpcOverheadBytes } + +// Add this new function to check deprecated options +func (c *ServerConfig) checkDeprecatedOptions() []string { + var warnings []string + + // Check for deprecated configurations + if c.ForceNewCluster { + warnings = append(warnings, "WARNING: 'force-new-cluster' option is deprecated and will be removed in future versions") + } + + if c.V2Deprecation == "" { + warnings = append(warnings, "WARNING: v2 API is deprecated and will be decommissioned in etcd v3.6") + } + + // Add more deprecated option checks as needed + + return warnings +}