kube-linter icon indicating copy to clipboard operation
kube-linter copied to clipboard

add match to envvar

Open siperman opened this issue 2 years ago • 6 comments

siperman avatar Aug 19 '21 10:08 siperman

use-case: Different teams need to check whether the format of environment variables is uniform. It is also necessary to check that the environment variable conforms to a regular expression.

eg: AppDynamics app name: ^WEALTH-(\w{2})-(\w{4})-[\w_]+-(DEV|UAT|PROD)$

siperman avatar Sep 28 '21 19:09 siperman

I understand that. But can't this be achieved under the status quo? How does this new parameter help?

viswajithiii avatar Sep 28 '21 19:09 viswajithiii

Because my test reverses the entire regular, it does not take effect. Remember that the reason for the search is that the golang regular library does not support inversion.

siperman avatar Sep 28 '21 20:09 siperman

Because my test reverses the entire regular, it does not take effect. Remember that the reason for the search is that the golang regular library does not support inversion.

Ohh I see. Yeah, we currently support this by allowing people to add a ! at the beginning, to signify negation. This is probably not as well-documented as it should be.

viswajithiii avatar Sep 28 '21 20:09 viswajithiii

@siperman You should be able to set the value in the check to !^WEALTH-(\w{2})-(\w{4})-[\w_]+-(DEV|UAT|PROD)$, and then I think it will do what you want?

viswajithiii avatar Sep 28 '21 20:09 viswajithiii

@siperman What's the status of this?

janisz avatar Mar 22 '22 15:03 janisz

Closing due to no activity on this. If you like to work on this please reopen or create a new PR.

janisz avatar Aug 29 '22 11:08 janisz