(deployedResource *operator.DeployedResource)
| 310 | } |
| 311 | |
| 312 | func DescribeAPIByName(deployedResource *operator.DeployedResource) ([]schema.APIResponse, error) { |
| 313 | var apiDeployment *kapps.Deployment |
| 314 | |
| 315 | apiDeployment, err := config.K8s.GetDeployment(workloads.K8sName(deployedResource.Name)) |
| 316 | if err != nil { |
| 317 | return nil, err |
| 318 | } |
| 319 | |
| 320 | if apiDeployment == nil { |
| 321 | return nil, errors.ErrorUnexpected("unable to find api deployment", deployedResource.Name) |
| 322 | } |
| 323 | |
| 324 | apiStatus := status.FromDeployment(apiDeployment) |
| 325 | apiMetadata, err := spec.MetadataFromDeployment(apiDeployment) |
| 326 | if err != nil { |
| 327 | return nil, errors.ErrorUnexpected("unable to obtain metadata", deployedResource.Name) |
| 328 | } |
| 329 | |
| 330 | apiPods, err := config.K8s.ListPodsByLabels(map[string]string{ |
| 331 | "apiName": apiDeployment.Labels["apiName"], |
| 332 | }) |
| 333 | if err != nil { |
| 334 | return nil, err |
| 335 | } |
| 336 | apiStatus.ReplicaCounts = GetReplicaCounts(apiDeployment, apiPods) |
| 337 | |
| 338 | apiEndpoint, err := operator.APIEndpointFromResource(deployedResource) |
| 339 | if err != nil { |
| 340 | return nil, err |
| 341 | } |
| 342 | |
| 343 | dashboardURL := pointer.String(getDashboardURL(deployedResource.Name)) |
| 344 | |
| 345 | return []schema.APIResponse{ |
| 346 | { |
| 347 | Metadata: apiMetadata, |
| 348 | Status: apiStatus, |
| 349 | Endpoint: &apiEndpoint, |
| 350 | DashboardURL: dashboardURL, |
| 351 | }, |
| 352 | }, nil |
| 353 | } |
| 354 | |
| 355 | func UpdateAPIMetricsCron(apiDeployment *kapps.Deployment) error { |
| 356 | apiName := apiDeployment.Labels["apiName"] |
no test coverage detected