Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set label filter to nil when it's empty string #70

Merged
merged 6 commits into from
Oct 14, 2024

Conversation

linglingye001
Copy link
Contributor

No description provided.

@@ -664,7 +664,15 @@ func deduplicateFilters(filters []acpv1.Selector) []acpv1.Selector {
}
}
if !findDuplicate {
result = append(result, filters[i])
labelFilter := filters[i].LabelFilter
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should do the conversion while deduplicating the selectors, we need to do it more straightforwardly.

Copy link
Contributor

Choose a reason for hiding this comment

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

And what about the label for the sentinel?

@@ -106,9 +106,9 @@ type RefreshMonitoring struct {

// Defines the keyValues to be watched.
type Sentinel struct {
Key string `json:"key"`
Key *string `json:"key"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Key should not be nullable.

return results
}

func processEmptyLabelFilter(filters []acpv1.Selector) []acpv1.Selector {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about rename to "normalizeLableFilter"?

@@ -643,6 +644,40 @@ func GetFeatureFlagFilters(acpSpec acpv1.AzureAppConfigurationProviderSpec) []ac
return featureFlagFilters
}

func getSentinels(sentinels []acpv1.Sentinel) []acpv1.Sentinel {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about rename to "normalizeSentinels" ?

@@ -88,15 +88,15 @@ func (s *EtagSettingsClient) GetSettings(ctx context.Context, client *azappconfi
}

func (s *SentinelSettingsClient) GetSettings(ctx context.Context, client *azappconfig.Client) (*SettingsResponse, error) {
sentinelSetting, err := client.GetSetting(ctx, s.sentinel.Key, &azappconfig.GetSettingOptions{Label: &s.sentinel.Label, OnlyIfChanged: s.etag})
sentinelSetting, err := client.GetSetting(ctx, s.sentinel.Key, &azappconfig.GetSettingOptions{Label: s.sentinel.Label, OnlyIfChanged: s.etag})
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to do the same as SelectorSettingsClient, if label is nil, set it to \x00

@linglingye001 linglingye001 merged commit 99cbeee into release/v2/stable Oct 14, 2024
3 checks passed
@linglingye001 linglingye001 deleted the linglingye/labelFilterCheck branch October 14, 2024 03:25
linglingye001 added a commit that referenced this pull request Nov 8, 2024
* set label filter to nil when it is empty string

* process empty label of sentinels

* update

* update

* resolve comments

* update
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.

2 participants