getDeploymentOrNil gets a deployment with a certain name, returning nil when it doesn't exist
( ctx context.Context, r client.Client, objectKey client.ObjectKey, )
| 175 | |
| 176 | // getDeploymentOrNil gets a deployment with a certain name, returning nil when it doesn't exist |
| 177 | func getDeploymentOrNil( |
| 178 | ctx context.Context, r client.Client, objectKey client.ObjectKey, |
| 179 | ) (*appsv1.Deployment, error) { |
| 180 | var deployment appsv1.Deployment |
| 181 | err := r.Get(ctx, objectKey, &deployment) |
| 182 | if err != nil { |
| 183 | if apierrs.IsNotFound(err) { |
| 184 | return nil, nil |
| 185 | } |
| 186 | |
| 187 | return nil, err |
| 188 | } |
| 189 | |
| 190 | return &deployment, nil |
| 191 | } |
| 192 | |
| 193 | // getServiceOrNil gets a service with a certain name, returning nil when it doesn't exist |
| 194 | func getServiceOrNil(ctx context.Context, r client.Client, objectKey client.ObjectKey) (*corev1.Service, error) { |
no test coverage detected