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

Syncing latest changes from upstream devel for ceph-csi #340

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/util/crushlocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
11 changes: 11 additions & 0 deletions internal/util/crushlocation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down