Skip to content

Commit c6b01a3

Browse files
committed
Added GetResourceBindings helper function for APIBinding's LogicalCluster lock
On-behalf-of: @SAP [email protected] Signed-off-by: Robert Vasek <[email protected]>
1 parent c4f16ce commit c6b01a3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/reconciler/apis/apibinding/logical_cluster_lock.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ func UnmarshalResourceBindingsAnnotation(ann string) (ResourceBindingsAnnotation
7575
return rbs, nil
7676
}
7777

78+
// GetResourceBindings reads ResourceBindingsAnnotation from LogicalCluster's annotation.
79+
func GetResourceBindings(lc *corev1alpha1.LogicalCluster) (ResourceBindingsAnnotation, error) {
80+
const jsonEmptyObj = "{}"
81+
82+
ann := lc.Annotations[ResourceBindingsAnnotationKey]
83+
if ann == "" {
84+
ann = jsonEmptyObj
85+
}
86+
87+
return UnmarshalResourceBindingsAnnotation(ann)
88+
}
89+
7890
// WithLockedResources tries to lock the resources for the given binding. It
7991
// returns those resources that got successfully locked. If a resource is already
8092
// locked by another binding, it is skipped and returned in the second return

0 commit comments

Comments
 (0)