embed/config.go
func (cfg *Config) GetDNSClusterNames() ([]string, error) {
	var (
		clusterStrs       []string
		cerr              error
		serviceNameSuffix string
	)
	if cfg.DNSClusterServiceName != "" {
		serviceNameSuffix = "-" + cfg.DNSClusterServiceName
	}

	lg := cfg.GetLogger()

	// Use both etcd-server-ssl and etcd-server for discovery.
	// Combine the results if both are available.
	clusterStrs, cerr = srv.GetCluster("https", "etcd-server-ssl"+serviceNameSuffix, cfg.Name, cfg.DNSCluster, cfg.APUrls)
	if cerr != nil {
		clusterStrs = make([]string, 0)
	}
	if lg != nil {
		lg.Info(
			"get cluster for etcd-server-ssl SRV",
			zap.String("service-scheme", "https"),
			zap.String("service-name", "etcd-server-ssl"+serviceNameSuffix),
			zap.String("server-name", cfg.Name),
			zap.String("discovery-srv", cfg.DNSCluster),
			zap.Strings("advertise-peer-urls", cfg.getAPURLs()),
			zap.Strings("found-cluster", clusterStrs),
			zap.Error(cerr),
		)
	}

	defaultHTTPClusterStrs, httpCerr := srv.GetCluster("http", "etcd-server"+serviceNameSuffix, cfg.Name, cfg.DNSCluster, cfg.APUrls)
	if httpCerr != nil {
		clusterStrs = append(clusterStrs, defaultHTTPClusterStrs...)
	}
	if lg != nil {
		lg.Info(
			"get cluster for etcd-server SRV",
			zap.String("service-scheme", "http"),
			zap.String("service-name", "etcd-server"+serviceNameSuffix),
			zap.String("server-name", cfg.Name),
			zap.String("discovery-srv", cfg.DNSCluster),
			zap.Strings("advertise-peer-urls", cfg.getAPURLs()),
			zap.Strings("found-cluster", clusterStrs),
			zap.Error(httpCerr),
		)
	}

	return clusterStrs, cerr
}
func (cfg *Config) GetDNSClusterNames() ([]string, error) {
	var (
		clusterStrs       []string
		cerr              error
		serviceNameSuffix string
	)
	if cfg.DNSClusterServiceName != "" {
		serviceNameSuffix = "-" + cfg.DNSClusterServiceName
	}

	lg := cfg.GetLogger()

	// Use both etcd-server-ssl and etcd-server for discovery.
	// Combine the results if both are available.
	clusterStrs, cerr = srv.GetCluster("https", "etcd-server-ssl"+serviceNameSuffix, cfg.Name, cfg.DNSCluster, cfg.APUrls)
	if cerr != nil {
		clusterStrs = make([]string, 0)
	}
	if lg != nil {
		lg.Info(
			"get cluster for etcd-server-ssl SRV",
			zap.String("service-scheme", "https"),
			zap.String("service-name", "etcd-server-ssl"+serviceNameSuffix),
			zap.String("server-name", cfg.Name),
			zap.String("discovery-srv", cfg.DNSCluster),
			zap.Strings("advertise-peer-urls", cfg.getAPURLs()),
			zap.Strings("found-cluster", clusterStrs),
			zap.Error(cerr),
		)
	}

	defaultHTTPClusterStrs, httpCerr := srv.GetCluster("http", "etcd-server"+serviceNameSuffix, cfg.Name, cfg.DNSCluster, cfg.APUrls)
	if httpCerr != nil {
		clusterStrs = append(clusterStrs, defaultHTTPClusterStrs...)
	}
	if lg != nil {
		lg.Info(
			"get cluster for etcd-server SRV",
			zap.String("service-scheme", "http"),
			zap.String("service-name", "etcd-server"+serviceNameSuffix),
			zap.String("server-name", cfg.Name),
			zap.String("discovery-srv", cfg.DNSCluster),
			zap.Strings("advertise-peer-urls", cfg.getAPURLs()),
			zap.Strings("found-cluster", clusterStrs),
			zap.Error(httpCerr),
		)
	}

	return clusterStrs, cerr
}
// GetDNSClusterNames uses DNS SRV records to get a list of initial nodes for cluster bootstrapping.