Skip to content

Commit e1ef5c6

Browse files
authored
Merge pull request kubernetes-sigs#701 from justinsb/fix_field_comments_clientset
chore: fix field comments on ClientSet
2 parents 801c337 + 91bcf95 commit e1ef5c6

File tree

1 file changed

+47
-22
lines changed

1 file changed

+47
-22
lines changed

pkg/agent/clientset.go

+47-22
Original file line numberDiff line numberDiff line change
@@ -38,42 +38,67 @@ const (
3838

3939
// ClientSet consists of clients connected to each instance of an HA proxy server.
4040
type ClientSet struct {
41-
mu sync.Mutex //protects the clients.
42-
clients map[string]*Client // map between serverID and the client
43-
// connects to this server.
44-
45-
agentID string // ID of this agent
46-
address string // proxy server address. Assuming HA proxy server
47-
48-
leaseCounter ServerCounter // counts number of proxy server leases
49-
lastReceivedServerCount int // last server count received from a proxy server
50-
lastServerCount int // last server count value from either lease system or proxy server, former takes priority
51-
52-
// unless it is an HA server. Initialized when the ClientSet creates
53-
// the first client. When syncForever is set, it will be the most recently seen.
54-
syncInterval time.Duration // The interval by which the agent
55-
// periodically checks that it has connections to all instances of the
56-
// proxy server.
57-
probeInterval time.Duration // The interval by which the agent
41+
// mu guards access to the clients map
42+
mu sync.Mutex
43+
44+
// clients is a map between serverID and the client
45+
// connected to this server.
46+
clients map[string]*Client
47+
48+
// agentID is "our ID" - the ID of this agent.
49+
agentID string
50+
51+
// Address is the proxy server address. Assuming HA proxy server
52+
address string
53+
54+
// leaseCounter counts number of proxy server leases
55+
leaseCounter ServerCounter
56+
57+
// lastReceivedServerCount is the last serverCount value received when connecting to a proxy server
58+
lastReceivedServerCount int
59+
60+
// lastServerCount is the most-recently observed serverCount value from either lease system or proxy server,
61+
// former takes priority unless it is an HA server.
62+
// Initialized when the ClientSet creates the first client.
63+
// When syncForever is set, it will be the most recently seen.
64+
lastServerCount int
65+
66+
// syncInterval is the interval at which the agent periodically checks
67+
// that it has connections to all instances of the proxy server.
68+
syncInterval time.Duration
69+
70+
// The maximum interval for the syncInterval to back off to when unable to connect to the proxy server
71+
syncIntervalCap time.Duration
72+
73+
// syncForever is true if we should continue syncing (support dynamic server count).
74+
syncForever bool
75+
76+
// probeInterval is the interval at which the agent
5877
// periodically checks if its connections to the proxy server is ready.
59-
syncIntervalCap time.Duration // The maximum interval
60-
// for the syncInterval to back off to when unable to connect to the proxy server
78+
probeInterval time.Duration
6179

6280
dialOptions []grpc.DialOption
63-
// file path contains service account token
81+
82+
// serviceAccountTokenPath is the file path to our kubernetes service account token
6483
serviceAccountTokenPath string
84+
6585
// channel to signal that the agent is pending termination.
6686
drainCh <-chan struct{}
87+
6788
// channel to signal shutting down the client set. Primarily for test.
6889
stopCh <-chan struct{}
6990

70-
agentIdentifiers string // The identifiers of the agent, which will be used
91+
// agentIdentifiers is the identifiers of the agent, which will be used
7192
// by the server when choosing agent
93+
agentIdentifiers string
7294

7395
warnOnChannelLimit bool
7496
xfrChannelSize int
7597

76-
syncForever bool // Continue syncing (support dynamic server count).
98+
// serverCountSource controls how we compute the server count.
99+
// The proxy server sends the serverCount header to each connecting agent,
100+
// and the agent figures out from these observations how many
101+
// agent-to-proxy-server connections it should maintain.
77102
serverCountSource string
78103
}
79104

0 commit comments

Comments
 (0)