Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
linglingye001 committed Jul 19, 2024
1 parent 7fdc735 commit 030d112
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/controller/appconfigurationprovider_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ func (reconciler *AzureAppConfigurationProviderReconciler) createOrUpdateSecrets
}

for secretName, secret := range processor.Settings.SecretSettings {
if !shouldCreateOrUpdate(reconciler.ProvidersReconcileState[namespacedName].ExistingSecretReferences, secretName, processor.Settings.SecretReferences[secretName], processor.ShouldReconcile) {
if !shouldCreateOrUpdate(processor, secretName) {
if _, ok := reconciler.ProvidersReconcileState[namespacedName].ExistingSecretReferences[secretName]; ok {
processor.Settings.SecretReferences[secretName].SecretResourceVersion = reconciler.ProvidersReconcileState[namespacedName].ExistingSecretReferences[secretName].SecretResourceVersion
}
Expand Down
6 changes: 4 additions & 2 deletions internal/controller/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,17 @@ func verifySelectorObject(selector acpv1.Selector) error {
return nil
}

func shouldCreateOrUpdate(existingSecretReferences map[string]*loader.TargetSecretReference, secretName string, secretReference *loader.TargetSecretReference, shouldReconcile bool) bool {
if shouldReconcile {
func shouldCreateOrUpdate(processor *AppConfigurationProviderProcessor, secretName string) bool {
if processor.ShouldReconcile {
return true
}

existingSecretReferences := processor.ReconciliationState.ExistingSecretReferences
if _, ok := existingSecretReferences[secretName]; !ok {
return true
}

secretReference := processor.Settings.SecretReferences[secretName]
if len(existingSecretReferences[secretName].SecretMetadata) != len(secretReference.SecretMetadata) {
return true
}
Expand Down

0 comments on commit 030d112

Please sign in to comment.