If you need this at runtime for your application, another way is to generate the uuid in the entrypoint command:
Let's say your container runs "/usr/bin/myapp" on start up. You can change containers[0].command to be something like: env UUID=$(uuidgen) /usr/bin/myapp Of course that has drawbacks: - Processes you run via `oc exec` or `oc rsh` will not know about the variable (which might be an advantage depending on what you want) - You cannot inspect it from the Web Console or CLI, only if you add some plugs to your app or some hackish logging to the command above - perhaps others Rodolfo Carvalho | OpenShift On Tue, Oct 11, 2016 at 7:29 PM, Srinivas Naga Kotaru (skotaru) < [email protected]> wrote: > Hmm that might work but we need to modify templates, not sure all of > clients want this feature. Again this UUID should be unique to each pod. > > > > Also some pods might be created without using templates. > > > > Is there any other way?? > > > > -- > > *Srinivas Kotaru* > > > > *From: *Mateus Caruccio <[email protected]> > *Date: *Tuesday, October 11, 2016 at 10:19 AM > *To: *Srinivas Naga Kotaru <[email protected]> > *Cc: *dev <[email protected]> > *Subject: *Re: Container UUID > > > > Hi. > > > > You could use template parameters to generate a random value and use it > into your contiainer template. > > > > In you template.parameters: > > > > - description: My unique UUID > > name: UNIQUE_UUID > > generate: expression > > from: '[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}' > > > > And then in your DC: > > > > spec: > > template: > > spec: > > containers: > > - env: > > - name: UNIQUE_UUID > > value: '${UNIQUE_UUID}' > > > > > > Hope it helps. > > > > > -- > Mateus Caruccio / Master of Puppets > GetupCloud.com - Eliminamos a Gravidade > > > > On Tue, Oct 11, 2016 at 2:11 PM, Srinivas Naga Kotaru (skotaru) < > [email protected]> wrote: > > Hi > > > > Is there any way to put an environment variable which hold a unique UUID > value per pod basis? If we put an environment variable at dc or rc level, > same value propagating for all pods. That is expected behavior since all > pods are creating using same template definition > > > > If we add environment variable at pod level, its life time is limited. > > > > Example: Want to put an environment variable like below > > > > UUID = FCAC382C-0CEB-40E4-9654-07715CDC9DD8 > > > > This UUID is unique to each pod. > > > > > > -- > > *Srinivas Kotaru* > > > _______________________________________________ > dev mailing list > [email protected] > http://lists.openshift.redhat.com/openshiftmm/listinfo/dev > > > > _______________________________________________ > dev mailing list > [email protected] > http://lists.openshift.redhat.com/openshiftmm/listinfo/dev > >
_______________________________________________ dev mailing list [email protected] http://lists.openshift.redhat.com/openshiftmm/listinfo/dev
