Skip to content

Commit

Permalink
reconciler/permissionclaim: don't depend on nil/empty distinction in …
Browse files Browse the repository at this point in the history
…LabelFor
  • Loading branch information
sttts committed Aug 15, 2022
1 parent e3dca18 commit 8d2ed6a
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,14 @@ func (c *resourceController) reconcile(ctx context.Context, obj *unstructured.Un
return fmt.Errorf("error calculating permission claim labels for GVR %q %s/%s: %w", gvr, obj.GetNamespace(), obj.GetName(), err)
}

labels := obj.GetLabels()
if labels == nil {
labels = make(map[string]string)
}

actualClaimLabels := make(map[string]string)
for k, v := range labels {
for k, v := range obj.GetLabels() {
if strings.HasPrefix(k, apisv1alpha1.APIExportPermissionClaimLabelPrefix) {
actualClaimLabels[k] = v
}
}

if reflect.DeepEqual(expectedLabels, actualClaimLabels) {
if (len(expectedLabels) == 0 && len(actualClaimLabels) == 0) || reflect.DeepEqual(expectedLabels, actualClaimLabels) {
return nil
}

Expand Down

0 comments on commit 8d2ed6a

Please sign in to comment.