Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate an additive JSON Patch instead of overwriting containers #175

Closed
wants to merge 1 commit into from

Commits on Feb 13, 2023

  1. Generate an additive JSON Patch instead of overwriting containers

    The problem in #165 is that the code is serializing the k8s.io structs as is, with an 'add' operation that effectively replaces the Container in the PodSpec. This works until fields are added, like grpc, at which point this webhook has to be updated, or it will drop the new fields.
    
    Instead of serializing the entire container struct, this uses jsonpatch to create a diff from the modifications, and generated a targeted patch that only adds and modifies the things it needs to. Unknown fields will not be dropped.
    
    I've not updated the test cases as they are hardcoded to expect a specific patch (that will drop unknown fields.) TBH, that approach needs to be rethought.
    iamnoah committed Feb 13, 2023
    Configuration menu
    Copy the full SHA
    e16c73f View commit details
    Browse the repository at this point in the history