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 but before that we need to test it properly.
We would like to add a new test that tests only the deferredResponseWriter struct, and validates output of response and headers to confirm whether gzip encoding happen. We should have multiple scenarios with different sizes of input (around defaultGzipThresholdBytes) split between multiple writes (1 and 2 should be enough). Example cases:
- 1 write of size
defaultGzipThresholdBytes-1 -> should not be encoded
- 1 write of size
defaultGzipThresholdBytes -> should be encoded
- 2 writes each of size
defaultGzipThresholdBytes -1 -> should not be encoded. This will change after we implement chunking support.
- 2 writes each of size
defaultGzipThresholdBytes -> should be encoded
Please note this is a early PR blocking KEP planned for 1.33 (deadline in April), and there is much more work that needs to follow. If you want to pick up the issue please ensure you can implement it within short time (week).
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
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
Writebut before that we need to test it properly.We would like to add a new test that tests only the
deferredResponseWriterstruct, and validates output of response and headers to confirm whether gzip encoding happen. We should have multiple scenarios with different sizes of input (around defaultGzipThresholdBytes) split between multiple writes (1 and 2 should be enough). Example cases:defaultGzipThresholdBytes-1-> should not be encodeddefaultGzipThresholdBytes-> should be encodeddefaultGzipThresholdBytes -1-> should not be encoded. This will change after we implement chunking support.defaultGzipThresholdBytes-> should be encodedPlease note this is a early PR blocking KEP planned for 1.33 (deadline in April), and there is much more work that needs to follow. If you want to pick up the issue please ensure you can implement it within short time (week).
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