Skip to content

Secret refresh support#20

Merged
linglingye001 merged 16 commits intorelease/v1.0.0-beta.2from
linglingye/secretRefresh
May 8, 2025
Merged

Secret refresh support#20
linglingye001 merged 16 commits intorelease/v1.0.0-beta.2from
linglingye/secretRefresh

Conversation

@linglingye001
Copy link
Member

No description provided.

@linglingye001 linglingye001 requested a review from Copilot April 18, 2025 10:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for refreshing Key Vault secrets alongside key-value settings in Azure App Configuration. Key changes include:

  • Validation for the secret refresh interval against a minimal allowed duration.
  • New refresh logic and timer for Key Vault secrets with corresponding changes in the loading and testing of secrets.
  • Updates in tests and options to support the new secret refresh functionality.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
azureappconfiguration/utils.go Added validation for secret refresh interval
azureappconfiguration/refresh_test.go Updated mocks and assertions to test secret refresh
azureappconfiguration/options.go Introduced RefreshOptions in KeyVaultOptions
azureappconfiguration/constants.go Defined minimalSecretRefreshInterval constant
azureappconfiguration/azureappconfiguration_test.go Adjusted secret assertions in tests
azureappconfiguration/azureappconfiguration.go Added secrets map, secret refresh timer, and refresh logic for secrets
Comments suppressed due to low confidence (2)

azureappconfiguration/azureappconfiguration.go:369

  • When resolving Key Vault secrets concurrently, a failure in any goroutine returns a partially filled secrets map along with an error. Consider aborting immediately upon error to avoid propagating incomplete secret data.
if err := eg.Wait(); err != nil { return secrets, fmt.Errorf("failed to resolve Key Vault references: %w", err) }

azureappconfiguration/azureappconfiguration.go:197

  • [nitpick] Consider adding a clarifying comment that the refresh configuration is valid if either the KeyValue or Secret refresh timer is set, as this may not be immediately obvious to readers.
if azappcfg.kvRefreshTimer == nil && azappcfg.secretRefreshTimer == nil {

@linglingye001 linglingye001 force-pushed the linglingye/sentinelBasedRefresh branch from b6bf5ec to c733192 Compare April 23, 2025 05:07
Base automatically changed from linglingye/sentinelBasedRefresh to release/v1.0.0-beta.2 April 24, 2025 07:33
@linglingye001 linglingye001 force-pushed the linglingye/secretRefresh branch from d0f4481 to 0cac003 Compare April 24, 2025 08:08
if azappcfg.kvRefreshTimer == nil {
return fmt.Errorf("refresh is not configured")
if azappcfg.kvRefreshTimer == nil && azappcfg.secretRefreshTimer == nil {
return fmt.Errorf("refresh is not enabled for key values or key vault data")
Copy link
Member

Choose a reason for hiding this comment

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

refresh is not enabled for key values or key vault references

Copy link
Member Author

Choose a reason for hiding this comment

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

Just want to make the log and error message more clear, for secret refresh scenario, the key vault references don't change and the provider actually refresh the secret value, what do you think replacing key vault references with Key Vault secret in secret refresh scenarios?

Copy link
Member

Choose a reason for hiding this comment

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

"key vault reference" is an official term in azure app config document. "key vault data" sounds odd since we never call things with it.

I agree with you we need make the message more clear, we are not really refreshing the key vault references, how about this?

Neither key values refresh nor key vault reference reloading is enabled.

We use the word "reload" for this scenario, https://learn.microsoft.com/en-us/azure/azure-app-configuration/reload-key-vault-secrets-dotnet

Copy link
Member Author

Choose a reason for hiding this comment

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

"key vault data" is used in k8s provider reference doc. 'reload' looks good to me.

@linglingye001 linglingye001 merged commit 1d5e502 into release/v1.0.0-beta.2 May 8, 2025
13 checks passed
@linglingye001 linglingye001 deleted the linglingye/secretRefresh branch May 8, 2025 09:13
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.

3 participants