1

I have application.properties with a list like so:

api.users[0].name=dsaass@fakeacc.com
api.users[0].password=123QWEasd
api.users[1].name=dsadsasa@fakeacc.com
api.users[1].password=123qweASD

Now I need a Kubernetes env var for production/dev/demo etc. My other variables are declared like this:

ftp.port=${FTP_PORT:22}

But how do I do it with a list?

Of course having users like this is not good practice and is temporary, just a proof of concept app.

Rafał Sz
  • 19
  • 4
  • (the answers for) [Environment variables for list in spring boot configuration](https://stackoverflow.com/q/55106571/592355) might be helpful.. – xerx593 Feb 27 '20 at 15:48
  • Also, you can try to mount configmap as file, check this [response](https://stackoverflow.com/questions/33415913/whats-the-best-way-to-share-mount-one-file-into-a-pod) and [this](https://kubernetes.io/docs/concepts/storage/volumes/#configmap). – Slava Bacherikov Feb 27 '20 at 16:03
  • Unfortunately I can not reconfigure the POD to use configMap :( – Rafał Sz Feb 28 '20 at 08:07
  • Why you can't use configmap? Do you have any restrictions? Your cluster is on local machine or cloud? – PjoterS Feb 28 '20 at 09:55
  • This is a cloud project, where many developers contribute. I can not make any changes to bitbucket-pipelines.yml – Rafał Sz Feb 28 '20 at 10:46
  • Could you please clarify, how it suppose to look like from inside the pod? It's not clear do you want to put all of them at the same time or use specific pair for each environment? – VAS Mar 03 '20 at 19:18
  • All of them at the same time. – Rafał Sz Mar 05 '20 at 15:57

1 Answers1

1

Use configMap and secrets (--from-file ) and mount it to volume to be read or read it as an environment variable.

https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/