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

Use correct indentation in lifecyce examples #2588

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

dysfungi
Copy link
Contributor

@dysfungi dysfungi commented Sep 21, 2024

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
  • make lint
  • make lint-helm
  • make generate-all
  • kubectl -n nginx-gateway exec deployment/gateway-nginx-gateway-fabric -c nginx -- nginx -T

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

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

Fix indentation in the Pod lifecycle example in README. Thanks to @defrank 

@github-actions github-actions bot added bug Something isn't working documentation Improvements or additions to documentation helm-chart Relates to helm chart labels Sep 21, 2024
@dysfungi dysfungi force-pushed the fix/chart-lifecycle-value-examples branch from f89105d to bda9581 Compare September 21, 2024 19:33
Copy link
Contributor

github-actions bot commented Sep 21, 2024

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

@dysfungi
Copy link
Contributor Author

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

@dysfungi dysfungi marked this pull request as ready for review September 21, 2024 20:18
@dysfungi dysfungi requested a review from a team as a code owner September 21, 2024 20:18
Copy link

nginx-bot bot commented Sep 23, 2024

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.

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kate-osborn
Copy link
Contributor

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

@kate-osborn
Copy link
Contributor

recheck

@lucacome lucacome changed the title fix(chart-readme): Use correct indentation in lifecyce examples Use correct indentation in lifecyce examples Sep 24, 2024
@kate-osborn kate-osborn merged commit dc3a925 into nginx:main Sep 24, 2024
45 checks passed
@kate-osborn kate-osborn removed bug Something isn't working helm-chart Relates to helm chart labels Sep 24, 2024
@dysfungi dysfungi deleted the fix/chart-lifecycle-value-examples branch September 24, 2024 19:58
miledxz added a commit to miledxz/nginx-gateway-fabric that referenced this pull request Jan 14, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community documentation Improvements or additions to documentation release-notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants