Allow using label selectors for system labels for secrets and configmap

backends.

Fixes #12435

Signed-off-by: Dmitry Chepurovskiy <me@dm3ch.net>
pull/12447/head
Dmitry Chepurovskiy 1 year ago
parent c288f0b7be
commit e219c756e0
No known key found for this signature in database
GPG Key ID: 5B3A5FDCBFF9B3A4

@ -107,7 +107,7 @@ func (cfgmaps *ConfigMaps) List(filter func(*rspb.Release) bool) ([]*rspb.Releas
continue
}
rls.Labels = filterSystemLabels(item.ObjectMeta.Labels)
rls.Labels = item.ObjectMeta.Labels
if filter(rls) {
results = append(results, rls)

@ -128,6 +128,16 @@ func TestConfigMapList(t *testing.T) {
if len(ssd) != 2 {
t.Errorf("Expected 2 superseded, got %d", len(ssd))
}
// Check if release having both system and custom labels, this is needed to ensure that selector filtering would work.
rls := ssd[0]
_, ok := rls.Labels["name"]
if !ok {
t.Fatalf("Expected 'name' label in results, actual %v", rls.Labels)
}
_, ok = rls.Labels["key1"]
if !ok {
t.Fatalf("Expected 'key-1' label in results, actual %v", rls.Labels)
}
}
func TestConfigMapQuery(t *testing.T) {

@ -99,7 +99,7 @@ func (secrets *Secrets) List(filter func(*rspb.Release) bool) ([]*rspb.Release,
continue
}
rls.Labels = filterSystemLabels(item.ObjectMeta.Labels)
rls.Labels = item.ObjectMeta.Labels
if filter(rls) {
results = append(results, rls)

@ -128,6 +128,16 @@ func TestSecretList(t *testing.T) {
if len(ssd) != 2 {
t.Errorf("Expected 2 superseded, got %d", len(ssd))
}
// Check if release having both system and custom labels, this is needed to ensure that selector filtering would work.
rls := ssd[0]
_, ok := rls.Labels["name"]
if !ok {
t.Fatalf("Expected 'name' label in results, actual %v", rls.Labels)
}
_, ok = rls.Labels["key1"]
if !ok {
t.Fatalf("Expected 'key-1' label in results, actual %v", rls.Labels)
}
}
func TestSecretQuery(t *testing.T) {

Loading…
Cancel
Save