Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Make it possible to inject user-provided environment variables into the Backstage Deployment #52

Closed
rm3l opened this issue Nov 29, 2023 · 1 comment · Fixed by #56
Closed
Labels
kind/enhancement New feature or request

Comments

@rm3l
Copy link
Member

rm3l commented Nov 29, 2023

In #27, we added support for user-defined app-configs and dynamic plugins config, backed by either ConfigMaps or Secrets.

As discussed in #27 (comment), the common and recommended approach for most app-config files would be files referencing environment variables backed by Secrets, like so:

auth:
  environment: prod
  providers:
    github:
      prod:
        clientId: ${AUTH_GITHUB_CLIENT_ID}
        clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
        ## uncomment if using GitHub Enterprise
        # enterpriseInstanceUrl: ${AUTH_GITHUB_ENTERPRISE_INSTANCE_URL}

One possible approach, depicted in the upstream Backstage deployment guide on Kubernetes, could be to reference a backstage-secrets secret, just like what we are doing with the DB credentials. Here, this secret would need to be optional.

envFrom:
  - secretRef:
      name: postgres-secrets
  - secretRef:
      name: backstage-secrets
      optional: true

This would not require adding specific fields to the CRD.

@rm3l rm3l added the kind/enhancement New feature or request label Nov 29, 2023
@rm3l
Copy link
Member Author

rm3l commented Dec 11, 2023

This will be fixed by #56 , using the extraEnvs field in the CR:

spec:
  application:
    extraEnvs:
      configMaps:
        - name: "cm-name"
          # key is optional. Env vars from all keys if key is not set
          key: "key"
      secrets:
        - name: "secret-name"
          # key is optional. Env vars from all keys if key is not set
          key: "key"
      envs:
        - name: MY_ENV_VAR_1
          value: my-value-1
# --- Truncated ---

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant