Refactored handler to use generics instead of "podController" wrapper type
Deduplicated Getter Types
Deduplicated Controller logic and entrypoints
Deduplicated Webhook entrypoints
Deduplicated Controller Tests (using generics)
Tests are now exactly the same for all three objects (there were slightly diverged before)
Deduplicated podTemplate in Test Data
Overall we lost about 1.2k lines of code. Also extending/maintaining controllers and controller tests became easier. Before you basically had to make the same change in three files each. That is now in one place. Only downside is that you have to deal with generic types in tests now.
Overall we lost about 1.2k lines of code. Also extending/maintaining controllers and controller tests became easier. Before you basically had to make the same change in three files each. That is now in one place. Only downside is that you have to deal with generic types in tests now.