-
Notifications
You must be signed in to change notification settings - Fork 41
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 HTTP health server (closes #115) #227
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
I'm not sure if I did this the right way. We also might want more checks than I've implemented. |
Thanks @keeganwitt for submitting this. |
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
…k configs Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Error: can't load config: the Go language version (go1.22) used to build golangci-lint is lower than the targeted Go version (1.23.3) Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Co-authored-by: Faisal Memon <fymemon@yahoo.com> Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Co-authored-by: Faisal Memon <fymemon@yahoo.com> Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Co-authored-by: Faisal Memon <fymemon@yahoo.com> Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Co-authored-by: Faisal Memon <fymemon@yahoo.com> Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Co-authored-by: Faisal Memon <fymemon@yahoo.com> Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Co-authored-by: Faisal Memon <fymemon@yahoo.com> Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Co-authored-by: Faisal Memon <fymemon@yahoo.com> Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Do you think we should wrap the |
Not mandatory but I think that would make the output look a little nicer. |
I guess it already is an object, just doesn't have a top level key. So currently looks like {
"x509_write_success": true,
"jwt_write_successes": {
"a.jwt": true,
"b.jwt": false
}
} But we might want something like this, so then we could add future keys, like a hypothetical {
"write_successes": {
"x509_write_success": true,
"jwt_write_successes": {
"a.jwt": true,
"b.jwt": false
}
},
"socket_connection_failed": false
} |
Optionally, we can also wrap it at the top level: {
"health": {
"write_successes": {
"x509_write_success": true,
"jwt_write_successes": {
"a.jwt": true,
"b.jwt": false
}
},
"socket_connection_failed": false
}
} |
I'm wondering now if the health check should distinguish between "failed to write" and "not yet written". That distinction would be important for a readiness probe. |
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Signed-off-by: Keegan Witt <keeganwitt@gmail.com>
Here's what the output results look like when it first starts // live
{
"status": "OK",
"health": {
"file_write_statuses": {
"x509_write_status": "unwritten",
"jwt_write_status": {
"certs": "unwritten"
}
}
}
} // ready
{
"status": "Service Unavailable",
"health": {
"file_write_statuses": {
"x509_write_status": "unwritten",
"jwt_write_status": {
"certs": "unwritten"
}
}
}
} |
Maybe the status should be "ready/not ready" and "live/not live" instead of an HTTP status. Does that read easier? |
Hmm.... We may be crossing purposes too much? Most of the time the check I've seen is pretty simple. http return code and not much more. For details, they need to be readable as metrics so they can be collected over time, graphed, and alerted on. The formatting here looks more useful to humans then for machine processing. Not saying that is a bad thing, but maybe we're too focused on it where others skip it? |
sidecarConfig := config.NewSidecarConfig(hclConfig, log) | ||
spiffeSidecar := sidecar.New(sidecarConfig) |
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.
These two lines can go into startSidecar()
err = startSidecar(hclConfig, log, spiffeSidecar) | ||
if err != nil { |
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.
err = startSidecar(hclConfig, log, spiffeSidecar) | |
if err != nil { | |
if err = startSidecar(hclConfig, log, spiffeSidecar); err != nil { |
@keeganwitt Just two minor comments and then we're good to go. @kfox1111 Valid point. Lets merge this and see how it goes. Can always change the output to be more machine friendly. |
I was actually thinking of a human looking at this endpoint. Like if one of the probes fails, you can hit it with your browser and see why. I agree this doesn't replace the need for metrics. |
I mean, the current output is not directly machine understandable as, while its in a common format, the machine has no way of understanding what keys mean what. So, as is, its only directly understandable by a human. Someone could code something to make a monitoring system fully parse it and report on it, but that could be done also by just having proper metrics. |
fixes #115