I want to generate a unique identifier of a specific length and use this value across multiple pods internally. Since the length must be specific, and I'd prefer this to be handled internally rather than be adjustable by a user, I'd prefer to create the unique identifier on install/upgrade (only once if has not been set already) and not be changeable.
I want to use the identifiers internally as part of a naming schema for objects created within a specific deployment. I want to share these objects across other deployments, and need the identifier to determine if a given object belongs to a given deployment.
I was looking into setting a value in Secrets using randAlphaNum
. Some problems I face with using Secrets are:
Related to this issue: https://github.com/helm/helm/issues/3053 It looks like the Secret value will be overwritten on upgrade. There is an open PR for a possible fix: https://github.com/helm/helm/pull/5290 But I don't have the ability to upgrade helm/kubernetes atm
Secret value is b64 encoded. I want to pass the value as an environment variable to various pods decoded. It doesn't really matter if the user knows the unique identifier. So, maybe I don't need a Secret? But, again, I don't want the user to be able to edit the value and the value should never change for a given deployment.
Any help or suggestions are appreciated! Thanks
You may then try to use ConfigMap
instead. Seems it doesn't change on helm upgrade
. Then you can use this guide to pass the value from ConfigMap to the pods.