Skip to content

feat(azurekv): add expiration time to azure kv secret#4709

Closed
hjoshi123 wants to merge 9 commits intoexternal-secrets:mainfrom
hjoshi123:feat/azure-keyvault-expiration-time
Closed

feat(azurekv): add expiration time to azure kv secret#4709
hjoshi123 wants to merge 9 commits intoexternal-secrets:mainfrom
hjoshi123:feat/azure-keyvault-expiration-time

Conversation

@hjoshi123
Copy link
Copy Markdown

@hjoshi123 hjoshi123 commented Apr 27, 2025

Problem Statement

What is the problem you're trying to solve?

Adding expiration date along with other available attributes to azure keyvault metadata. Previously this was allowed only for tags.

Related Issue

Fixes #4697

Proposed Changes

How do you like to solve the issue and why?

Checklist

  • I have read the contribution guidelines
  • All commits are signed with git commit --signoff
  • My changes have reasonable test coverage
  • All tests pass with make test
  • I ensured my PR is ready for review with make reviewable

@hjoshi123 hjoshi123 requested a review from a team as a code owner April 27, 2025 22:12
@hjoshi123 hjoshi123 requested a review from moolen April 27, 2025 22:12
@hjoshi123 hjoshi123 force-pushed the feat/azure-keyvault-expiration-time branch from 29e118f to 77539be Compare April 27, 2025 22:12
@hjoshi123 hjoshi123 changed the title WIP: #4697: add expiration time to azure kv secret feat(azurekv): add expiration time to azure kv secret May 10, 2025
hjoshi123 added 3 commits May 16, 2025 08:39
Signed-off-by: hjoshi123 <hemant.joshi@vizio.com>
Signed-off-by: hjoshi123 <hemant.joshi@vizio.com>
Signed-off-by: hjoshi123 <hemant.joshi@vizio.com>
@hjoshi123 hjoshi123 force-pushed the feat/azure-keyvault-expiration-time branch from f34bb85 to 32f5960 Compare May 16, 2025 14:39
@perpective2410
Copy link
Copy Markdown

Wonderful !
Who could validate this code? @gusfcarvalho maybe?

Comment on lines +1090 to +1092
expiryDuration := time.Now().Add(time.Hour)
expiryTime := date.UnixTime(expiryDuration)
createdTime := date.UnixTime(time.Now())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we add custom checks to verify if these values are actually present on the outputs for this test?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yup will add that to the test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@hjoshi123 Can you point me to the code section that actually verifies that these values are set correctly? 🤔 I don't see that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is still unanswered. :)

Copy link
Copy Markdown
Author

@hjoshi123 hjoshi123 Jun 7, 2025

Choose a reason for hiding this comment

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

oh hey sorry I missed the thread.. I did add a test here..

setSecretWithAttributes := func(smtc *secretManagerTestCase) {
		expiryDuration := time.Now().Add(time.Hour)
		expiryTime := date.UnixTime(expiryDuration)
		createdTime := date.UnixTime(time.Now())
		smtc.ref.MetadataPolicy = esv1.ExternalSecretMetadataPolicyFetch
		smtc.secretOutput = keyvault.SecretBundle{
			Value: &secretString,
			Attributes: &keyvault.SecretAttributes{
				Expires: &expiryTime,
				Created: &createdTime,
				Updated: &createdTime,
			},
		}

		smtc.expectedData["expires"] = []byte(time.Unix(int64(expiryTime.Duration().Seconds()), 0).String())
		smtc.expectedData["created"] = []byte(time.Unix(int64(createdTime.Duration().Seconds()), 0).String())
		smtc.expectedData["updated"] = []byte(time.Unix(int64(createdTime.Duration().Seconds()), 0).String())
	}

its in the secret manager test case.. sorry for the delay in reply

@gusfcarvalho
Copy link
Copy Markdown
Member

code itself looks good, but tests do not seem to be testing the feature itself :)

@hjoshi123
Copy link
Copy Markdown
Author

