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

fix(probes) allows overriding the default liveness/readiness probe with custom commands #1070

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Manan-Kothari
Copy link

@Manan-Kothari Manan-Kothari commented May 22, 2024

What this PR does / why we need it:

This allows folks to override the liveness/readiness probe with a custom exec/command instead of defaulting to the httpGet. Keeps the existing behavior as default so no breaking changes.

Which issue this PR fixes

Special notes for your reviewer:

example values with execGet

helm template . --values values.yaml

values.yaml

# readinessProbe for Kong pods
# replace httpGet with exec if you want to use a custom command
readinessProbe:
  exec:
    command:
      - python3.10
      - /home/kong/scripts/readiness_probe.py
  initialDelaySeconds: 5
  timeoutSeconds: 5
  periodSeconds: 10
  successThreshold: 1
  failureThreshold: 3

# livenessProbe for Kong pods
# replace httpGet with exec if you want to use a custom command
livenessProbe:
  exec:
    command:
      - python3.10
      - /home/kong/scripts/readiness_probe.py
  initialDelaySeconds: 5
  timeoutSeconds: 5
  periodSeconds: 10
  successThreshold: 1
  failureThreshold: 3

rendered out manifest

        readinessProbe:
          exec:
          command:
          - python3.10
          - /home/kong/scripts/readiness_probe.py
          initialDelaySeconds: 5
          timeoutSeconds: 5
          periodSeconds: 10
          successThreshold: 1
          failureThreshold: 3
        livenessProbe:
          exec:
          command:
          - python3.10
          - /home/kong/scripts/readiness_probe.py
          initialDelaySeconds: 5
          timeoutSeconds: 5
          periodSeconds: 10
          successThreshold: 1
          failureThreshold: 3

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • PR is based off the current tip of the main branch.
  • Changes are documented under the "Unreleased" header in CHANGELOG.md
  • New or modified sections of values.yaml are documented in the README.md
  • Commits follow the Kong commit message guidelines

@Manan-Kothari Manan-Kothari requested a review from a team as a code owner May 22, 2024 18:12
@CLAassistant
Copy link

CLAassistant commented May 22, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@pmalek pmalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Do you mind adding a CI values.yaml that could test this? You can add this in here: https://github.com/Kong/charts/tree/main/charts/kong/ci

@Manan-Kothari
Copy link
Author

Thanks for the PR. Do you mind adding a CI values.yaml that could test this? You can add this in here: https://github.com/Kong/charts/tree/main/charts/kong/ci

Updated tests, and also updated PR description with the example rendered manifest.

Copy link
Member

@pmalek pmalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at linter errors in charts/kong/ci/probe-test-values.yaml

@@ -823,6 +823,7 @@ resources: {}
# memory: 2G

# readinessProbe for Kong pods
# replace httpGet with exec if you want to use a custom command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please specify in the comments here an exemplary use case for exec? So that potential users know how exactly this can be used? I'm thinking something that could simply be uncommented to work ( assuming that httpGet section gets commented ). WDYT?

Comment on lines +297 to +301
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about making this into a small helm template which could be reused for both liveness and readiness probe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate handler when overriding readiness/liveness probes
3 participants