Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
linglingye001 committed Sep 25, 2024
1 parent 1ebc998 commit a78f53e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions api/v1/azureappconfigurationprovider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type RefreshMonitoring struct {

// Defines the keyValues to be watched.
type Sentinel struct {
// +kubebuilder:validation:MinLength=1
Key *string `json:"key"`
// +kubebuilder:default="\x00"
Label *string `json:"label,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ spec:
description: Defines the keyValues to be watched.
properties:
key:
minLength: 1
type: string
label:
default: "\0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,8 @@ var _ = Describe("AppConfiguationProvider controller", func() {
connectionStringReference := "fakeSecret"
testKey := "testKey"
testKey2 := "testKey2"
testKey3 := "testKey3"
testKey4 := "testKey4"
testLabel := "testValue"
emptyLabel := ""
configProviderSpec := acpv1.AzureAppConfigurationProviderSpec{
Expand All @@ -2320,15 +2322,15 @@ var _ = Describe("AppConfiguationProvider controller", func() {
Label: nil,
},
{
Key: &testKey,
Key: &testKey2,
Label: &testLabel,
},
{
Key: &testKey,
Key: &testKey3,
Label: nil,
},
{
Key: &testKey2,
Key: &testKey4,
Label: &emptyLabel,
},
},
Expand Down
4 changes: 2 additions & 2 deletions internal/loader/configuration_setting_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ func GetFeatureFlagFilters(acpSpec acpv1.AzureAppConfigurationProviderSpec) []ac
}

func getSentinels(sentinels []acpv1.Sentinel) []acpv1.Sentinel {
results := make([]acpv1.Sentinel, 0)
var results []acpv1.Sentinel
for _, sentinel := range sentinels {
label := sentinel.Label
if sentinel.Label != nil && len(*sentinel.Label) == 0 {
Expand All @@ -658,7 +658,7 @@ func getSentinels(sentinels []acpv1.Sentinel) []acpv1.Sentinel {
})

}
return sentinels
return results
}

func processEmptyLabelFilter(filters []acpv1.Selector) []acpv1.Selector {
Expand Down

0 comments on commit a78f53e

Please sign in to comment.