Best Naming Style for ConfigMaps and Secrets?

0
3
Asked By CuriousCoder57 On

I'm working on a Bash script that incorporates environment variables from ConfigMaps and Secrets, and I'm wondering if I should standardize the naming conventions for these variables. Right now, my naming is a bit all over the place. For instance, I have variables from Secrets using camelCase and those from ConfigMaps in UPPER_SNAKE_CASE. Here's how it looks:

```bash
# secret - camelCase
export AWS_ACCESS_KEY_ID="${awsAccessKeyId:-}"
export AWS_SECRET_ACCESS_KEY="${awsSecretAccessKey:-}"
export RESTIC_PASSWORD="${resticPassword:-}"

# configmap - UPPER_SNAKE_CASE
export RESTIC_REPOSITORY="${RESTIC_REPOSITORY:-}"
```

Should I unify these styles for better clarity?

4 Answers

Answered By CloudNinja24 On

I actually have a convention where I only use Secrets for environment variables and keep ConfigMaps for mounted files. It simplifies things a lot for developers, as they often mix them otherwise. I find it easier to manage, especially when you have external secrets involved!

Answered By DevFriendly On

I also recommend keeping it consistent with UPPER_SNAKE_CASE. It makes everything look uniform, and it's easier for anyone else reading your code to understand. Plus, it looks more professional!

Answered By JustKeepItSimple On

Honestly, it doesn't matter as long as it works! But if you're looking for clarity and ease of use for others, standardizing makes sense.

Answered By EnvGuru99 On

It's generally a good idea to stick with a consistent naming style across your project. Using uppercase snake case for both Secrets and ConfigMaps can reduce confusion. You can import the environment variables directly from them without extra mapping, which simplifies your deployment configuration too.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.