Skip to content

Commit a1328d1

Browse files
committed
Review comments
1 parent 9e9f7f8 commit a1328d1

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

cmd/agent/app/options/options.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ type GrpcProxyAgentOptions struct {
8585
// Providing a label selector enables updating the server count by counting the
8686
// number of valid leases matching the selector.
8787
ServerLeaseSelector string
88-
// Lease informer resync period.
89-
InformerResync time.Duration
9088
// Path to kubeconfig (used by kubernetes client for lease listing)
9189
KubeconfigPath string
9290
}
@@ -132,7 +130,6 @@ func (o *GrpcProxyAgentOptions) Flags() *pflag.FlagSet {
132130
flags.BoolVar(&o.SyncForever, "sync-forever", o.SyncForever, "If true, the agent continues syncing, in order to support server count changes.")
133131
flags.IntVar(&o.XfrChannelSize, "xfr-channel-size", 150, "Set the size of the channel for transferring data between the agent and the proxy server.")
134132
flags.StringVar(&o.ServerLeaseSelector, "server-lease-selector", o.ServerLeaseSelector, "Providing a label selector enables updating the server count by counting the number of valid leases matching the selector.")
135-
flags.DurationVar(&o.InformerResync, "informer-resync", o.InformerResync, "Lease informer resync period in seconds")
136133
flags.StringVar(&o.KubeconfigPath, "kubeconfig", o.KubeconfigPath, "absolute path to the kubeconfig file")
137134
return flags
138135
}
@@ -267,7 +264,6 @@ func NewGrpcProxyAgentOptions() *GrpcProxyAgentOptions {
267264
SyncForever: false,
268265
XfrChannelSize: 150,
269266
ServerLeaseSelector: "",
270-
InformerResync: 10 * time.Second,
271267
KubeconfigPath: "",
272268
}
273269
return &o

pkg/agent/lease_counter.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func (lc *ServerLeaseCounter) Count(ctx context.Context) int {
5454
if err != nil {
5555
klog.Errorf("could not list leases to update server count, using fallback count (%v): %v", lc.fallbackCount, err)
5656

57-
apiStatus, ok := err.(apierrors.APIStatus)
58-
if ok || errors.As(err, &apiStatus) {
57+
var apiStatus apierrors.APIStatus
58+
if errors.As(err, &apiStatus) {
5959
status := apiStatus.Status()
6060
metrics.Metrics.ObserveLeaseList(int(status.Code), string(status.Reason))
6161
} else {
@@ -75,10 +75,6 @@ func (lc *ServerLeaseCounter) Count(ctx context.Context) int {
7575
}
7676
}
7777

78-
if count == 0 {
79-
return lc.fallbackCount
80-
}
81-
8278
if count != lc.fallbackCount {
8379
lc.fallbackCount = count
8480
}

0 commit comments

Comments
 (0)