Skip to content

Commit c4f12af

Browse files
authored
chore: update get component name func (#9636)
1 parent 65b4a2d commit c4f12af

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/dataprotection/restore/utils.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ func BackupFilePathEnv(filePath, targetName, targetPodName string) []corev1.EnvV
501501

502502
// getComponentNameFromObj gets the component name from the k8s object.
503503
func getComponentNameFromObj(obj client.Object) string {
504-
if shardingName, ok := obj.GetLabels()[constant.KBAppShardingNameLabelKey]; ok {
504+
shardingName := obj.GetLabels()[constant.KBAppShardingNameLabelKey]
505+
if shardingName != "" {
505506
return shardingName
506507
}
507508
return obj.GetLabels()[constant.KBAppComponentLabelKey]

0 commit comments

Comments
 (0)