Skip to content

Support for .namespace parameter in webhook provider (extension of referent auth) #4207

@mofr93

Description

@mofr93

Hi,

Is there any way to inject the namespace (of the ExternalSecret) into the headers of the webhook call?

I would like to be able to have X-Kubernetes-Namespace set to mynamespace in this example.

apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
  name: webhook-backend
spec:
  provider:
    webhook:
      url: "https://mywebhookserver?parameter={{ .remoteRef.key }}"
      result:
        jsonPath: "$.args.parameter"
      headers:
        Content-Type: application/json
        Authorization: Basic {{ print .auth.username ":" .auth.password | b64enc }}
        X-Kubernetes-Namespace: {{ .namespace }}
      secrets:
      - name: auth
        secretRef:
          name: webhook-credentials
          namespace: addon-eso

---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: webhook-example
  namespace: mynamespace
spec:
  refreshInterval: "15s"
  secretStoreRef:
    name: webhook-backend
    kind: ClusterSecretStore
  target:
    name: example-sync
  data:
  - secretKey: foobar
    remoteRef:
      key: secret

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerskind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions