-
Notifications
You must be signed in to change notification settings - Fork 717
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 readiness probe #2272
Fix readiness probe #2272
Conversation
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.
Nice, I am 👍 One question about the probe failure reporting but nothing major. We are already mixing different log formats on stdout which whatever is ingesting these has to deal with.
# fail should be called as a last resort to help the user to understand why the probe failed | ||
function fail { | ||
timestamp=$(date --iso-8601=seconds) | ||
echo "{\"timestamp\": \"${timestamp}\", \"message\": \"readiness probe failed\", "$1"}" | tee /proc/1/fd/1 |
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.
That's clever :-) But should it be /fd/2
for stderr?
var downwardApiVolume = corev1.Volume{ | ||
Name: volume.DownwardApiVolumeName, | ||
VolumeSource: corev1.VolumeSource{ | ||
DownwardAPI: &corev1.DownwardAPIVolumeSource{ | ||
Items: []corev1.DownwardAPIVolumeFile{ | ||
{ | ||
Path: volume.LabelsFile, | ||
FieldRef: &corev1.ObjectFieldSelector{ | ||
FieldPath: "metadata.labels", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
var downwardApiVolumeMount = corev1.VolumeMount{ | ||
Name: volume.DownwardApiVolumeName, | ||
MountPath: volume.DownwardApiMountPath, | ||
ReadOnly: true, | ||
} |
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.
Nit: I feel like these don't need to be global variables (even though they're only package-private). Maybe they can be directly returned from the method calls of the DownwardApi
object?
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.
The idea here is to avoid to recreate what must be a constant everytime a Pod spec is created. I understand that it may sound like a very tiny optimization though 😐
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.
👍 I don't feel strongly about it. Happy to leave it as is.
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.
LGTM
fi | ||
|
||
# get Elasticsearch version from the downward API | ||
version=$(grep "elasticsearch.k8s.elastic.co/version" ${labels} | cut -d '=' -f 2) |
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.
Nit: could be safer to use the VersionLabelName
constant:
VersionLabelName = "elasticsearch.k8s.elastic.co/version" |
* Mount annotations in the Pod * Redirect errors to stderr
Fix #2248
This PR updates the readiness probe by: