-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Add support for user-defined healthchecks #22719
Changes from all commits
8aafd00
daecc43
b23f97a
ef330d1
d462386
7a34017
8f95b5a
89e1c79
7096a22
c5f6dc3
9c339ea
a4ec18f
33ffb3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,15 +22,16 @@ import ( | |
) | ||
|
||
var validCommitCommands = map[string]bool{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lose the bool type here and save some space: use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR does not change this code. If you want to clean up nearby code, I it think should be done in a separate PR. |
||
"cmd": true, | ||
"entrypoint": true, | ||
"env": true, | ||
"expose": true, | ||
"label": true, | ||
"onbuild": true, | ||
"user": true, | ||
"volume": true, | ||
"workdir": true, | ||
"cmd": true, | ||
"entrypoint": true, | ||
"healthcheck": true, | ||
"env": true, | ||
"expose": true, | ||
"label": true, | ||
"onbuild": true, | ||
"user": true, | ||
"volume": true, | ||
"workdir": true, | ||
} | ||
|
||
// BuiltinAllowedBuildArgs is list of built-in allowed build args | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM debian | ||
ADD check.sh main.sh /app/ | ||
CMD /app/main.sh | ||
HEALTHCHECK | ||
HEALTHCHECK --interval=5s --timeout=3s --retries=1 \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I think a good practice is multiple failures like 3 to tolerate random failures. Giving an example of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest we set default retries to 3. |
||
CMD /app/check.sh --quiet | ||
HEALTHCHECK CMD | ||
HEALTHCHECK CMD a b | ||
HEALTHCHECK --timeout=3s CMD ["foo"] | ||
HEALTHCHECK CONNECT TCP 7000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(from "debian") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disappointing that s-expressions have worked their way in. These should be table based tests but that seems to be out of scope of this review. |
||
(add "check.sh" "main.sh" "/app/") | ||
(cmd "/app/main.sh") | ||
(healthcheck) | ||
(healthcheck ["--interval=5s" "--timeout=3s" "--retries=1"] "CMD" "/app/check.sh --quiet") | ||
(healthcheck "CMD") | ||
(healthcheck "CMD" "a b") | ||
(healthcheck ["--timeout=3s"] "CMD" "foo") | ||
(healthcheck "CONNECT" "TCP 7000") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. If a healhcheck probe hangs, we need a way to kill it.