Skip to content

Implement chunking for gzip encoder in deferredResponseWriter #130264

@serathius

Description

@serathius

What would you like to be added?

As pointed out in #129334 (comment) existing implementation of deferredResponseWriter assumes a single write when deciding whether gzip encoding is needed. We would extend writes to allow multiple calls to Write.

To support multiple calls to Write and still make an accurate decision about whether to enable gzip encoding, we will need to buffer the response until its size reach the gzip threshold defaultGzipThresholdBytes or Close is called. At that point we can flush the buffer as it's no longer needed.

As a prerequisite to this change we developed a test to validate the current chunking behavior in #130190. As part of this PR we want to flip expectGzip flag to true as part of "two small chunk writes" scenario. Context #130190 (comment)

Why is this needed?

Required to implement response streaming described in https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/5116-streaming-response-encoding#streaming-collections-and-gzip-encoding

Tracked in kubernetes/enhancements#5116

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions