[QUESTION] Environment variables in registry config files? #761
-
Is it possible to use environment variables in k3d and/or registry config files? We have a corporate docker registry that I'd like to use in my local k3d cluster, so I created a registries.yaml with the registry config. I'd like to put this file under version control, but in contains a username and password for this internal registry, so substituted these with environment variable references like this:
Unfortunately these references don't get resolved when I start my cluster. Am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @gyszalai, I've just tried setting environment variables in a k3d configuration file and it doesn't work. I looked at the code, environment variables are considered as normal values but, luckily, Viper has full support for them so we just need to implement that feature. @iwilltry42 I would create an issue from this discussion and reference this in a future PR, are you okay with that? Reference: Viper - Working with Environment Variables |
Beta Was this translation helpful? Give feedback.
-
Hi @gyszalai , thanks for opening this issue! |
Beta Was this translation helpful? Give feedback.
Hi @gyszalai , thanks for opening this issue!
A solution to this issue depends on how you use the registry config.
In general, that config is used by K3s and k3d doesn't touch it (apart from when it generates it in some use cases).
But, the k3d configuration file supports expanding environment variables as of k3d v5.0.0, so if you use the embedded registry config there, environment variables would be expanded.
Does that work for you?