puppetlabs / puppetserver-helm-chart

The Helm Chart for Puppet Server
Apache License 2.0
47 stars 55 forks source link

Add ability to populate env from secret & various bugfixes #194

Closed ldaneliukas closed 7 months ago

ldaneliukas commented 8 months ago

Feature

Fixes #193

Tested by deploying our usual setup from this branch - helm reports no changes to any resources. envFrom is not populated:

 ~  k get pod puppetserver-puppetserver-master-7458c5f9f7-qcms6 -oyaml | grep envFrom -A2

Redeployed after adding the following to Helm values:

puppetserver:
  masters:
    extraEnvSecret: puppetserver-env

Which resulted in the following changes:

 ~  k get pod puppetserver-puppetserver-master-85946b589c-rrsnl -oyaml | grep envFrom -A2
    envFrom:
    - secretRef:
        name: puppetserver-env
--
    envFrom:
    - secretRef:
        name: puppetserver-env

By executing k exec -ti puppetserver-puppetserver-master-85946b589c-rrsnl /usr/bin/env I am able to see all of the environment variables populated from secret puppetserver-env key/value pairs.

Usage example

One of the possible uses is to create custom entrypoints with secret values. For example, some internal Puppet function might need a file with credentials:

puppetserver:
  customentrypoints:
    enabled: true
    configmaps:
      01_some_dependencies.sh: |-
        #!/bin/bash
        echo "{\"client_id\":\"${JWT_CLIENT}\",\"client_secret\":\"${JWT_SECRET}\"}" > /etc/jwt_credentials.json

I'm sure there's many other use cases for this.

Bugfixes

Xtigyro commented 8 months ago

@ldaneliukas Some conflicts need resolving before we can merge this.

Also - would you like to be added as one of the official maintainers of the chart?

CC: @davidphay

ldaneliukas commented 8 months ago

@ldaneliukas Some conflicts need resolving before we can merge this.

Also - would you like to be added as one of the official maintainers of the chart?

CC: @davidphay

Solved the conflicts and merged the changes from https://github.com/puppetlabs/puppetserver-helm-chart/pull/198 into this PR to prevent more version conflicts.

Yes, I'd be happy to.

Xtigyro commented 8 months ago

@ldaneliukas Great! Would you mind please adding yourself to:

  1. https://github.com/puppetlabs/puppetserver-helm-chart/blob/master/Chart.yaml#L18
  2. https://github.com/puppetlabs/puppetserver-helm-chart/blob/master/README.md#credits
  3. https://github.com/puppetlabs/puppetserver-helm-chart/blob/master/CODEOWNERS#L3

@underscorgan Could you please give @ldaneliukas Write permissions and Collaborator status in this repo?

ldaneliukas commented 7 months ago

@ldaneliukas Great! Would you mind please adding yourself to:

  1. https://github.com/puppetlabs/puppetserver-helm-chart/blob/master/Chart.yaml#L18
  2. https://github.com/puppetlabs/puppetserver-helm-chart/blob/master/README.md#credits
  3. https://github.com/puppetlabs/puppetserver-helm-chart/blob/master/CODEOWNERS#L3

@underscorgan Could you please give @ldaneliukas Write permissions and Collaborator status in this repo?

Done.

Xtigyro commented 7 months ago

FYI: Bumped the version to 8.2.0 - just following more strictly the Semantic Versioning.

binford2k commented 6 months ago

I just discovered this PR, @ldaneliukas can you fill out the form at https://www.puppet.com/ecosystem/contribute/trusted-contributors/apply so we can get you onboarded to the trusted contributor program?

ldaneliukas commented 6 months ago

@binford2k done 👍