Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

feat(poller): lodash template preprocess for template field #626

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

intpp
Copy link
Contributor

@intpp intpp commented Feb 11, 2021

Details: #625

@moolen
Copy link
Member

moolen commented Feb 13, 2021

Leeets go! Thanks @intpp and @eshepelyuk for your contribution!
I didn't get to play with it yet, but from a first glance it looks good!

Could you please add e2e tests (take a look here for reference)? That would be really valuable.

For now only template.stringData is supported. Do you think it makes sense to also support template.data in scope of this PR?

@eshepelyuk
Copy link

eshepelyuk commented Feb 13, 2021

@moolen please review examples in #625, they should explain everything by example.

Entire ExtSec.template is supported, i.e. stringData, data, labels, annotations etc
I.e. resulting K8S Secret is completely customizable with lodash templating.

@eshepelyuk
Copy link

@intpp is it OK to add e2e tests and taking the input data from #625 ?

@moolen
Copy link
Member

moolen commented Feb 13, 2021

I see now. looks good!
What about package-lock.json, why was it removed?

edit
i played around with it, works like a charm 😀.

#625 is well written, the examples and use-cases (e.g. base64 encoding) should be documented in the README. Could you please add a little bit of documentation there?

@eshepelyuk
Copy link

Not sure, let's wait for @intpp :)

@intpp
Copy link
Contributor Author

intpp commented Feb 15, 2021

@moolen i'll revert package-lock.json (it's maybe my settings removed it)

i'll try to add e2e and some documentation

@eshepelyuk
Copy link

@moolen README is updated.

@eshepelyuk
Copy link

eshepelyuk commented Feb 24, 2021

@moolen could you plz help to debug e2e test ?

I've added a very sample case and Secret is not created, i.e. test return undefined
I've tried to play around with single quotes, doulbe quotes and backticks, but no luck.

You could check this PR intpp#1
And this action run https://github.com/intpp/kubernetes-external-secrets/runs/1969101057?check_suite_focus=true

How to understand what is the error reason ?
I had no luck installing kind on windows, so only able to test PR via GitHub actions.

Here's the output

  secretsmanager
    1) should pull existing secret from secretsmanager and create a secret with its values
    ✓ should pull TLS secret from secretsmanager (129ms)
    ✓ should pull existing secret from secretsmanager in the correct region (2140ms)
    permitted annotation
      assuming role
        ✓ should not pull from secretsmanager (3336ms)
      enforcing naming convention
        ✓ should not pull from secretsmanager (3331ms)

  ssm
    ✓ should pull existing secret from ssm and create a secret from it (126ms)
    ✓ should pull existing secrets from ssm path and create a secret from it (135ms)
    ✓ should pull existing secret from ssm in a different region (132ms)
    permitted annotation
      ✓ should not pull from ssm (3433ms)


  10 passing (16s)
  1 failing

  1) secretsmanager
       should pull existing secret from secretsmanager and create a secret with its values:
     AssertionError: expected undefined to not equal undefined
      at Context.<anonymous> (e2e/tests/secrets-manager.test.js:70:27)

@moolen
Copy link
Member

moolen commented Feb 24, 2021

I took a quick look. It basicially boils down to this line: https://github.com/external-secrets/kubernetes-external-secrets/pull/626/files#diff-17502f4c1fbf75e34c5969bc001d3f582249700e55e4902264c3ba55a8e15d3fR98

if template.stringData would be defined then it would work as expected in the test scenario.
RN it copies over the <%= "Hello" %> to the actual secret. This value is not a valid label value (must be alphanumeric + _-.) - because of that the secret won't be created.

By the way You can run the tests locally with ./run-e2e-test.sh from the e2e dir.

@eshepelyuk
Copy link

I took a quick look. It basicially boils down to this line: https://github.com/external-secrets/kubernetes-external-secrets/pull/626/files#diff-17502f4c1fbf75e34c5969bc001d3f582249700e55e4902264c3ba55a8e15d3fR98

if template.stringData would be defined then it would work as expected in the test scenario.
RN it copies over the <%= "Hello" %> to the actual secret. This value is not a valid label value (must be alphanumeric + _-.) - because of that the secret won't be created.

Thnx a lot for the clarification. !

By the way You can run the tests locally with ./run-e2e-test.sh from the e2e dir.

Unfortunately I cant because

had no luck installing kind on windows, so only able to test PR via GitHub actions.

@intpp intpp force-pushed the master branch 2 times, most recently from 2b5aaaf to 9b66afb Compare February 24, 2021 12:38
@eshepelyuk
Copy link

eshepelyuk commented Feb 24, 2021

@moolen @intpp e2e test is added and build is green.

Copy link
Member

@moolen moolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for adding the e2e tests!

@moolen moolen merged commit 6639553 into external-secrets:master Feb 25, 2021
@eshepelyuk
Copy link

Hi @moolen

Thnx for accepting our contribution !
Obvious question, any plan to release a new version soon ?

@moolen
Copy link
Member

moolen commented Feb 25, 2021

@eshepelyuk I think it makes sense to create one. I'll try to find some time to figure it out or maybe @Flydiverny can you help us?

@eshepelyuk
Copy link

Thnx for the explanation.

@Flydiverny
Copy link
Member

A 6.4.0 release has been made :) thanks for the contribution!

@eshepelyuk
Copy link

Great 🚀 👍 ❕ ❕ ❕

@eshepelyuk
Copy link

@moolen @Flydiverny could I request to post an release announcement to Slack channel ?

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

Successfully merging this pull request may close these issues.

4 participants