provider-sql
provider-sql copied to clipboard
feat: add custom tls config support to mysql
Description of your changes
This PR adds support for custom TLS configuration to mysql implementation. In provider config file, if tls is set to custom, it reads custom TLS configuration from tlsConfig property, reading CA cert and client key/pair from K8s secret(s), and registering that config in mysql driver under the custom key.
Even though the mysql driver allows for multiple tls config key/value pairs, in the context of the provider it didn't appear to make sense to allow user to configure multiple TLS configurations and select only one of them, therefore the tlsConfig property is not a map, but rather a single config entry.
I have:
- [X] Read and followed Crossplane's [contribution process].
- [X] Run
make reviewableto ensure this PR is ready for review.
How has this code been tested
Because e2e tests require a totally different setup with a TLS-enabled mariaDB instance (but with same test cases), the current test script was duplicated and modified to add TLS, making sure that make test-integration runs both the no-tls and tls test scripts. It would be possible to refactor both scripts to combine them together and reduce duplication of setup and test code, however to the cost of readability. Let me know if that is a blocker and I will address it, I just didn't want to introduce more complexity in e2e test script until you confirm that's really what you prefer.