GetConditionsInClusterStatus get conditions values as given type from cluster object status
( ctx context.Context, crudClient client.Client, namespace, clusterName string, conditionType apiv1.ClusterConditionType, )
| 112 | |
| 113 | // GetConditionsInClusterStatus get conditions values as given type from cluster object status |
| 114 | func GetConditionsInClusterStatus( |
| 115 | ctx context.Context, |
| 116 | crudClient client.Client, |
| 117 | namespace, |
| 118 | clusterName string, |
| 119 | conditionType apiv1.ClusterConditionType, |
| 120 | ) (*metav1.Condition, error) { |
| 121 | var cluster *apiv1.Cluster |
| 122 | var err error |
| 123 | |
| 124 | cluster, err = clusterutils.Get(ctx, crudClient, namespace, clusterName) |
| 125 | if err != nil { |
| 126 | return nil, err |
| 127 | } |
| 128 | |
| 129 | for _, cond := range cluster.Status.Conditions { |
| 130 | if cond.Type == string(conditionType) { |
| 131 | return &cond, nil |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | return nil, fmt.Errorf("no condition matching requested type found: %v", conditionType) |
| 136 | } |
| 137 | |
| 138 | // Execute performs a backup and checks the backup status |
| 139 | func Execute( |