(deployedResource *operator.DeployedResource)
| 243 | } |
| 244 | |
| 245 | func DescribeAPIByName(deployedResource *operator.DeployedResource) ([]schema.APIResponse, error) { |
| 246 | deployment, err := config.K8s.GetDeployment(workloads.K8sName(deployedResource.Name)) |
| 247 | if err != nil { |
| 248 | return nil, err |
| 249 | } |
| 250 | |
| 251 | if deployment == nil { |
| 252 | return nil, errors.ErrorUnexpected("unable to find deployment", deployedResource.Name) |
| 253 | } |
| 254 | |
| 255 | apiStatus := status.FromDeployment(deployment) |
| 256 | apiMetadata, err := spec.MetadataFromDeployment(deployment) |
| 257 | if err != nil { |
| 258 | return nil, errors.ErrorUnexpected("unable to obtain metadata", deployedResource.Name) |
| 259 | } |
| 260 | |
| 261 | pods, err := config.K8s.ListPodsByLabel("apiName", deployment.Labels["apiName"]) |
| 262 | if err != nil { |
| 263 | return nil, err |
| 264 | } |
| 265 | apiStatus.ReplicaCounts = GetReplicaCounts(deployment, pods) |
| 266 | |
| 267 | apiEndpoint, err := operator.APIEndpointFromResource(deployedResource) |
| 268 | if err != nil { |
| 269 | return nil, err |
| 270 | } |
| 271 | |
| 272 | dashboardURL := pointer.String(getDashboardURL(deployedResource.Name)) |
| 273 | |
| 274 | return []schema.APIResponse{ |
| 275 | { |
| 276 | Metadata: apiMetadata, |
| 277 | Status: apiStatus, |
| 278 | Endpoint: &apiEndpoint, |
| 279 | DashboardURL: dashboardURL, |
| 280 | }, |
| 281 | }, nil |
| 282 | } |
| 283 | |
| 284 | func getK8sResources(apiName string) (*kapps.Deployment, *kcore.Service, *istioclientnetworking.VirtualService, error) { |
| 285 | var deployment *kapps.Deployment |
no test coverage detected