-
Notifications
You must be signed in to change notification settings - Fork 326
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 tls support and tests to connect-init command #459
add tls support and tests to connect-init command #459
Conversation
…ashicorp/consul-k8s into tproxy_add_tls_support_to_connect_init
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 work! Good catch on the generate certs duplication.
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.
Looks great 🎉 !! Thanks for adding these tests 🙏
t.Cleanup(func() { | ||
os.Remove(caFile.Name()) | ||
os.Remove(certFile.Name()) | ||
os.Remove(certKeyFile.Name()) |
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.
Great! I really like this pattern!
// CA certificate, server certificate, and server key. | ||
// Note that it's the responsibility of the caller to | ||
// remove the temporary files created by this function. | ||
func generateServerCerts(t *testing.T) (string, string, string, func()) { |
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 catch!
* add tls support and tests to connect-init command
* add tls support and tests to connect-init command
* add tls support and tests to connect-init command
Changes proposed in this PR:
connect-init/command_test.go
common.GenerateServerCerts
function to do it's own cleanup and propogate this to existing tests.The reason for this is that it helped to clean up my test so that I didn't have to generate server certs when TLS is disabled in the table test due to scoping of the cleanup func, as well as it generally cleans up existing code.
server-acl-init
test and convert it to the one in common.connect-init
already works with TLS so no actual code is changed. Inside ofconnect-inject/container_init.go
we are passing in the required ENV variables in the command template to enable it to be picked up by the consul client:How I've tested this PR:
Unit tests have been updated to enable TLS and pass.
Manually tested TLS enabled with a deployment.
How I expect reviewers to test this PR:
Unit tests have been updated to enable TLS and pass.
Manually tested TLS enabled with a deployment.
Checklist: