Skip to content

Commit

Permalink
generate work name based on different resource (karmada-io#232)
Browse files Browse the repository at this point in the history
Signed-off-by: lihanbo <[email protected]>
  • Loading branch information
mrlihanbo authored Mar 25, 2021
1 parent 51d5662 commit 65a4f32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/controllers/status/workstatus_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ func (c *WorkStatusController) handleDeleteEvent(key string) error {
return err
}

workName := names.GenerateBindingName(clusterWorkload.Namespace, clusterWorkload.GVK.Kind, clusterWorkload.Name)
var workName string
if clusterWorkload.Namespace == "" {
workName = names.GenerateClusterResourceBindingName(clusterWorkload.GVK.Kind, clusterWorkload.Name)
} else {
workName = names.GenerateBindingName(clusterWorkload.Namespace, clusterWorkload.GVK.Kind, clusterWorkload.Name)
}

work := &workv1alpha1.Work{}
if err := c.Client.Get(context.TODO(), client.ObjectKey{Namespace: executionSpace, Name: workName}, work); err != nil {
// Stop processing if resource no longer exist.
Expand Down

0 comments on commit 65a4f32

Please sign in to comment.