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

Fix container spec/status order mismatch.#47

Merged
igorpeshansky merged 2 commits intomasterfrom
igorp-kubernetes-container-lists
Jan 2, 2018
Merged

Fix container spec/status order mismatch.#47
igorpeshansky merged 2 commits intomasterfrom
igorp-kubernetes-container-lists

Conversation

@igorpeshansky
Copy link
Copy Markdown
Contributor

No description provided.

…er, look up containers by name, rather than by index.
Copy link
Copy Markdown
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.

Comment thread src/kubernetes.cc Outdated
result.emplace_back(GetLegacyResource(pod, name));
result.emplace_back(
GetContainerMetadata(pod, i, associations->Clone(), collected_at));
GetContainerMetadata(pod, container, container_spec,
Copy link
Copy Markdown
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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+1

Copy link
Copy Markdown
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
Copy Markdown

@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.

Comment thread src/kubernetes.cc Outdated
result.emplace_back(GetLegacyResource(pod, name));
result.emplace_back(
GetContainerMetadata(pod, i, associations->Clone(), collected_at));
GetContainerMetadata(pod, container, container_spec,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

+1

Comment thread 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
Copy Markdown
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
Copy Markdown
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.

Comment thread src/kubernetes.h
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment thread src/kubernetes.cc
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
Copy Markdown
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
Copy Markdown
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).

Comment thread src/kubernetes.cc
{"status", json::object({
{"version", json::string(kKubernetesApiVersion)},
{"raw", container->Clone()},
{"raw", container_status->Clone()},
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread src/kubernetes.cc
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
Copy Markdown
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).

Comment thread src/kubernetes.cc Outdated
result.emplace_back(GetLegacyResource(pod, name));
result.emplace_back(
GetContainerMetadata(pod, i, associations->Clone(), collected_at));
GetContainerMetadata(pod, container, container_spec,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment thread 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
Copy Markdown
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.

Comment thread src/kubernetes.h
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
Copy Markdown
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