Skip to content

Commit

Permalink
allow to configure etcd server limit max-request-bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
pschulten authored and Quentin-M committed Nov 15, 2022
1 parent e152581 commit 32a8741
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/docker-testing/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ eco:
peer-client-cert-auth: false
auto-compaction-mode: periodic
auto-compaction-retention: "0"
max-request-bytes: 4194304
asg:
provider: docker
size: 3
Expand Down
1 change: 1 addition & 0 deletions pkg/etcd/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type EtcdConfiguration struct {
AutoCompactionRetention string `yaml:"auto-compaction-retention"`
InitACL *ACLConfig `yaml:"init-acl,omitempty"`
JWTAuthTokenConfig *JWTAuthTokenConfig `yaml:"jwt-auth-token-config,omitempty"`
MaxRequestBytes uint `yaml:"max-request-bytes,omitempty"`
}

type SecurityConfig struct {
Expand Down
4 changes: 4 additions & 0 deletions pkg/etcd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type ServerConfig struct {
UnhealthyMemberTTL time.Duration
AutoCompactionMode string
AutoCompactionRetention string
MaxRequestBytes uint

// Optional, used in {Seed, Join} to periodically save snapshots.
SnapshotProvider snapshot.Provider
Expand Down Expand Up @@ -356,6 +357,9 @@ func (c *Server) startServer(ctx context.Context) error {
c.cfg.JWTAuthTokenConfig.SignMethod,
c.cfg.JWTAuthTokenConfig.TTL)
}
if c.cfg.MaxRequestBytes != 0 {
etcdCfg.MaxRequestBytes = c.cfg.MaxRequestBytes
}

// Start the server.
c.server, err = embed.StartEtcd(etcdCfg)
Expand Down
5 changes: 3 additions & 2 deletions pkg/operator/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func fetchStatuses(httpClient *http.Client, etcdClient *etcd.Client, asgInstance
func fetchStatus(httpClient *http.Client, instance asg.Instance) (*status, error) {
var st = status{
instance: instance,
State: "UNKNOWN",
State: "UNKNOWN",
Revision: 0,
}

Expand All @@ -149,7 +149,7 @@ func serverConfig(cfg Config, asgSelf asg.Instance, snapshotProvider snapshot.Pr
DataQuota: cfg.Etcd.BackendQuota,
AutoCompactionMode: cfg.Etcd.AutoCompactionMode,
AutoCompactionRetention: cfg.Etcd.AutoCompactionRetention,
BindAddress: asgSelf.BindAddress(),
BindAddress: asgSelf.BindAddress(),
PublicAddress: stringOverride(asgSelf.Address(), cfg.Etcd.AdvertiseAddress),
PrivateAddress: asgSelf.Address(),
ClientSC: cfg.Etcd.ClientTransportSecurity,
Expand All @@ -159,6 +159,7 @@ func serverConfig(cfg Config, asgSelf asg.Instance, snapshotProvider snapshot.Pr
SnapshotInterval: cfg.Snapshot.Interval,
SnapshotTTL: cfg.Snapshot.TTL,
JWTAuthTokenConfig: cfg.Etcd.JWTAuthTokenConfig,
MaxRequestBytes: cfg.Etcd.MaxRequestBytes,
}
}

Expand Down

0 comments on commit 32a8741

Please sign in to comment.