We are in need of the deploy container feature to allow us to choose to use the configmap created as part of this step when adding configmap environment variables during the k8s deploy container step. Currently, the configmap created as part of this step has version appended to the configmap name. Which makes it impossible to map environment variables from it. We need the ability to pick individually which keys from the configmap to add as environment variables and be able to just add all of them as environment variables very similar to the way envfrom works Example:
We need this because it is very important that we use the deployContainer step to deploy the CM needed by the application because this step auto-versions them. Without this ability we would have to create the CM in a separate step. Which then if a deployment fails on the pod step but the configmaps have been updated then it can affect the older, running pods. So you canât guarantee that the old ones will keep running if they need to be restarted since the configmap could have changed.
**UPDATE If we could also get the same abilities for Secret Environment Variables too. Same problem exist where there is no option to choose âSecret created as part of this stepâ
Thanks for getting in touch and great question. Iâm happy to report that there is a solution for this which was unfortunately undocumented. In this scenario, you can use the following variables to obtain the correct computed config map/secret values.
#{Octopus.Action.KubernetesContainers.ComputedConfigMapName}
and #{Octopus.Action.KubernetesContainers.ComputedSecretName}
These variables go in the âNameâ field for each appropriate section.
Thank you for your quick response. That is awesome I will try that out.
Is there a way to have all of the values in CM and/or Secret mapped to environment variables without having to specify every one? Very similar to the way envFrom works in code snippet above?
Thanks for the reply. Unfortunately, Octopus doesnât currently support that behaviour but our team agrees it would be helpful and weâll consider adding it.
Hi would like to create a configmap for container environment variables by using Octopus tenant variables. Is this possible? I need to use 20+ variables, which is quite tedious to configure in the configmap step.
Thanks for getting in touch! The easiest way to configure this is in the Ingress TLS field of your Kubernetes step as highlighted below.
Note that this field was introduced in 2018.11.2 as it was previously not exposed by the UI. If youâre running a version prior to this, you can still deploy the certificate in the built-in Ingress Resource step (or the Deploy Kubernetes Containers step) as an Ingress Annotation where the value is the certificate variable.
I hope this helps get you going! Donât hesitate to reach out if we can assist in anything else.