KIP-546 — Client-quota admin APIs
Status: implemented — back to the KIP index.
What the KIP changes in Apache Kafka
Kafka 2.6 added DescribeClientQuotas (key 48) and AlterClientQuotas
(key 49): a unified admin surface over quota entities — user,
client-id, ip, and their <default> variants — replacing direct
ZooKeeper writes from kafka-configs.sh. Filters support exact-match,
any, and default-entity components.
How kaas implements it
Both handlers (crates/kaas-broker/src/handlers/describe_client_quotas.rs
and alter_client_quotas.rs, keys 48/49, v0–v1, flexible from v1) wrap
the QuotaEnforcer in crates/kaas-auth/src/quota.rs — the same
debt-carrying token bucket that throttles Produce/Fetch
(KIP-13).
- Entity model: the
useraxis only.client-id/ipcomponents return an empty result on describe andINVALID_REQUEST(42) on alter.match_type=DEFAULT(--entity-default) is unsupported — kaas users are CR-instantiated, there is no<default>entity. - Describe resolves override > store > none: a runtime override wins,
otherwise the store-backed value from
credentials.json(materialised by the operator fromKafkaUser.spec.quotas). Exact-match and list-all-users both work. - Alter merges ops per key onto the user's current quotas (Apache
semantics: SET replaces one key, remove drops one key, unspecified keys
survive) and installs the result via
set_user_quota, live-updating any existing token bucket. Known keys:producer_byte_rate,consumer_byte_rate,request_percentage; anything else answersINVALID_CONFIG(40).validate_onlyskips the install. - Alterations are runtime-only and per-broker. The override lives in
the enforcer's in-memory map: it does not survive a broker restart and
is not broadcast to peer brokers. The durable, cluster-wide path is
KafkaUser.spec.quotas(producerMaxByteRatePerBroker/consumerMaxByteRatePerBroker— named for the per-broker semantics, see Listeners & auth). request_percentageround-trips but is not enforced — only the byte-rate keys are wired into the bucket (apply_quotasreads just producer/consumer rates). Authorization follows Apache's mapping: describe →DescribeConfigs, alter →AlterConfigs, both on the cluster resource.
How it's verified
crates/kaas-auth/src/quota.rsunit tests:set_user_quota_live_updates_existing_bucket,describe_user_quota_resolution_order(override > store precedence).crates/kaas-codec/src/api/alter_client_quotas.rsanddescribe_client_quotas.rsround-trip tests cover both versions.scripts/kafka-configs.shscenarios 6–10 run quota CRUD plus a live 10 MB/s throttle probe through the realkafka-configs.shtool. (Their labels still say XFAIL from before the quota engine landed — stale labels, the scenarios exercise the implemented path.)
See also the DescribeClientQuotas and AlterClientQuotas entries.