Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pgadmin4] feat: add possibility to use template-strings inside values.yaml #232

Merged
merged 3 commits into from
Dec 18, 2023
Merged

Conversation

pmoscode
Copy link
Contributor

What this PR does / why we need it:

This PR adds the possibility to use template strings for "extraConfigmapMounts.[].configMap" and "extraSecretMounts.[].secret" if the ConfigMap / Secret has a dynamic name.

Which issue this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)

Special notes for your reviewer:

nothing special

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • DCO signed
  • Chart Version bumped
  • Variables are documented in the README.md
  • Title of the PR starts with chart name (e.g. [pgadmin4])

for "extraConfigmapMounts.[].configMap" and "extraSecretMounts.[].secret"

Signed-off-by: pmoscode <info@pmoscode.de>
Signed-off-by: pmoscode <info@pmoscode.de>
Signed-off-by: pmoscode <info@pmoscode.de>
@pmoscode
Copy link
Contributor Author

Thanks for the approval.
Do you need anything more from me to merge this PR?

@rowanruseler
Copy link
Owner

@pmoscode no sorry, extremely busy and forgot that I wanted to merge this but was waiting for the tests. Thank you for your PR.

@rowanruseler rowanruseler merged commit d619d95 into rowanruseler:main Dec 18, 2023
2 checks passed
@SkeLLLa
Copy link

SkeLLLa commented Mar 27, 2024

Are there any examples of how to migrate previous configs to be compatible with this change? Since after upgrade I'm getting error like

Error: template: pgadmin4/templates/deployment.yaml:219:26: executing "pgadmin4/templates/deployment.yaml" at <.configMap>: invalid value; expected string

Used values.yaml:

extraConfigmapMounts:
  - name: pgadmin4-config
    subPath: config_local.py
    mountPath: "/pgadmin4/config_local.py"
    readOnly: true
envVarsFromSecrets:
  - pgadmin4-oauth2-secret
extraDeploy:
  - apiVersion: v1
    kind: Secret
    metadata:
      name: pgadmin4-oauth2-secret
    type: Opaque
    stringData:
      OAUTH2_CLIENT_ID: ""
      OAUTH2_CLIENT_SECRET: ""
  - apiVersion: v1
    kind: ConfigMap
    metadata:
      name: pgadmin4-config
    data:
      config_local.py: |-
        import os
        
        UPGRADE_CHECK_ENABLED = False
        MFA_SUPPORTED_METHODS = ["authenticator"]
        MASTER_PASSWORD_REQUIRED = True
        AUTHENTICATION_SOURCES = ['oauth2', 'internal']
        OAUTH2_AUTO_CREATE_USER = True
        OAUTH2_CONFIG = [
          {
              'OAUTH2_NAME': 'gitlab',
              'OAUTH2_DISPLAY_NAME': 'Gitlab',
              'OAUTH2_CLIENT_ID': os.environ['OAUTH2_CLIENT_ID'],
              'OAUTH2_CLIENT_SECRET': os.environ['OAUTH2_CLIENT_SECRET'],
              'OAUTH2_TOKEN_URL': 'https://gitlab.com/oauth/token',
              'OAUTH2_AUTHORIZATION_URL': 'https://gitlab.com/oauth/authorize',
              'OAUTH2_API_BASE_URL': 'https://gitlab.com/oauth/',
              'OAUTH2_SERVER_METADATA_URL': 'https://gitlab.com/.well-known/openid-configuration',
              'OAUTH2_USERINFO_ENDPOINT': 'userinfo',
              'OAUTH2_SCOPE': 'openid email profile',
              'OAUTH2_ICON': 'fa-gitlab',
              'OAUTH2_BUTTON_COLOR': '#fc6d27'
          }
        ]

UPD: nevermind, but for whoever else will face the problem in order to fix that add configMap: pgadmin4-config property.

extraConfigmapMounts:
  - name: pgadmin4-config
    configMap: pgadmin4-config
    subPath: config_local.py
    mountPath: "/pgadmin4/config_local.py"
    readOnly: true

@pmoscode
Copy link
Contributor Author

Hi @SkeLLLa,
did this really work for you with the missing "configMap" property before the change?

Because without it, the deployment resource wouldn't know, where to find the ConfigMap resource...

- name: {{ .name }}
  configMap:
    name: {{ .configMap }}
    defaultMode: {{ .defaultMode | default 256 }}

Correct me, if I'm wrong...

@SkeLLLa
Copy link

SkeLLLa commented Mar 27, 2024

@pmoscode yep, it worked. I'm not a big expert in helm, but I suspect it worked because the configmap itself contained

metadata:
  name: pgadmin4-config

But I'm not sure.

In any case whoever else may face the issue, the solution would be here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pgadmin4] Add possibility to use template-strings inside values.yaml
3 participants