Fix container spec/status order mismatch.#47
Conversation
…er, look up containers by name, rather than by index.
bmoyles0117
left a comment
There was a problem hiding this comment.
LGTM 🦑 Only one minor comment.
| result.emplace_back(GetLegacyResource(pod, name)); | ||
| result.emplace_back( | ||
| GetContainerMetadata(pod, i, associations->Clone(), collected_at)); | ||
| GetContainerMetadata(pod, container, container_spec, |
There was a problem hiding this comment.
Can we use container_status instead of container?
| result.emplace_back(GetLegacyResource(pod, name)); | ||
| result.emplace_back( | ||
| GetContainerMetadata(pod, i, associations->Clone(), collected_at)); | ||
| GetContainerMetadata(pod, container, container_spec, |
| @@ -89,12 +89,13 @@ class KubernetesReader { | |||
| const throw(json::Exception); | |||
| // Given a pod object and container index, return the container metadata. | |||
There was a problem hiding this comment.
Please update the comment here. There is no more container index being passed in.
There was a problem hiding this comment.
Good catch. Done.
| const json::Object* container_spec, json::value associations, | ||
| Timestamp collected_at) const throw(json::Exception); | ||
| // Given a pod object and container index, return the legacy resource. | ||
| // The returned "metadata" field will be Metadata::IGNORED. |
| const std::string container_id = | ||
| container->Get<json::String>("containerID").substr( | ||
| docker_prefix_end); | ||
| const std::string container_id = docker_id.substr(docker_prefix_end); |
There was a problem hiding this comment.
the container ID is not used anywhere.
There was a problem hiding this comment.
It's used in line 318 (hidden by the diff).
| {"status", json::object({ | ||
| {"version", json::string(kKubernetesApiVersion)}, | ||
| {"raw", container->Clone()}, | ||
| {"raw", container_status->Clone()}, |
There was a problem hiding this comment.
why not add the spec to the "raw" metadata as well?
There was a problem hiding this comment.
It is, the lines are right above hidden in the diff.
- Rename variable. - Update method comments.
igorpeshansky
left a comment
There was a problem hiding this comment.
Addressed feedback. PTAL.
| const std::string container_id = | ||
| container->Get<json::String>("containerID").substr( | ||
| docker_prefix_end); | ||
| const std::string container_id = docker_id.substr(docker_prefix_end); |
There was a problem hiding this comment.
It's used in line 318 (hidden by the diff).
| result.emplace_back(GetLegacyResource(pod, name)); | ||
| result.emplace_back( | ||
| GetContainerMetadata(pod, i, associations->Clone(), collected_at)); | ||
| GetContainerMetadata(pod, container, container_spec, |
| @@ -89,12 +89,13 @@ class KubernetesReader { | |||
| const throw(json::Exception); | |||
| // Given a pod object and container index, return the container metadata. | |||
There was a problem hiding this comment.
Good catch. Done.
| const json::Object* container_spec, json::value associations, | ||
| Timestamp collected_at) const throw(json::Exception); | ||
| // Given a pod object and container index, return the legacy resource. | ||
| // The returned "metadata" field will be Metadata::IGNORED. |
No description provided.