mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 10:42:14 +02:00
Fix the golint, gosimple warnings
This commit is contained in:
@@ -22,7 +22,7 @@ type Config struct {
|
||||
KubeClient *kubernetes.Clientset
|
||||
RestClient *rest.RESTClient
|
||||
EtcdClient etcdclient.KeysAPI
|
||||
TeamsAPIClient *teams.TeamsAPI
|
||||
TeamsAPIClient *teams.API
|
||||
InfrastructureRoles map[string]spec.PgUser
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ type Controller struct {
|
||||
Config
|
||||
opConfig *config.Config
|
||||
logger *logrus.Entry
|
||||
waitCluster sync.WaitGroup
|
||||
|
||||
clustersMu sync.RWMutex
|
||||
clusters map[spec.NamespacedName]*cluster.Cluster
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
)
|
||||
|
||||
func (c *Controller) initEtcdClient(etcdHost string) error {
|
||||
etcdUrl := fmt.Sprintf("http://%s", etcdHost)
|
||||
etcdURL := fmt.Sprintf("http://%s", etcdHost)
|
||||
|
||||
cfg, err := etcdclient.New(etcdclient.Config{
|
||||
Endpoints: []string{etcdUrl},
|
||||
Endpoints: []string{etcdURL},
|
||||
Transport: etcdclient.DefaultTransport,
|
||||
HeaderTimeoutPerRequest: time.Second,
|
||||
})
|
||||
|
||||
@@ -209,18 +209,18 @@ func (c *Controller) queueClusterEvent(old, new *spec.Postgresql, eventType spec
|
||||
return
|
||||
}
|
||||
|
||||
workerId := c.clusterWorkerId(clusterName)
|
||||
workerID := c.clusterWorkerID(clusterName)
|
||||
clusterEvent := spec.ClusterEvent{
|
||||
EventType: eventType,
|
||||
UID: uid,
|
||||
OldSpec: old,
|
||||
NewSpec: new,
|
||||
WorkerID: workerId,
|
||||
WorkerID: workerID,
|
||||
}
|
||||
//TODO: if we delete cluster, discard all the previous events for the cluster
|
||||
|
||||
c.clusterEventQueues[workerId].Add(clusterEvent)
|
||||
c.logger.WithField("worker", workerId).Infof("%s of the '%s' cluster has been queued for", eventType, clusterName)
|
||||
c.clusterEventQueues[workerID].Add(clusterEvent)
|
||||
c.logger.WithField("worker", workerID).Infof("%s of the '%s' cluster has been queued for", eventType, clusterName)
|
||||
}
|
||||
|
||||
func (c *Controller) postgresqlAdd(obj interface{}) {
|
||||
|
||||
@@ -62,7 +62,7 @@ func thirdPartyResource(TPRName string) *extv1beta.ThirdPartyResource {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Controller) clusterWorkerId(clusterName spec.NamespacedName) uint32 {
|
||||
func (c *Controller) clusterWorkerID(clusterName spec.NamespacedName) uint32 {
|
||||
return crc32.ChecksumIEEE([]byte(clusterName.String())) % c.opConfig.Workers
|
||||
}
|
||||
|
||||
@@ -74,9 +74,8 @@ func (c *Controller) createTPR() error {
|
||||
if err != nil {
|
||||
if !k8sutil.ResourceAlreadyExists(err) {
|
||||
return err
|
||||
} else {
|
||||
c.logger.Infof("ThirdPartyResource '%s' is already registered", TPRName)
|
||||
}
|
||||
c.logger.Infof("ThirdPartyResource '%s' is already registered", TPRName)
|
||||
} else {
|
||||
c.logger.Infof("ThirdPartyResource '%s' has been registered", TPRName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user