MCPcopy Create free account
hub / github.com/crossplane-contrib/function-patch-and-transform / IsReady

Function IsReady

ready.go:41–57  ·  view source on GitHub ↗

IsReady returns whether the composed resource is ready.

(_ context.Context, o ConditionedObject, rc ...v1beta1.ReadinessCheck)

Source from the content-addressed store, hash-verified

39
40// IsReady returns whether the composed resource is ready.
41func IsReady(_ context.Context, o ConditionedObject, rc ...v1beta1.ReadinessCheck) (bool, error) {
42 // We don't have API server defaulting, so we default here.
43 if len(rc) == 0 {
44 return resource.IsConditionTrue(o.GetCondition(xpv1.TypeReady)), nil
45 }
46
47 for i := range rc {
48 ready, err := RunReadinessCheck(rc[i], o)
49 if err != nil {
50 return false, errors.Wrapf(err, errFmtRunCheck, i)
51 }
52 if !ready {
53 return false, nil
54 }
55 }
56 return true, nil
57}
58
59// RunReadinessCheck runs the readiness check against the supplied object.
60func RunReadinessCheck(c v1beta1.ReadinessCheck, o ConditionedObject) (bool, error) { //nolint:gocyclo // just a switch

Callers 2

RunFunctionMethod · 0.85
TestIsReadyFunction · 0.85

Calls 1

RunReadinessCheckFunction · 0.85

Tested by 1

TestIsReadyFunction · 0.68