Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Conversation

@igorpeshansky
Copy link
Contributor

No description provided.

…er, look up containers by name, rather than by index.
Copy link
Contributor

@bmoyles0117 bmoyles0117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use container_status instead of container?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

@qingling128 qingling128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

result.emplace_back(GetLegacyResource(pod, name));
result.emplace_back(
GetContainerMetadata(pod, i, associations->Clone(), collected_at));
GetContainerMetadata(pod, container, container_spec,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

src/kubernetes.h Outdated
@@ -89,12 +89,13 @@ class KubernetesReader {
const throw(json::Exception);
// Given a pod object and container index, return the container metadata.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the comment here. There is no more container index being passed in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the container ID is not used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used in line 318 (hidden by the diff).

{"status", json::object({
{"version", json::string(kKubernetesApiVersion)},
{"raw", container->Clone()},
{"raw", container_status->Clone()},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not add the spec to the "raw" metadata as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, the lines are right above hidden in the diff.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thanks Brian.

- Rename variable.
- Update method comments.
Copy link
Contributor Author

@igorpeshansky igorpeshansky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

src/kubernetes.h Outdated
@@ -89,12 +89,13 @@ class KubernetesReader {
const throw(json::Exception);
// Given a pod object and container index, return the container metadata.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@igorpeshansky igorpeshansky merged commit 8a58544 into master Jan 2, 2018
@igorpeshansky igorpeshansky deleted the igorp-kubernetes-container-lists branch January 2, 2018 17:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants