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

play kube liveness HTTP probe does not use defaults #15855

Closed
piotr-sk opened this issue Sep 19, 2022 · 2 comments · Fixed by #15958 or #15968
Closed

play kube liveness HTTP probe does not use defaults #15855

piotr-sk opened this issue Sep 19, 2022 · 2 comments · Fixed by #15958 or #15968
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@piotr-sk
Copy link
Contributor

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

TLDR: when performing podman play kube with a pod containing a livenessProbe using HTTP get, the probe is not working as expected: the path is constructed without the Kubernetes defaults and if the URL is wrong the ExitCode is still 0.

The command construction shall take Kubernetes defaults into consideration:

  • scheme shall be set to http if tag not present
  • host shall be set to localhost if tag not present (note: with podman there is anyway only one node 😉)
  • in Kubernetes examples the path starts with a /, so this element shall NOT be present in the default URL to avoid having //

Finally when the URL is invalid and CURL returns an error, the probe shall fail, and this is not the case. See section of podman inspect:

{
      "Start": "2022-09-19T11:43:35.718677608+02:00",
      "End": "2022-09-19T11:43:35.791190049+02:00",
      "ExitCode": 0,
      "Output": "curl: (3) URL using bad/illegal format or missing URL"
}

Steps to reproduce the issue:

  1. Create liveness.yaml file:
apiVersion: v1
kind: Pod
metadata:
  labels:
    test: liveness
  name: liveness-http
spec:
  containers:
    - name: nginx
      image: nginx
      livenessProbe:
        httpGet:
          path: /
          port: 80
        initialDelaySeconds: 3
        periodSeconds: 3
  1. podman play kube liveness.yaml

  2. podman inspect -l | jq ".[].State.Health"

Describe the results you received:

{
  "Status": "starting",
  "FailingStreak": 0,
  "Log": [
    {
      "Start": "2022-09-19T11:43:35.718677608+02:00",
      "End": "2022-09-19T11:43:35.791190049+02:00",
      "ExitCode": 0,
      "Output": "curl: (3) URL using bad/illegal format or missing URL"
    },
...

Describe the results you expected:

When the YAML file is tweaked to:

apiVersion: v1
kind: Pod
metadata:
  labels:
    test: liveness
  name: liveness-http
spec:
  containers:
    - name: nginx
      image: nginx
      livenessProbe:
        httpGet:
          path:
          port: 80
          scheme: http
          host: localhost
        initialDelaySeconds: 3
        periodSeconds: 3

When that is played the result of podman inspect -l | jq ".[].State.Health" is:

{
  "Status": "healthy",
  "FailingStreak": 0,
  "Log": [
    {
      "Start": "2022-09-19T11:55:25.266111549+02:00",
      "End": "2022-09-19T11:55:25.378326409+02:00",
      "ExitCode": 0,
      "Output": "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\r100   615  100   615    0     0   300k      0 --:--:-- --:--:-- --:--:--  300k\n<!DOCTYPE html>\n<html>\n<head>\n<title>Welcome to nginx!</title>\n<style>\nhtml { color-scheme: light dark; }\nbody { width: 35em; margin: 0 auto;\nfont-family: Tahoma, Verdana, Arial, sans"
    }
  ]
}

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Client:       Podman Engine
Version:      4.2.1
API Version:  4.2.1
Go Version:   go1.18.1
Git Commit:   62b324ddf718411b1d4d0ba8117c632f7f984a38
Built:        Sun Sep 18 21:11:16 2022
OS/Arch:      linux/amd64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

No, but the affected code section looks the same on main, so I do not expect a different behavior.

Additional environment details (AWS, VirtualBox, physical, etc.):

VMware

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 19, 2022
@piotr-sk
Copy link
Contributor Author

Note: please review the issue and should you want support implementing the fix, I can work on a related PR.

@rhatdan
Copy link
Member

rhatdan commented Sep 19, 2022

@umohnani8 PTAL
Yes please open a PR to fix.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 14, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
2 participants