I'm using ConfigMap to switch on/off some functionality of the application in the pod. I have mounted it in the deployment like that:
volumes:
- name: {{ .Chart.Name }}-config-volume
projected:
sources:
- configMap:
name: {{ .Chart.Name }}-content-config
then I have some configuration data in ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-content-config
data:
content.properties: |
{
"Enabled": false,
"ApiEndpoint": "..."
}
When the functionality is configured and ready to be enabled, I runkubectl edit cm and set "Enabled" to true. Application is reading file every 2 minutes and refreshing configuration respectively without restarting the pod. Ok, it's working, it's persisting through pod restarts.
But, if I'm doing helm upgrade to the next version - everything is reset and again has default values, e.g. "Enabled: false". Is there any way to make ConfigMap persistent no matter the upgrades?