-
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Keegan Witt <[email protected]>
Signed-off-by: Keegan Witt <[email protected]>
…k configs Signed-off-by: Keegan Witt <[email protected]>
Signed-off-by: Keegan Witt <[email protected]>
Signed-off-by: Keegan Witt <[email protected]>
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 <[email protected]>
Co-authored-by: Faisal Memon <[email protected]> Signed-off-by: Keegan Witt <[email protected]>
Co-authored-by: Faisal Memon <[email protected]> Signed-off-by: Keegan Witt <[email protected]>
Signed-off-by: Keegan Witt <[email protected]>
"github.com/spiffe/spiffe-helper/pkg/sidecar" | ||
) | ||
|
||
func StartHealthServer(hclConfig *config.Config, log logrus.FieldLogger, sidecar *sidecar.Sidecar) error { |
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.
Rather than pass the full config here can we just take in the health check config? Can you create a Config
struct in this directory and have main populate and pass that in 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.
If we did, we'd also need to pass DaemonMode
as a separate argument.
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.
It can just be part of the same config struct
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.
So create a new HealthServerConfig struct?
Signed-off-by: Keegan Witt <[email protected]>
Signed-off-by: Keegan Witt <[email protected]>
Signed-off-by: Keegan Witt <[email protected]>
svidFile := path.Join(s.config.CertDir, s.config.SVIDFileName) | ||
svidKeyFile := path.Join(s.config.CertDir, s.config.SVIDKeyFileName) | ||
svidBundleFile := path.Join(s.config.CertDir, s.config.SVIDBundleFileName) | ||
if err := disk.WriteX509Context(svidResponse, s.config.AddIntermediatesToBundle, s.config.IncludeFederatedDomains, s.config.CertDir, s.config.SVIDFileName, s.config.SVIDKeyFileName, s.config.SVIDBundleFileName, s.config.CertFileMode, s.config.KeyFileMode); err != nil { | ||
s.config.Log.WithError(err).Error("Unable to dump bundle") | ||
s.fileWritesSuccess[svidFile] = false | ||
s.fileWritesSuccess[svidKeyFile] = false | ||
s.fileWritesSuccess[svidBundleFile] = false | ||
return | ||
} | ||
s.fileWritesSuccess[svidFile] = true | ||
s.fileWritesSuccess[svidKeyFile] = true | ||
s.fileWritesSuccess[svidBundleFile] = 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.
Everything here is either all true or all false. I think we can just consolidate to a single variable like x509WriteSuccess
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.
Are you proposing the JSON returned would no longer be a map of filenames to boolean, but instead something like
{
"x509WriteSuccess": true
"jwtWriteStatus": {
"file1.jwt": true,
"file2.jwt": false
}
}
?
fixes #115