Skip to content

Instantly share code, notes, and snippets.

@matthewpalmer
Created February 5, 2019 20:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save matthewpalmer/33016359f49c88acc12e86eda232f14a to your computer and use it in GitHub Desktop.
Save matthewpalmer/33016359f49c88acc12e86eda232f14a to your computer and use it in GitHub Desktop.
kind: ConfigMap
apiVersion: v1
metadata:
name: example-configmap
data:
# Configuration values can be set as key-value properties
database: mongodb
database_uri: mongodb://localhost:27017
# Or set as complete file contents (even JSON!)
keys: |
image.public.key=771
rsa.public.key=42
@coolzsatyen
Copy link

Hello Matthew, excellent article. I have a doubt on an approach.
I have an appsetting.json file which contains few array of object configurations like below:
... "Admin": [ { "AdminNumber": "J1YLihpUs=", "AdminKey": "123" }, { "AdminNumber": "LyU3gtB7HXZqKgy=", "AdminKey": "456" } ], ...

But tomorrow lets say, another AdminNumber & AdminKey is added in future as an requirement then I don't want to change in appsetting.json and then make code change and deploy. Rather make changes in YAML file at runtime during release pipeline.

So, can you suggest to use the same using YAML > ConfigMap. I have written below but this is breaking while building in pipelines.

apiVersion: v1 kind: ConfigMap metadata: name: admin-test data: Admin: - "AdminNumber": "J1YLihpUs=" "AdminKey": "123" - "AdminNumber": "LyU3gtB7HXZqKgy=" "AdminKey": "456" "Logging__LogLevel__Default": "Debug"

What is wrong in above YAML file ? Why can't I use Array of objects inside a "Type: Data" ? Or is there any better way ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment