Skip to content

fix(libkapi): raise Kine gRPC keepalive MinTime to stop GOAWAY(ENHANCE_YOUR_CALM) - #459

Draft
Nicklas Frahm (nicklasfrahm) wants to merge 1 commit into
mainfrom
claude/kommodity-458-fix-1f2064
Draft

Nicklas Frahm (nicklasfrahm) wants to merge 1 commit into
mainfrom
claude/kommodity-458-fix-1f2064

Conversation

@nicklasfrahm

Copy link
Copy Markdown
Contributor

Summary

Fixes #458.

startKine (pkg/libkapi/storage/kine.go) now builds and passes its own *grpc.Server via endpoint.Config.GRPCServer, with KeepaliveEnforcementPolicy.MinTime raised from etcd's embed.DefaultGRPCKeepAliveMinTime (5s) to 30s.

Why: Kine's default gRPC server uses etcd's 5s MinTime, sized for a multi-tenant etcd server fielding pings from many independent, potentially untrusted clients. The embedded apiserver opens one etcd3 clientv3.Client per API group, all dialing the same local Kine unix socket. Each connection's grpc-go transport sends automatic BDP (bandwidth-delay-product) pings on its own schedule as it receives stream data (e.g. watch events) — these aren't user-configured keepalives and aren't tunable via storagebackend.Config. During storage initialization, this ping traffic trips the 5s enforcement window on legitimate, trusted (same-process, local-socket-only) connections, and Kine's server sends GOAWAY(ENHANCE_YOUR_CALM, "too_many_pings"), logged at ERROR by libkapi/logging.InstallGRPCLogAdapter and causing repeated connection churn (self-healing via reconnect, but noisy).

This is candidate fix (4) from the issue — the lowest-blast-radius, fully self-contained mitigation available at the libkapi layer. Candidates (1) and (2) (sharing/pooling etcd3 client connections, or disabling client-side BDP estimation) would require changes to k8s.io/apiserver's storage factory or its etcd3 client construction, which storagebackend.Config does not expose today.

Test plan

  • make lint — 0 issues
  • make test — all packages pass, including new TestStartKinePassesTunedGRPCServer asserting startKine wires a non-nil Config.GRPCServer
  • make build — builds successfully
  • make build-image — Docker image builds successfully

🤖 Generated with Claude Code

…E_YOUR_CALM) [kommodity#458]

startKine now hands endpoint.Listen a pre-built Config.GRPCServer with
KeepaliveEnforcementPolicy.MinTime raised from etcd's embed default (5s,
sized for a multi-tenant server) to 30s. The apiserver opens one etcd3
client per API group against the same local unix socket, and grpc-go's
automatic BDP pings from those connections were tripping the 5s window
during storage init, producing a GOAWAY(ENHANCE_YOUR_CALM, "too_many_pings")
ERROR log and connection churn.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Go test coverage: 21.8% for commit 0d5cb0f
⚠️ 43 of 56 packages have zero coverage.
  • github.com/kommodity-io/kommodity/cmd/kommodity
  • github.com/kommodity-io/kommodity/pkg/attestation
  • github.com/kommodity-io/kommodity/pkg/attestation/rest
  • github.com/kommodity-io/kommodity/pkg/attestation/rest/nonce
  • github.com/kommodity-io/kommodity/pkg/attestation/rest/report
  • github.com/kommodity-io/kommodity/pkg/attestation/rest/trust
  • github.com/kommodity-io/kommodity/pkg/combinedserver
  • github.com/kommodity-io/kommodity/pkg/config
  • github.com/kommodity-io/kommodity/pkg/controller/index
  • github.com/kommodity-io/kommodity/pkg/controller/webhook
  • github.com/kommodity-io/kommodity/pkg/kine
  • github.com/kommodity-io/kommodity/pkg/logging/example
  • github.com/kommodity-io/kommodity/pkg/metadata
  • github.com/kommodity-io/kommodity/pkg/metadata/rest/userdata
  • github.com/kommodity-io/kommodity/pkg/net
  • github.com/kommodity-io/kommodity/pkg/openapi
  • github.com/kommodity-io/kommodity/pkg/openapi/admissionregistration
  • github.com/kommodity-io/kommodity/pkg/openapi/apiextensions
  • github.com/kommodity-io/kommodity/pkg/openapi/apiregistration
  • github.com/kommodity-io/kommodity/pkg/openapi/audit
  • github.com/kommodity-io/kommodity/pkg/openapi/authorization
  • github.com/kommodity-io/kommodity/pkg/openapi/core
  • github.com/kommodity-io/kommodity/pkg/openapi/intstr
  • github.com/kommodity-io/kommodity/pkg/openapi/meta
  • github.com/kommodity-io/kommodity/pkg/openapi/rbac
  • github.com/kommodity-io/kommodity/pkg/openapi/runtime
  • github.com/kommodity-io/kommodity/pkg/openapi/storage
  • github.com/kommodity-io/kommodity/pkg/openapi/version
  • github.com/kommodity-io/kommodity/pkg/provider
  • github.com/kommodity-io/kommodity/pkg/storage
  • github.com/kommodity-io/kommodity/pkg/storage/configmaps
  • github.com/kommodity-io/kommodity/pkg/storage/endpoints
  • github.com/kommodity-io/kommodity/pkg/storage/events
  • github.com/kommodity-io/kommodity/pkg/storage/namespaces
  • github.com/kommodity-io/kommodity/pkg/storage/rbac
  • github.com/kommodity-io/kommodity/pkg/storage/secrets
  • github.com/kommodity-io/kommodity/pkg/storage/selfsubjectaccessreviews
  • github.com/kommodity-io/kommodity/pkg/storage/serviceaccount
  • github.com/kommodity-io/kommodity/pkg/storage/services
  • github.com/kommodity-io/kommodity/pkg/storage/storage
  • github.com/kommodity-io/kommodity/pkg/storage/webhookconfigurations
  • github.com/kommodity-io/kommodity/pkg/ui
  • github.com/kommodity-io/kommodity/pkg/ui/api
