Helm + Secrets + Env Vars

Hi everyone!

We have a small question regarding Env Vars in Octopus + helm charts. Which is the recommended way to actually handle this? We want to use the Octopus env variables together with our helm chart. Currently we have split this in 2 steps into our process:

  • 1 for creating the env vars secret
  • 2 for deploying the helm chart referring to that secret file; but there is a problem since this creates the issue of not cleaning previously deployed env secrets. We are wondering if there is a better way to do it.

This is how the raw value for our Deployment Env vars process looks like

apiVersion: v1
data:
#{each var in EnvVars}
  #{var}: "#{var.Value | ToBase64}"
#{/each}
kind: Secret
metadata:  
  name: services-heartbeat-env-#{Octopus.Deployment.Id | ToLower}
type: Opaque

Thanks!

Greetings @javier1, thanks for reaching out! I would like to make sure I have a clear understanding of what you’re trying to accomplish. If I may paraphrase, you have two steps in your process; the first step creates a secrets file and the next step in your deployment process uses this file for the Helm chart deployment. The issue that you are running into is that the secrets file(s) are not being cleaned up?

Regards,

Shawn