envoy-control icon indicating copy to clipboard operation
envoy-control copied to clipboard

Migrate deprecated Envoy v2 gzip compression API to v3

Open Copilot opened this issue 6 months ago • 0 comments

Summary

This PR migrates the last remaining usage of deprecated Envoy v2 API to the modern v3 API in the compression filter factory.

Problem

The codebase was still using a deprecated v2 import for gzip compression level constants:

import io.envoyproxy.envoy.config.filter.http.gzip.v2.Gzip.CompressionLevel.Enum.BEST_VALUE

This usage was in the fallback case when compression quality configuration is not provided:

val compressionLevel = Gzip.CompressionLevel.forNumber(
    group.compressionConfig.gzip?.quality
        ?: properties.compression.gzip.quality
) ?: Gzip.CompressionLevel.forNumber(BEST_VALUE)  // v2 API usage

Solution

Updated the code to use the v3 API equivalent:

val compressionLevel = Gzip.CompressionLevel.forNumber(
    group.compressionConfig.gzip?.quality
        ?: properties.compression.gzip.quality
) ?: Gzip.CompressionLevel.BEST_SPEED  // v3 API usage

The migration maintains identical behavior since both v2.BEST_VALUE and v3.BEST_SPEED have the same numeric value (1), representing the fastest compression level.

Changes

  • Removed: Deprecated v2 import io.envoyproxy.envoy.config.filter.http.gzip.v2.Gzip.CompressionLevel.Enum.BEST_VALUE
  • Updated: Fallback compression level to use Gzip.CompressionLevel.BEST_SPEED directly

Verification

  • ✅ All existing tests pass
  • ✅ Full project builds successfully without deprecation warnings
  • ✅ Comprehensive scan confirms no other v2 API usage remains
  • ✅ Backward compatibility maintained (same numeric values)

The codebase now exclusively uses modern Envoy v3 APIs with no deprecated dependencies.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Aug 20 '25 12:08 Copilot