puppetlabs / puppetserver-helm-chart

The Helm Chart for Puppet Server
Apache License 2.0
52 stars 56 forks source link

Invalid Puppet DB Deployment #215

Closed jlact closed 6 months ago

jlact commented 7 months ago

Describe the Bug

This is invalid, you can't have 2 volumes with the same name. The Puppet DB deployment fails to deploy if custom config is used.

https://github.com/puppetlabs/puppetserver-helm-chart/blob/2665f8364b1bbf6d1a4b9b5ebbafc05207eff182/templates/puppetdb-deployment.yaml#L350-L359

Expected Behavior

The item prefixed with the release name should remain, the other references an older config map name format which is not deployed in the current chart version. Removing the extra reference via a kustomize patch results in successful deployment.

Steps to Reproduce

Steps to reproduce the behavior:

  1. render chart with custom config defined via values for puppet db. e.g. when using external DB
    puppetdb:
    customconfigs:
    enabled: true
    configmaps:
      database.conf: |-
        database: {
          subname: "//"${PUPPETDB_POSTGRES_HOSTNAME}":"${PUPPETDB_POSTGRES_PORT}"/"${PUPPETDB_POSTGRES_DATABASE}
          username: puppetdb
          migrator-username: puppetdb
          connection-username: ${PUPPETDB_USER}
          connection-migrator-username: ${PUPPETDB_USER}
          password: ${PUPPETDB_PASSWORD}
          node-ttl: ${PUPPETDB_NODE_TTL}
          node-purge-ttl: ${PUPPETDB_NODE_PURGE_TTL}
          report-ttl: ${PUPPETDB_REPORT_TTL}
        }
  2. attempt to deploy it
    one or more objects failed to apply, reason: Deployment.apps "puppetserver-puppetdb" is invalid: spec.template.spec.volumes[2].name: Duplicate value: "puppetdb-custom-configs".

    Environment

    All

Xtigyro commented 7 months ago

@jlact Thanks for the bug report! This Helm chart is 100% community maintained.

Please feel free to submit our way a PR.

FYI: @ldaneliukas @davidphay

anthonysomerset commented 6 months ago

i hit this bug and have worked out the fix - will craft a PR for this shortly

anthonysomerset commented 6 months ago

FYI the custom config isn't needed if you want to use an external DB - just set the PUPPETDB_POSTGRES_HOSTNAME in the extraEnv config

i needed it however because i wanted to add a custom fact blocklist

e.g.

puppetdb:
  tag: 7.18.0-v1.5.0
  extraEnv:
    PUPPETDB_POSTGRES_HOSTNAME: dbhostname.postgres.database.azure.com
  customconfigs:
    enabled: true
    configmaps:
      database.conf: |-
        database: {
          subname: "//"${PUPPETDB_POSTGRES_HOSTNAME}":"${PUPPETDB_POSTGRES_PORT}"/"${PUPPETDB_POSTGRES_DATABASE}
          username: ${PUPPETDB_USER}
          password: ${PUPPETDB_PASSWORD}
          node-ttl: ${PUPPETDB_NODE_TTL}
          node-purge-ttl: ${PUPPETDB_NODE_PURGE_TTL}
          report-ttl: ${PUPPETDB_REPORT_TTL}
          facts-blocklist: ".*veth.*"
          facts-blocklist-type: regex
        }