Improve PodTemplateSpec sanitizer for GKE Autopilot compatibility by Donnerbart · Pull Request #3012 · operator-framework/java-operator-sdk

Pull Request Overview

This PR improves the PodTemplateSpec sanitizer to handle GKE Autopilot environments, which automatically inject additional resource requirements like ephemeral-storage that may not be present in the desired state.

Key Changes:

  • Removed the resource map size equality check that prevented sanitization when actual and desired resources had different numbers of entries
  • Added test coverage for scenarios where additional resources (e.g., ephemeral-storage) are injected by external operators like GKE Autopilot
  • Updated test type parameters for better type safety

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
PodTemplateSpecSanitizer.java Removed size mismatch filter to allow sanitization when actual resources contain additional entries injected by the platform
PodTemplateSpecSanitizerTest.java Removed obsolete size mismatch test and added new tests covering GKE Autopilot scenarios with ephemeral-storage injection
SSABasedGenericKubernetesResourceMatcherTest.java Improved type safety by adding explicit generic type parameters to test classes and builders

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.