Merge pull request #340 from red-hat-storage/sync_us--devel

Syncing latest changes from upstream devel for ceph-csi
This commit is contained in:
openshift-merge-bot[bot] 2024-07-17 08:11:12 +00:00 committed by GitHub
commit b8c3cab2fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -48,6 +48,10 @@ func getCrushLocationMap(crushLocationLabels string, nodeLabels map[string]strin
// Determine values for requested labels from node labels
crushLocationMap := make(map[string]string, len(labelsIn))
for key, value := range nodeLabels {
// label with empty value is not considered.
if value == "" {
continue
}
if _, ok := labelsIn[key]; !ok {
continue
}

View File

@ -100,6 +100,17 @@ func Test_getCrushLocationMap(t *testing.T) {
},
want: map[string]string{"host": "worker-1"},
},
{
name: "matching crushlocation and node labels with empty value",
args: input{
crushLocationLabels: "topology.io/region,topology.io/zone",
nodeLabels: map[string]string{
"topology.io/region": "region1",
"topology.io/zone": "",
},
},
want: map[string]string{"region": "region1"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {