Skip to content

Commit

Permalink
set default refresh interval for featureFlag (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
linglingye001 authored Jan 30, 2024
1 parent 237d661 commit 276803f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
12 changes: 10 additions & 2 deletions api/v1/azureappconfigurationprovider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ type AzureAppConfigurationKeyValueOptions struct {

// AzureAppConfigurationFeatureFlagOptions defines the options of fetching feature flags from AppConfiguration.
type AzureAppConfigurationFeatureFlagOptions struct {
Selectors []Selector `json:"selectors,omitempty"`
Refresh *RefreshSettings `json:"refresh,omitempty"`
Selectors []Selector `json:"selectors,omitempty"`
Refresh *FeatureFlagRefreshSettings `json:"refresh,omitempty"`
}

// KeyLabelSelector defines the filters when fetching the data from Azure AppConfiguration
Expand Down Expand Up @@ -156,6 +156,14 @@ type RefreshSettings struct {
Enabled bool `json:"enabled,omitempty"`
}

type FeatureFlagRefreshSettings struct {
// +kubebuilder:validation:Format=duration
// +kubebuilder:default="30s"
Interval string `json:"interval"`
// +kubebuilder:default=false
Enabled bool `json:"enabled,omitempty"`
}

type AzureKeyVaultAuth struct {
*AzureAppConfigurationProviderAuth `json:",inline,omitempty"`
KeyVaults []AzureKeyVaultPerVaultAuth `json:"keyVaults,omitempty"`
Expand Down
17 changes: 16 additions & 1 deletion api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/controller/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
const (
MinimalSentinelBasedRefreshInterval time.Duration = time.Second
MinimalSecretRefreshInterval time.Duration = time.Minute
MinimalFeatureFlagRefreshInterval time.Duration = time.Minute
MinimalFeatureFlagRefreshInterval time.Duration = time.Second
)

func verifyObject(spec acpv1.AzureAppConfigurationProviderSpec) error {
Expand Down

0 comments on commit 276803f

Please sign in to comment.