Skip to content

Commit

Permalink
document restarts on configmap/secret changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wr0ngway committed Aug 23, 2021
1 parent 5f6a924 commit d917455
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ To use them as files on disk in a pod:
Note that config map updates don't get seen by a running pod. You can use
something like [Reloader](https://github.com/stakater/Reloader) to automate
restarting the pod on a ConfigMap change, or read config from mounted volumes
for configmaps/secrets, which do get updated automatically in a running pod.
for configmaps/secrets, which do get updated automatically in a running pod. If
you are also [using kubetruth to deploy](examples/deployment), then you can make
your deployment manifest include a version string generated from a hash of the
parameters, thereby forcing a re-deploy when your config changes.

## Additional configuration

Expand Down
11 changes: 10 additions & 1 deletion examples/deployment/values-modular.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ projectMappings:
# Define an override project mapping to enable processing of a single project
# for this example. This will also gain the default `resource_templates` for
# generating configmap and secret resource, but if not desired, those can be
# skipped by setting them to an empty string.
# skipped by setting them to an empty string. In a real world scenario you
# would want to add the deployment templates in an override that matches
# multiple projects in order to share its behavior across those projects
deploytest:
scope: "override"
skip: false
Expand Down Expand Up @@ -53,6 +55,13 @@ projectMappings:
metadata:
labels:
app: "{{ parameters.app_name }}"
# Adding version labels here to demonstrate restart on a
# configmap change. An alternate method would be to make the
# configmap name based on the hash thereby forcing the restart
# whilst preserving the old configmap
#
parameters_version: "{{ parameters | sort | to_json | sha256 | slice: 0, 7 }}"
secrets_version: "{{ secrets | sort | to_json | sha256 | slice: 0, 7 }}"
spec:
containers:
- name: "{{ parameters.image_name }}"
Expand Down

0 comments on commit d917455

Please sign in to comment.