nginxinc / nginx-gateway-fabric

NGINX Gateway Fabric provides an implementation for the Gateway API using NGINX as the data plane.
Apache License 2.0
501 stars 97 forks source link

Use correct indentation in lifecyce examples #2588

Closed defrank closed 1 month ago

defrank commented 1 month ago

Proposed changes

Problem: The Helm chart example configuration for configuring lifecycle.preStop uses a misleading indentation that can confuse users.

Solution: Updated the Helm chart's README by fixing the indentation of the example code block to showcase the proper JSON paths of nginxGateway.lifecycle.preStop.exec.command and nginx.lifecycle.preStop.exec.command. The PreStop hook is described as having exec as a handler in https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution and https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/#define-poststart-and-prestop-handlers.

Testing:

Successfully deployed this chart into my cluster with the updated paths:

› kubectl -n nginx-gateway get pod -o json | jq '.items[].spec.containers[] | {name, lifecycle}'
{
  "name": "nginx-gateway",
  "lifecycle": {
    "preStop": {
      "exec": {
        "command": [
          "/usr/bin/gateway",
          "sleep",
          "--duration=30s"
        ]
      }
    }
  }
}
{
  "name": "nginx",
  "lifecycle": {
    "preStop": {
      "exec": {
        "command": [
          "/bin/sh",
          "-c",
          "/bin/sleep 30"
        ]
      }
    }
  }
}

make unit-test looks like everything passed except this single failure at the end:

PASS
coverage: 57.7% of statements
composite coverage: 93.6% of statements

Ginkgo ran 27 suites in 56.33843625s

There were failures detected in the following suites:
  static ./internal/mode/static

Test Suite Failed
exit status 1
gmake: *** [Makefile:196: unit-test] Error 1

Checklist

Release notes

Fix indentation in the Pod lifecycle example in README. Thanks to @defrank 
github-actions[bot] commented 1 month ago

✅ All required contributors have signed the F5 CLA for this PR. Thank you!
Posted by the CLA Assistant Lite bot.

defrank commented 1 month ago

I have hereby read the F5 CLA and agree to its terms

nginx-bot[bot] commented 1 month ago

Hi @defrank!

Thanks for opening this pull request! Be sure to check out our Contributing Guidelines while you wait for someone on the team to review this.

Please make sure to include the issue number in the PR description to automatically close the issue when the PR is merged. See Linking a pull request to an issue and our Pull Request Guidelines for more information.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.29%. Comparing base (56380b3) to head (aa21572). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2588 +/- ## ========================================== - Coverage 95.19% 89.29% -5.91% ========================================== Files 1 100 +99 Lines 229 7633 +7404 Branches 50 50 ========================================== + Hits 218 6816 +6598 - Misses 11 761 +750 - Partials 0 56 +56 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kate-osborn commented 1 month ago

I have hereby read the F5 CLA and agree to its terms

kate-osborn commented 1 month ago

recheck