Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "reuse" randomly generated passwords in Helm and ArgoCD?

I'm using ArgoCD to manage my app deployments. My apps are Helm charts and I'm using "randAlphaNum" to generate a random password. Unfortunately a new password is generated each time I'm syncing my app. So I was trying to use something like this:

apiVersion: v1
kind: Secret
metadata:
  name: mypass
type: Opaque
stringData:
{{ if .Release.IsInstall }}
  pw: {{ randAlphaNum 32 | quote }}
{{ end }}

But when I check the "App Diff", I see that ArgoCD also updates the "pw". So I tried using the "lookup" function of Helm instead but I finally figured out that it's not supported by ArgoCD atm (see https://github.com/argoproj/argo-cd/issues/5202). So I wonder if there's any other solution I can use or if there's a list of supported Helm functions in ArgoCD?!

like image 228
Nrgyzer Avatar asked Oct 23 '25 14:10

Nrgyzer


1 Answers

Maybe an alternative way of generating passwords can help - try Kubernetes Secret Generator.

I've used this example to generate an auth secret for the chart bitnami/postgresql:

apiVersion: secretgenerator.mittwald.de/v1alpha1
kind: StringSecret
metadata:
  name: postgresql-auth-secret
spec:
  forceRegenerate: false
  fields:
    - fieldName: "password"
      encoding: "base64"
      length: "30"
    - fieldName: "postgres-password"
      encoding: "base64"
      length: "30"

It seems to work well with ArgoCD too.

like image 78
filiprafaj Avatar answered Oct 26 '25 23:10

filiprafaj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!