Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #394 from ottosulin/fix/loglevels
Browse files Browse the repository at this point in the history
Add log levels to prevent too verbose logging
  • Loading branch information
justinsb authored Feb 28, 2021
2 parents d2bc348 + 02d2f04 commit c5382f5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func (m *EtcdController) run(ctx context.Context) (bool, error) {
}

{
klog.Infof("Broadcasting leadership assertion with token %q", m.leadership.token)
klog.V(3).Infof("Broadcasting leadership assertion with token %q", m.leadership.token)
// We always broadcast our leadership claim, to ensure that all peers are in sync
err := m.peers.AssertLeadership(ctx, m.leadership.token)
if err != nil {
Expand All @@ -282,7 +282,7 @@ func (m *EtcdController) run(ctx context.Context) (bool, error) {
{
for _, peer := range peers {
if !m.leadership.ackedPeers[peer.Id] {
klog.Infof("peer %q has not acked our leadership; resigning leadership", peer)
klog.V(3).Infof("peer %q has not acked our leadership; resigning leadership", peer)
m.leadership = nil

// Wait one cycle after leadership changes
Expand All @@ -292,14 +292,14 @@ func (m *EtcdController) run(ctx context.Context) (bool, error) {
}
}

klog.Infof("I am leader with token %q", m.leadership.token)
klog.V(3).Infof("I am leader with token %q", m.leadership.token)

// Query all our peers to try to find the actual state of etcd on each node
clusterState, err := m.updateClusterState(ctx, peers)
if err != nil {
return false, fmt.Errorf("error building cluster state: %v", err)
}
klog.Infof("etcd cluster state: %s", clusterState)
klog.V(3).Infof("etcd cluster state: %s", clusterState)
klog.V(2).Infof("etcd cluster members: %s", clusterState.members)

now := time.Now()
Expand Down Expand Up @@ -392,7 +392,7 @@ func (m *EtcdController) run(ctx context.Context) (bool, error) {
klog.Infof("no cluster spec set - must seed new cluster")
return false, nil
}
klog.Infof("spec %v", clusterSpec)
klog.V(3).Infof("spec %v", clusterSpec)

desiredQuorumSize := quorumSize(int(clusterSpec.MemberCount))

Expand Down Expand Up @@ -554,7 +554,7 @@ func (m *EtcdController) run(ctx context.Context) (bool, error) {
}
}

klog.Infof("controller loop complete")
klog.V(3).Infof("controller loop complete")

return false, nil
}
Expand Down Expand Up @@ -638,7 +638,7 @@ func (m *EtcdController) buildMemberMap(etcdClusterState *etcdClusterState) *pro

func (m *EtcdController) broadcastMemberMap(ctx context.Context, etcdClusterState *etcdClusterState, memberMap *protoetcd.MemberMap) []error {
// TODO: optimize this
klog.Infof("sending member map to all peers: %v", memberMap)
klog.V(3).Infof("sending member map to all peers: %v", memberMap)

var errors []error
for _, peer := range etcdClusterState.peers {
Expand Down
2 changes: 1 addition & 1 deletion pkg/etcd/etcdserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (s *EtcdServer) UpdateEndpoints(ctx context.Context, request *protoetcd.Upd
}

if len(addressToHosts) != 0 {
klog.Infof("updating hosts: %v", addressToHosts)
klog.V(3).Infof("updating hosts: %v", addressToHosts)
if err := s.dnsProvider.UpdateHosts(addressToHosts); err != nil {
klog.Warningf("error updating hosts: %v", err)
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/hosts/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (h *Provider) update() error {
}
}

klog.Infof("hosts update: primary=%v, fallbacks=%v, final=%v", h.primary, h.fallbacks, addrToHosts)
klog.V(3).Infof("hosts update: primary=%v, fallbacks=%v, final=%v", h.primary, h.fallbacks, addrToHosts)
return updateHostsFileWithRecords("/etc/hosts", h.Key, addrToHosts)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/privateapi/leadership.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type leadership struct {
}

func (s *Server) LeaderNotification(ctx grpccontext.Context, request *LeaderNotificationRequest) (*LeaderNotificationResponse, error) {
klog.Infof("Got LeaderNotification %s", request)
klog.V(3).Infof("Got LeaderNotification %s", request)

if request.View == nil {
return nil, fmt.Errorf("View is required")
Expand Down

0 comments on commit c5382f5

Please sign in to comment.