@@ -14,7 +14,6 @@ import (
1414 "path/filepath"
1515 "slices"
1616 "strings"
17- "time"
1817
1918 selfsignedcerts "github.com/nginx/agent/v3/pkg/tls"
2019 uuidLibrary "github.com/nginx/agent/v3/pkg/uuid"
@@ -101,7 +100,6 @@ func ResolveConfig() (*Config, error) {
101100 AllowedDirectories : allowedDirs ,
102101 Collector : collector ,
103102 Command : resolveCommand (),
104- Common : resolveCommon (),
105103 Watchers : resolveWatchers (),
106104 Features : viperInstance .GetStringSlice (FeaturesKey ),
107105 }
@@ -155,7 +153,6 @@ func registerFlags() {
155153 "collection or error monitoring" ,
156154 )
157155
158- fs .Duration (ClientTimeoutKey , time .Minute , "Client timeout" )
159156 fs .StringSlice (AllowedDirectoriesKey ,
160157 DefaultAllowedDirectories (),
161158 "A comma-separated list of paths that you want to grant NGINX Agent read/write access to" )
@@ -178,24 +175,6 @@ func registerFlags() {
178175 "How often the NGINX Agent will check for file changes." ,
179176 )
180177
181- fs .Int (
182- ClientMaxMessageSizeKey ,
183- DefMaxMessageSize ,
184- "The value used, if not 0, for both max_message_send_size and max_message_receive_size" ,
185- )
186-
187- fs .Int (
188- ClientMaxMessageReceiveSizeKey ,
189- DefMaxMessageRecieveSize ,
190- "Updates the client grpc setting MaxRecvMsgSize with the specific value in MB." ,
191- )
192-
193- fs .Int (
194- ClientMaxMessageSendSizeKey ,
195- DefMaxMessageSendSize ,
196- "Updates the client grpc setting MaxSendMsgSize with the specific value in MB." ,
197- )
198-
199178 fs .StringSlice (
200179 FeaturesKey ,
201180 DefaultFeatures (),
@@ -204,6 +183,7 @@ func registerFlags() {
204183
205184 registerCommandFlags (fs )
206185 registerCollectorFlags (fs )
186+ registerClientFlags (fs )
207187
208188 fs .SetNormalizeFunc (normalizeFunc )
209189
@@ -218,6 +198,76 @@ func registerFlags() {
218198 })
219199}
220200
201+ func registerClientFlags (fs * flag.FlagSet ) {
202+ // HTTP Flags
203+ fs .Duration (
204+ ClientHTTPTimeoutKey ,
205+ DefHTTPTimeout ,
206+ "The client HTTP Timeout, value in seconds" )
207+
208+ // Backoff Flags
209+ fs .Duration (
210+ ClientBackoffInitialIntervalKey ,
211+ DefBackoffInitialInterval ,
212+ "The client backoff initial interval, value in seconds" )
213+
214+ fs .Duration (
215+ ClientBackoffMaxIntervalKey ,
216+ DefBackoffMaxInterval ,
217+ "The client backoff max interval, value in seconds" )
218+
219+ fs .Duration (
220+ ClientBackoffMaxElapsedTimeKey ,
221+ DefBackoffMaxElapsedTime ,
222+ "The client backoff max elapsed time, value in seconds" )
223+
224+ fs .Float64 (
225+ ClientBackoffRandomizationFactorKey ,
226+ DefBackoffRandomizationFactor ,
227+ "The client backoff randomization factor, value float" )
228+
229+ fs .Float64 (
230+ ClientBackoffMultiplierKey ,
231+ DefBackoffMultiplier ,
232+ "The client backoff multiplier, value float" )
233+
234+ // GRPC Flags
235+ fs .Duration (
236+ ClientKeepAliveTimeoutKey ,
237+ DefGRPCKeepAliveTimeout ,
238+ "Updates the client grpc setting, KeepAlive Timeout with the specific value in seconds." ,
239+ )
240+
241+ fs .Duration (
242+ ClientKeepAliveTimeKey ,
243+ DefGRPCKeepAliveTime ,
244+ "Updates the client grpc setting, KeepAlive Time with the specific value in seconds." ,
245+ )
246+
247+ fs .Bool (
248+ ClientKeepAlivePermitWithoutStreamKey ,
249+ DefGRPCKeepAlivePermitWithoutStream ,
250+ "Update the client grpc setting, KeepAlive PermitWithoutStream value" )
251+
252+ fs .Int (
253+ ClientGRPCMaxMessageSizeKey ,
254+ DefMaxMessageSize ,
255+ "The value used, if not 0, for both max_message_send_size and max_message_receive_size" ,
256+ )
257+
258+ fs .Int (
259+ ClientGRPCMaxMessageReceiveSizeKey ,
260+ DefMaxMessageRecieveSize ,
261+ "Updates the client grpc setting MaxRecvMsgSize with the specific value in MB." ,
262+ )
263+
264+ fs .Int (
265+ ClientGRPCMaxMessageSendSizeKey ,
266+ DefMaxMessageSendSize ,
267+ "Updates the client grpc setting MaxSendMsgSize with the specific value in MB." ,
268+ )
269+ }
270+
221271func registerCommandFlags (fs * flag.FlagSet ) {
222272 fs .String (
223273 CommandServerHostKey ,
@@ -418,12 +468,26 @@ func resolveDataPlaneConfig() *DataPlaneConfig {
418468
419469func resolveClient () * Client {
420470 return & Client {
421- Timeout : viperInstance .GetDuration (ClientTimeoutKey ),
422- Time : viperInstance .GetDuration (ClientTimeKey ),
423- PermitWithoutStream : viperInstance .GetBool (ClientPermitWithoutStreamKey ),
424- MaxMessageSize : viperInstance .GetInt (ClientMaxMessageSizeKey ),
425- MaxMessageRecieveSize : viperInstance .GetInt (ClientMaxMessageReceiveSizeKey ),
426- MaxMessageSendSize : viperInstance .GetInt (ClientMaxMessageSendSizeKey ),
471+ HTTP : & HTTP {
472+ Timeout : viperInstance .GetDuration (ClientHTTPTimeoutKey ),
473+ },
474+ Grpc : & GRPC {
475+ KeepAlive : & KeepAlive {
476+ Timeout : viperInstance .GetDuration (ClientKeepAliveTimeoutKey ),
477+ Time : viperInstance .GetDuration (ClientKeepAliveTimeKey ),
478+ PermitWithoutStream : viperInstance .GetBool (ClientKeepAlivePermitWithoutStreamKey ),
479+ },
480+ MaxMessageSize : viperInstance .GetInt (ClientGRPCMaxMessageSizeKey ),
481+ MaxMessageReceiveSize : viperInstance .GetInt (ClientGRPCMaxMessageReceiveSizeKey ),
482+ MaxMessageSendSize : viperInstance .GetInt (ClientGRPCMaxMessageSendSizeKey ),
483+ },
484+ Backoff : & BackOff {
485+ InitialInterval : viperInstance .GetDuration (ClientBackoffInitialIntervalKey ),
486+ MaxInterval : viperInstance .GetDuration (ClientBackoffMaxIntervalKey ),
487+ MaxElapsedTime : viperInstance .GetDuration (ClientBackoffMaxElapsedTimeKey ),
488+ RandomizationFactor : viperInstance .GetFloat64 (ClientBackoffRandomizationFactorKey ),
489+ Multiplier : viperInstance .GetFloat64 (ClientBackoffMultiplierKey ),
490+ },
427491 }
428492}
429493
@@ -686,16 +750,6 @@ func arePrometheusExportTLSSettingsSet() bool {
686750 viperInstance .IsSet (CollectorPrometheusExporterTLSServerNameKey )
687751}
688752
689- func resolveCommon () * CommonSettings {
690- return & CommonSettings {
691- InitialInterval : DefBackoffInitialInterval ,
692- MaxInterval : DefBackoffMaxInterval ,
693- MaxElapsedTime : DefBackoffMaxElapsedTime ,
694- RandomizationFactor : DefBackoffRandomizationFactor ,
695- Multiplier : DefBackoffMultiplier ,
696- }
697- }
698-
699753func resolveWatchers () * Watchers {
700754 return & Watchers {
701755 InstanceWatcher : InstanceWatcher {
0 commit comments