kubegres icon indicating copy to clipboard operation
kubegres copied to clipboard

Deploying a Kubegres resource with Kustomize does not replace referenced secrets correctly

Open williamkray opened this issue 3 years ago • 1 comments

I have a secret which I generate with Kustomize's secretGenerator like so:

namePrefix: jbmchin-
namespace: default
commonLabels:
  organization: jbmch.in

secretGenerator:
  - name: synapse-db-secrets
    envs:
      - secrets/database/db-credentials.env

when executing kustomize, it adds the prefix jbmchin- and adds a hash to the end, so the resulting secret is called jbmchin-synapse-db-secrets-hd4tmgb69b.

When I deploy the Kubegres resource with kustomize, it accepts the prefix properly, but attempts to reference the secret by its base-name (synapse-db-secrets) rather than its generated name. A secret of this base name does not exist, of course, and so the deployment of the postgresql nodes fails.

Should I be defining this field somewhere in my code, or does this need to be defined in the CRD somehow? I see a kustomizeconfig.yaml file in the crd directory of this repo but I can't seem to find any documentation on this filetype, and I don't think this is something I as a user should need to touch at this stage of the game.

Thanks!

williamkray avatar Jan 10 '22 00:01 williamkray

You need to create the relevant kustomize config yourself. See https://github.com/kubernetes-sigs/kustomize/blob/master/examples/transformerconfigs/README.md

lentzi90 avatar May 21 '23 07:05 lentzi90