getClusterOrNil gets a cluster with a certain name, returning nil when it doesn't exist
(ctx context.Context, r client.Client, objectKey client.ObjectKey)
| 275 | |
| 276 | // getClusterOrNil gets a cluster with a certain name, returning nil when it doesn't exist |
| 277 | func getClusterOrNil(ctx context.Context, r client.Client, objectKey client.ObjectKey) (*apiv1.Cluster, error) { |
| 278 | var cluster apiv1.Cluster |
| 279 | err := r.Get(ctx, objectKey, &cluster) |
| 280 | if err != nil { |
| 281 | if apierrs.IsNotFound(err) { |
| 282 | return nil, nil |
| 283 | } |
| 284 | |
| 285 | return nil, err |
| 286 | } |
| 287 | |
| 288 | return &cluster, nil |
| 289 | } |
no test coverage detected