Skip to content

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

Open
Manan-Kothari wants to merge 5 commits into
Kong:mainfrom
Manan-Kothari:liveness-readiness-probe-fix
Open

fix(probes) allows overriding the default liveness/readiness probe with custom commands#1070
Manan-Kothari wants to merge 5 commits into
Kong:mainfrom
Manan-Kothari:liveness-readiness-probe-fix

Conversation

@Manan-Kothari

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

Copy link
Copy Markdown

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

CLAassistant commented May 22, 2024

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@pmalek pmalek left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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.

@pmalek pmalek left a comment

Copy link
Copy Markdown
Member

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

Comment thread charts/kong/values.yaml
# memory: 2G

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

Copy link
Copy Markdown
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
Copy Markdown
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