Skip to content

Commit

Permalink
Rename to SecretReferenceResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardChen820 committed Feb 21, 2024
1 parent 3d27920 commit 75317f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
16 changes: 8 additions & 8 deletions internal/controller/appconfigurationprovider_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ func (reconciler *AzureAppConfigurationProviderReconciler) Reconcile(ctx context

// Initialize the processor setting in this reconcile
processor := &AppConfigurationProviderProcessor{
Context: ctx,
Provider: provider,
Retriever: &retriever,
CurrentTime: metav1.Now(),
ReconciliationState: reconciler.ProvidersReconcileState[req.NamespacedName],
Settings: &loader.TargetKeyValueSettings{},
RefreshOptions: NewRefreshOptions(),
ResolveSecretReference: nil,
Context: ctx,
Provider: provider,
Retriever: &retriever,
CurrentTime: metav1.Now(),
ReconciliationState: reconciler.ProvidersReconcileState[req.NamespacedName],
Settings: &loader.TargetKeyValueSettings{},
RefreshOptions: NewRefreshOptions(),
SecretReferenceResolver: nil,
}

if err := processor.PopulateSettings(&existingConfigMap, existingSecrets); err != nil {
Expand Down
25 changes: 12 additions & 13 deletions internal/controller/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import (
)

type AppConfigurationProviderProcessor struct {
Context context.Context
Retriever *loader.ConfigurationSettingsRetriever
Provider *acpv1.AzureAppConfigurationProvider
Settings *loader.TargetKeyValueSettings
ShouldReconcile bool
ReconciliationState *ReconciliationState
CurrentTime metav1.Time
RefreshOptions *RefreshOptions
ResolveSecretReference loader.SecretReferenceResolver
Context context.Context
Retriever *loader.ConfigurationSettingsRetriever
Provider *acpv1.AzureAppConfigurationProvider
Settings *loader.TargetKeyValueSettings
ShouldReconcile bool
ReconciliationState *ReconciliationState
CurrentTime metav1.Time
RefreshOptions *RefreshOptions
SecretReferenceResolver loader.SecretReferenceResolver
}

type RefreshOptions struct {
Expand Down Expand Up @@ -65,7 +65,7 @@ func (processor *AppConfigurationProviderProcessor) PopulateSettings(existingCon
}

func (processor *AppConfigurationProviderProcessor) processFullReconciliation() error {
updatedSettings, err := (*processor.Retriever).CreateTargetSettings(processor.Context, processor.ResolveSecretReference)
updatedSettings, err := (*processor.Retriever).CreateTargetSettings(processor.Context, processor.SecretReferenceResolver)
if err != nil {
return err
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func (processor *AppConfigurationProviderProcessor) processKeyValueRefresh(exist
if processor.Settings.ConfigMapSettings != nil {
existingConfigMapSettings = &processor.Settings.ConfigMapSettings
}
keyValueRefreshedSettings, err := (*processor.Retriever).RefreshKeyValueSettings(processor.Context, existingConfigMapSettings, processor.ResolveSecretReference)
keyValueRefreshedSettings, err := (*processor.Retriever).RefreshKeyValueSettings(processor.Context, existingConfigMapSettings, processor.SecretReferenceResolver)
if err != nil {
return err
}
Expand Down Expand Up @@ -215,7 +215,7 @@ func (processor *AppConfigurationProviderProcessor) processSecretReferenceRefres
}
}

resolvedSecretData, err := (*processor.Retriever).ResolveSecretReferences(processor.Context, secretReferencesToSolve, processor.ResolveSecretReference)
resolvedSecretData, err := (*processor.Retriever).ResolveSecretReferences(processor.Context, secretReferencesToSolve, processor.SecretReferenceResolver)
if err != nil {
return err
}
Expand All @@ -225,7 +225,6 @@ func (processor *AppConfigurationProviderProcessor) processSecretReferenceRefres
if ok {
maps.Copy(existingSecret.Data, targetSecret.Data)
}

}
processor.Settings.SecretSettings = existingSecrets
processor.RefreshOptions.SecretSettingPopulated = true
Expand Down

0 comments on commit 75317f8

Please sign in to comment.