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

dataFrom can't extract keys with underscores #3363

Closed
kbsquared opened this issue Apr 11, 2024 · 4 comments
Closed

dataFrom can't extract keys with underscores #3363

kbsquared opened this issue Apr 11, 2024 · 4 comments
Labels
Stale triage/support Indicates an issue that is a support question.

Comments

@kbsquared
Copy link

Describe the bug
ESO can not extract keys with underscores in them.

To Reproduce

apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: test-secret
spec:
  refreshInterval: "15s"
  secretStoreRef:
    name: example
    kind: SecretStore
  target:
    name: k8s-secret
  # this works
  #data:
  #- secretKey: TEST_SECRET
    #remoteRef:
      #key: staging/TEST_SECRET
  # this dataFrom guy doesn't like the underscores
  dataFrom:
  - extract:
      key: staging/TEST_SECRET

Create a key with an underscore in the name and then try to use dataFrom to extract it.

k8s version v1.27.7
ESO version v0.9.9

Message:
Secret "test-secret" is invalid: data[]: Invalid value: "": a valid config key must consist of alphanumeric characters, '-', '_' or '.' (e.g. 'key.name', or 'KEY_NAME', or 'key-name', regex used for validation is '[-._a-zA-Z0-9]+')

Expected behavior
This works if you're using data instead of dataFrom. And the warning says underscores are valid. I would expect this to work.

@kbsquared kbsquared added the kind/bug Categorizes issue or PR as related to a bug. label Apr 11, 2024
@Skarlso
Copy link
Contributor

Skarlso commented Apr 17, 2024

No, the error says Invalid value: "". So the key was actually empty. Maybe it didn't find it?

@gusfcarvalho gusfcarvalho added triage/support Indicates an issue that is a support question. and removed kind/bug Categorizes issue or PR as related to a bug. labels Apr 19, 2024
@gusfcarvalho
Copy link
Member

This error seems more like your payload not being a valid JSON. dataFrom requires that your secret is a well-formatted JSON. secrets like "foobar", "", or {"borken":"json" will always fail. I would start investigating by there.

we have plenty of e2e tests for dataFrom, so this is hardly a bug.

Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Jul 30, 2024
Copy link

This issue was closed because it has been stalled for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale triage/support Indicates an issue that is a support question.
Projects
None yet
Development

No branches or pull requests

3 participants