Azure / kubernetes-keyvault-flexvol

Azure keyvault integration with Kubernetes via a Flex Volume
MIT License
253 stars 83 forks source link

Better Error Output for Invalid Property Names #104

Open rudolphjacksonm opened 5 years ago

rudolphjacksonm commented 5 years ago

Describe the request It would be nice if the error output in the kv shell script validated all properties passed in the deployment spec before then trying to see if they contain anything. In my case, I tried creating a flex volume but misspelled tenantid as tentantid. The error I received was not that it was an incorrect property, but rather:

MountVolume.SetUp failed for volume "kv-volume" : mount command failed, status: Failure, reason: validation failed, tenantid is empty

It would be nice (but not at all required) if invalid property names, or ones that aren't recognized, are caught and fed back as an error.

Explain why Key Vault FlexVolume needs it In my case this took only a minute to find and resolve. This is much more of a nice-to-have than a requirement for this project. I would love it if I got an error back stating "Hey, we have no clue what tentantid is, you prat!" rather than it saying it was empty.

Describe the solution you'd like Some sort of validation for the properties provided in a template. In this case the tenantid was in fact empty, as there wasn't a tenantid anywhere in my template due to a spelling mistake. It would be handy if the kv script could detect properties that don't match anything valid and report back that an invalid property was specified, along with the property name. Something like:

MountVolume.SetUp failed for volume "kv-volume" : mount command failed, status: Failure, reason: validation failed, tentantid is not a valid property name

Describe alternatives you've considered

Additional context I realize this is probably a nightmare to do if we're using jq to parse the input, and them somehow validate all of the possible parameters. I'll have a think about it and see if I can come up with a way of doing this but right now all I can think of is changing the error output from stating it's empty to it's "empty or property is not present"

rudolphjacksonm commented 5 years ago

Also somewhat related #18