@gusfcarvalho the test I added checks for expiry.. I will add checks for other fields too.. what other tests do you think I should add?

@gusfcarvalho
Copy link
Copy Markdown
Member

that one is the only test case that I think it is worth to add - to test out these fields will now be there.

Signed-off-by: hjoshi123 <hemant.joshi@vizio.com>
@hjoshi123 hjoshi123 force-pushed the feat/azure-keyvault-expiration-time branch from c31033b to 9fcfaba Compare May 22, 2025 21:08
@hjoshi123 hjoshi123 requested a review from gusfcarvalho May 22, 2025 21:41
@hjoshi123
Copy link
Copy Markdown
Author

@gusfcarvalho does this look good now?

Co-authored-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
Signed-off-by: Hemant Joshi <mail2hemantjoshi@pm.me>
@hjoshi123
Copy link
Copy Markdown
Author

@Skarlso @gusfcarvalho is there any updates I should do for the above?

@Skarlso
Copy link
Copy Markdown
Contributor

Skarlso commented Jun 20, 2025

Hey @hjoshi123.

Could you please take care of the new Sonar issue that popped up? :) Thanks.

Sorry, I was on vacation.

Signed-off-by: hjoshi123 <hemant.joshi@vizio.com>
…hi123/external-secrets into feat/azure-keyvault-expiration-time
@sonarqubecloud
Copy link
Copy Markdown

@hjoshi123
Copy link
Copy Markdown
Author

@Skarlso no issues. Sorry for the delay and the ping too. I think the sonarr qube thing is fixed now

@bsvicente
Copy link
Copy Markdown

@Skarlso Has the issue been resolved? I can also help with this PR

@Skarlso
Copy link
Copy Markdown
Contributor

Skarlso commented Jul 29, 2025

Sorry, was on vacation again.. :) I'll take a look at this today.

@sonarqubecloud
Copy link
Copy Markdown

Skarlso
Skarlso previously approved these changes Jul 29, 2025
Copy link
Copy Markdown
Contributor

@Skarlso Skarlso left a comment

Choose a reason for hiding this comment

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

Ah, please fix the CI failures. :)

@Skarlso Skarlso dismissed their stale review July 29, 2025 06:07

ci issues

@bsvicente
Copy link
Copy Markdown

Hi @hjoshi123,
Just checking if you’ve had the chance to review the CI errors.
I can push a fix for them if that helps!

@Skarlso
Copy link
Copy Markdown
Contributor

Skarlso commented Nov 17, 2025

We waited for a longer period of time now on this, so I'm going to close it. @bsvicente feel free to open a separate PR if you are up for it as a continuation of this one. :) Thanks!

@Skarlso Skarlso closed this Nov 17, 2025
muraliavarma added a commit to muraliavarma/external-secrets that referenced this pull request Feb 6, 2026
Closes external-secrets#4697. When MetadataPolicy is set to Fetch, secret/cert/key
attributes (expires, created, updated, notBefore) are now included
alongside tags in the metadata response as RFC3339 timestamps.

Also fixes the gocritic sloppyReassign lint errors that blocked PR external-secrets#4709.

Signed-off-by: Murali <muraliavarma@gmail.com>
@muraliavarma
Copy link
Copy Markdown
Contributor

Hi @Skarlso , I tried to take the work from @hjoshi123 over the finish line in a separate PR here if you think it is worth looking at. It is my first contribution to the repo so I apologize if I am missing something obvious in the code or with the process. Thank you!

muraliavarma added a commit to muraliavarma/external-secrets that referenced this pull request Mar 17, 2026
Closes external-secrets#4697. When MetadataPolicy is set to Fetch, secret/cert/key
attributes (expires, created, updated, notBefore) are now included
alongside tags in the metadata response as RFC3339 timestamps.

Also fixes the gocritic sloppyReassign lint errors that blocked PR external-secrets#4709.

Signed-off-by: Murali <muraliavarma@gmail.com>
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.

Expose Expiration Date from secret backend

6 participants