func NewNode(id, ip string, pod *corev1.Pod) *Node {
	node := NewDefaultNode()
	node.ID = id
	node.IP = ip
	node.PodName = pod.Name
	node.NodeName = pod.Spec.NodeName
	return node
}
NewNode builds and returns new Node instance
package redisutil
import (
	"errors"
	"fmt"
	"net"
	"sort"
	"strings"
	"time"
	corev1 "k8s.io/api/core/v1"
	redisv1alpha1 "github.com/ucloud/redis-cluster-operator/pkg/apis/redis/v1alpha1"
	"github.com/ucloud/redis-cluster-operator/pkg/utils"
)
const (
	DefaultRedisPort = "6379"
	RedisMasterRole = "master"
	RedisSlaveRole = "slave"
)
const (
	RedisLinkStateConnected = "connected"
	RedisLinkStateDisconnected = "disconnected"
)
const (
	NodeStatusPFail = "fail?"
	NodeStatusFail = "fail"
	NodeStatusHandshake = "handshake"
	NodeStatusNoAddr = "noaddr"
	NodeStatusNoFlags = "noflags"
)
type Node struct {
	ID              string
	IP              string
	Port            string
	Role            string
	LinkState       string
	MasterReferent  string
	FailStatus      []string
	PingSent        int64
	PongRecv        int64
	ConfigEpoch     int64
	Slots           []Slot
	balance         int
	MigratingSlots  map[Slot]string
	ImportingSlots  map[Slot]string
	ServerStartTime time.Time
	NodeName    string
	PodName     string
	StatefulSet string
}
type Nodes []*Node
func (n Nodes) String() string {
	stringer := []utils.Stringer{}
	for _, node := range n {
		stringer = append(stringer, node)
	}
	return utils.SliceJoin(stringer, ",")
}
func NewDefaultNode() *Node {
	return &Node{
		Port:           DefaultRedisPort,
		Slots:          []Slot{},
		MigratingSlots: map[Slot]string{},
		ImportingSlots: map[Slot]string{},
	}
}