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

Conversation

@igorpeshansky
Copy link
Contributor

Also a minor refactoring of the watch code.

constexpr const int kMetadataApiDefaultPort = 8000;
constexpr const char kMetadataApiDefaultResourceTypeSeparator[] = ".";
constexpr const int kMetadataReporterDefaultIntervalSeconds = 60;
constexpr const int kMetadataReporterDefaultPurgeDeleted = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be defaulting to true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather put this through a few more tests. It can be overridden in the config map if necessary.

};

if (container_status) {
if (container_status && container_status->Has("containerID")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this added? Do we directly depend on this property 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.

Yes, right below. The deletion events apparently had a status without a container id.

std::unique_lock<std::mutex> watch_completion(completion_mutex);
Watcher watcher(callback, std::move(watch_completion),
config_.VerboseLogging());
Watcher watcher(std::bind(&EventCallback, callback, std::placeholders::_1),
Copy link
Contributor

Choose a reason for hiding this comment

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

std::placeholders::_N leaves me a bit puzzled. Is there a way of doing these methods without using unbound arguments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They confuse me too. Unfortunately, there is no better way.
If it helps, think about std::bind as: you have to list all of the arguments to the bound function, but some of those can represent the arguments to the function being called -- that's what placeholders are (std::placeholders::_1 is the first argument to the resulting function).

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.

Thanks for the review. PTAL.

constexpr const int kMetadataApiDefaultPort = 8000;
constexpr const char kMetadataApiDefaultResourceTypeSeparator[] = ".";
constexpr const int kMetadataReporterDefaultIntervalSeconds = 60;
constexpr const int kMetadataReporterDefaultPurgeDeleted = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather put this through a few more tests. It can be overridden in the config map if necessary.

};

if (container_status) {
if (container_status && container_status->Has("containerID")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, right below. The deletion events apparently had a status without a container id.

std::unique_lock<std::mutex> watch_completion(completion_mutex);
Watcher watcher(callback, std::move(watch_completion),
config_.VerboseLogging());
Watcher watcher(std::bind(&EventCallback, callback, std::placeholders::_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.

They confuse me too. Unfortunately, there is no better way.
If it helps, think about std::bind as: you have to list all of the arguments to the bound function, but some of those can represent the arguments to the function being called -- that's what placeholders are (std::placeholders::_1 is the first argument to the resulting function).

Copy link
Contributor

@supriyagarg supriyagarg left a comment

Choose a reason for hiding this comment

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

LGTM

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

@igorpeshansky igorpeshansky force-pushed the igorp-kubernetes-deletion-events branch from 4d3eadd to 9c46711 Compare February 26, 2018 17:31
@igorpeshansky
Copy link
Contributor Author

Rebased off master.

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 :shipit:

@igorpeshansky igorpeshansky merged commit 7880c04 into master Feb 26, 2018
@igorpeshansky igorpeshansky deleted the igorp-kubernetes-deletion-events branch February 26, 2018 17:38
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.

3 participants