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

Quieter HTTP 206 logging: #550

Merged
merged 21 commits into from
Nov 21, 2024

Commits on Nov 21, 2024

  1. Clean up and make logging quieter:

    Logging all 206 partial content requests from
    the middleware package creates a lot of messages
    per ISO request. This stops the middleware logger
    from logging anything and lets the ISO http func handler
    decide what to log. In the happy path case we only
    log that patching happened successfully.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    6614d89 View commit details
    Browse the repository at this point in the history
  2. Use an existing logger for sampling:

    This library allows for sampling log messages
    that match some certain criteria. I have not implemented
    this in Smee, but this could allow for sampling each
    unique mac address in the url path. This would be as
    opposed to having all traffic be sampled together.
    This needs tested to see if it's worth it. If it's
    not there are other ways to do the sampling in the same
    way without needing to import a library.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    bf7043d View commit details
    Browse the repository at this point in the history
  3. Update Tilt:

    Remove all old manifests and use Tilt to
    deploy the stack via Helm and rebuild Smee
    and deploy a new image on changes.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    fb92971 View commit details
    Browse the repository at this point in the history
  4. Get go.sum updated:

    There was a merge conflict and I removed
    needed go.sum lines. This adds them back.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    6e76e0f View commit details
    Browse the repository at this point in the history
  5. Use a basic percentage base sampling:

    The sampling import isn't needed for now.
    The most simple case of using a random number
    below a percentage will suffice for now.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    85d33bc View commit details
    Browse the repository at this point in the history
  6. Add missing import

    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    984e4ba View commit details
    Browse the repository at this point in the history
  7. Remove returning on 200 status codes:

    This is needed for clients that request the entire
    ISO in one request as opposed to the 206 partial
    content requests.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    b7a3db3 View commit details
    Browse the repository at this point in the history
  8. WIP: Add test for ISO patching:

    This creates a test ISO, patches it
    and validates the patch. I need to clean it
    up a bit though.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    99215d6 View commit details
    Browse the repository at this point in the history
  9. Use go-diskfs for ISO creation and reading:

    This library seems more maintained and allows
    for reading files in an ISO without having to mount
    it to the disk.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    36a66d9 View commit details
    Browse the repository at this point in the history
  10. Don't log in ISO patch test:

    This adds logging output to the test
    results and makes them more difficult to
    read.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    fb3d86d View commit details
    Browse the repository at this point in the history
  11. Clean up unused code:

    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    c1dfc8b View commit details
    Browse the repository at this point in the history
  12. Clean up go.mod and go.sum:

    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    d959b39 View commit details
    Browse the repository at this point in the history
  13. Add small ISO for testing:

    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    82aff58 View commit details
    Browse the repository at this point in the history
  14. Don't return error from randomPercentage:

    I was just ignoring the error, so an error
    is now just returned as 0.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    b657398 View commit details
    Browse the repository at this point in the history
  15. Fix test name:

    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    50d4f3a View commit details
    Browse the repository at this point in the history
  16. Get the grub.cfg contents from byte slice:

    This allows us to avoid having to write a
    file to disk in a unit test.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    608c5b3 View commit details
    Browse the repository at this point in the history
  17. WIP: Handle potentially dangerous range requests:

    This is a work in progress to handle ranges that
    could cause the patching to read into memory
    large chunk sizes. This could cause OOM killing
    and/or DOS the service.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    361c83d View commit details
    Browse the repository at this point in the history
  18. Update Tiltfile for faster iteration:

    The live update makes the development loop
    quite fast.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    4b18a16 View commit details
    Browse the repository at this point in the history
  19. Memory safety update:

    If the request is a partial content request,
    we need to validate the Content-Range header.
    Because we read the entire response body into
    memory for patching, we need to ensure that the
    Content-Range is within a reasonable size.
    For now, we are limiting the size to 500Kb.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    c6e17f7 View commit details
    Browse the repository at this point in the history
  20. Clean up Tiltfile:

    Remove reference to my local machine.
    
    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    24250a6 View commit details
    Browse the repository at this point in the history
  21. Remove logging in ISO test:

    Signed-off-by: Jacob Weinstock <[email protected]>
    jacobweinstock committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    edd662d View commit details
    Browse the repository at this point in the history