tuenti / secrets-manager

A daemon to sync Vault secrets to Kubernetes secrets
Apache License 2.0
171 stars 26 forks source link

make vaultLogin method selection testable #73

Open fcrespofastly opened 3 years ago

fcrespofastly commented 3 years ago

We currently support appRole and kubernetes auth method to authenticate with Vault.

The main problem with kubernetes is that the serviceaccount token being present on the filesystem has to be read and it makes it hard to test. The way we've tested the kubernetes authentication method is by using an io.Reader that the vaultLogin method passes to the actual method.

This is a clean and frequently used approach to test pieces of code that depend on filesystem calls, but on the other hand it moves the problem to a different method vaultLogin which selects the authentication method.

This issue aims to open a discussion on how to tackle this moving forward.

Some ideas:

cc @eduardogr

eduardogr commented 3 years ago

Thanks for this @fcgravalos. Are you going to take care of this?