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

Unable to inject secret in templates #357

Open
musabmasood opened this issue Nov 9, 2021 · 4 comments
Open

Unable to inject secret in templates #357

musabmasood opened this issue Nov 9, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@musabmasood
Copy link

Given that mysecret is a key in argocd-notifications-secret:

kubectl get secret argocd-notifications-secret -o yaml

apiVersion: v1
data:
  mysecret: xxxxxxxx
kind: Secret
metadata:
  name: argocd-notifications-secret
type: Opaque

I am unable to use mysecret inside my template:

apiVersion: v1
data:
  context: |
    mysecret: $mysecret
  template.some-template: |
    message: |
      The secret is {{ .context.mysecret  }} <=== doesn't work
      The secret is $mysecret <======== doesn't work either

How can I inject mysecret into my templates?

Use-case: The secret is needed in the payload body of a webhook.

@musabmasood musabmasood added the bug Something isn't working label Nov 9, 2021
@musabmasood
Copy link
Author

@alexmt is there a workaround for this?

@ryota-sakamoto
Copy link
Member

Using secret is only supported in service.* currently.
So you cannot use secret in webhook body.

@ryota-sakamoto ryota-sakamoto added enhancement New feature or request and removed bug Something isn't working labels Nov 10, 2021
@musabmasood
Copy link
Author

Is there a way to access the service context in the body?

@musabmasood
Copy link
Author

Tried to fix it in #358

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

No branches or pull requests

2 participants