View coverage for all packages
# Package Name                                                           | Coverage
- github.com/kommodity-io/kommodity/cmd/kommodity                        |     0.0%
- github.com/kommodity-io/kommodity/pkg/attestation                      |     0.0%
- github.com/kommodity-io/kommodity/pkg/attestation/rest                 |     0.0%
- github.com/kommodity-io/kommodity/pkg/attestation/rest/nonce           |     0.0%
- github.com/kommodity-io/kommodity/pkg/attestation/rest/report          |     0.0%
- github.com/kommodity-io/kommodity/pkg/attestation/rest/trust           |     0.0%
- github.com/kommodity-io/kommodity/pkg/combinedserver                   |     0.0%
- github.com/kommodity-io/kommodity/pkg/config                           |     0.0%
+ github.com/kommodity-io/kommodity/pkg/controller                       |    17.2%
- github.com/kommodity-io/kommodity/pkg/controller/index                 |     0.0%
+ github.com/kommodity-io/kommodity/pkg/controller/reconciler            |    12.6%
+ github.com/kommodity-io/kommodity/pkg/controller/reconciler/azurearm   |    31.4%
- github.com/kommodity-io/kommodity/pkg/controller/webhook               |     0.0%
- github.com/kommodity-io/kommodity/pkg/kine                             |     0.0%
+ github.com/kommodity-io/kommodity/pkg/kms                              |    41.8%
+ github.com/kommodity-io/kommodity/pkg/libkapi                          |    71.7%
+ github.com/kommodity-io/kommodity/pkg/libkapi/apiserver                |    83.8%
+ github.com/kommodity-io/kommodity/pkg/libkapi/auth                     |    78.4%
+ github.com/kommodity-io/kommodity/pkg/libkapi/controllers              |    27.5%
+ github.com/kommodity-io/kommodity/pkg/libkapi/logging                  |    94.0%
+ github.com/kommodity-io/kommodity/pkg/libkapi/storage                  |    71.6%
+ github.com/kommodity-io/kommodity/pkg/logging                          |    75.0%
- github.com/kommodity-io/kommodity/pkg/logging/example                  |     0.0%
- github.com/kommodity-io/kommodity/pkg/metadata                         |     0.0%
- github.com/kommodity-io/kommodity/pkg/metadata/rest/userdata           |     0.0%
- github.com/kommodity-io/kommodity/pkg/net                              |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi                          |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/admissionregistration    |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/apiextensions            |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/apiregistration          |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/audit                    |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/authorization            |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/core                     |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/intstr                   |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/meta                     |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/rbac                     |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/runtime                  |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/storage                  |     0.0%
- github.com/kommodity-io/kommodity/pkg/openapi/version                  |     0.0%
- github.com/kommodity-io/kommodity/pkg/provider                         |     0.0%
+ github.com/kommodity-io/kommodity/pkg/server                           |     5.4%
- github.com/kommodity-io/kommodity/pkg/storage                          |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/configmaps               |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/endpoints                |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/events                   |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/namespaces               |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/rbac                     |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/secrets                  |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/selfsubjectaccessreviews |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/serviceaccount           |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/services                 |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/storage                  |     0.0%
- github.com/kommodity-io/kommodity/pkg/storage/webhookconfigurations    |     0.0%
+ github.com/kommodity-io/kommodity/pkg/talosproxy                       |    72.2%
- github.com/kommodity-io/kommodity/pkg/ui                               |     0.0%
- github.com/kommodity-io/kommodity/pkg/ui/api                           |     0.0%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embedded Kine gRPC server hits GOAWAY(ENHANCE_YOUR_CALM, too_many_pings) under normal apiserver storage init

1 participant