Skip to content

include InitContainers in Kubernetes Service Discovery - #5598

Merged
brancz merged 7 commits into
prometheus:masterfrom
tombrk:master
Jun 5, 2019
Merged

brancz merged 7 commits into
prometheus:masterfrom
tombrk:master

Conversation

@tombrk

@tombrk tombrk commented May 26, 2019

Copy link
Copy Markdown
Member

@brian-brazil This PR adds support for InitContainers in Kubernetes SD. Closes #5563

Signed-off-by: sh0rez [email protected]

Includes InitContainers in the ServiceDiscovery

Signed-off-by: sh0rez <[email protected]>
@brian-brazil

Copy link
Copy Markdown
Contributor

Is there a metadata label or something to distinguish these?

@simonpasquier

Copy link
Copy Markdown
Member

At least we should have a metadata label differentiating regular containers from init containers.

tombrk added 2 commits May 27, 2019 17:48
Adds a label that shows whether the container is an init container or not

Signed-off-by: sh0rez <[email protected]>
Adds the new container_is_init label to the current tests to make them pass again

Signed-off-by: sh0rez <[email protected]>
@tombrk

tombrk commented May 27, 2019

Copy link
Copy Markdown
Member Author

@brian-brazil
Is there a metadata label or something to distinguish these?

I've added a new metadata label __meta_kubernetes_pod_container_is_init to distinguish InitContainers from regular ones.
It takes the values "true" if it is an InitContainer, "false" otherwise.

Tests have been adapted.

@simonpasquier

Copy link
Copy Markdown
Member

Can you add a test that where the label is true? You'd also need to mention the label in https://github.com/prometheus/prometheus/blob/master/docs/configuration/configuration.md.

tombrk added 2 commits May 28, 2019 16:51
Adds a test to check whether an InitContainer is included in the discovery

Signed-off-by: sh0rez <[email protected]>
@tombrk

tombrk commented May 28, 2019

Copy link
Copy Markdown
Member Author

@simonpasquier
Can you add a test that where the label is true? You'd also need to mention the label in https://github.com/prometheus/prometheus/blob/master/docs/configuration/configuration.md.

Addressed these

Comment thread discovery/kubernetes/pod.go Resolved
Comment thread docs/configuration/configuration.md Resolved
Comment thread docs/configuration/configuration.md Resolved
Comment thread docs/configuration/configuration.md Resolved
Removes 'is' keyword to comply style guide

Signed-off-by: sh0rez <[email protected]>

@simonpasquier simonpasquier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@bwplotka bwplotka left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we have made a small typo: pod_container_init vs to what was agreed in discussion here pod_container_is_init in resulted label. Seems like ommiting is is what we want. 👍

LGTM and thanks for this, we are looking forward to use this ASAP (:

Comment thread discovery/kubernetes/pod.go Resolved
Comment thread discovery/kubernetes/pod.go Resolved
Comment thread docs/configuration/configuration.md Resolved
Comment thread discovery/kubernetes/pod_test.go Resolved
@tombrk

tombrk commented Jun 5, 2019

Copy link
Copy Markdown
Member Author

@brian-brazil can this one be merged, please? Or are there any blockers I am not aware of? We need this over at grafana/loki as InitContainers are critical for logs.

@brancz

brancz commented Jun 5, 2019

Copy link
Copy Markdown
Member

While in this instance it makes sense for prometheus to have this, I'm not sure this will always hold true for things that external projects need. I don't think that's generally a justification.

@tombrk

tombrk commented Jun 5, 2019

Copy link
Copy Markdown
Member Author

While in this instance it makes sense for prometheus to have this, I'm not sure this will always hold true for things that external projects need. I don't think that's generally a justification.

Of course not! But as this one makes sense for Prometheus and has been approved, I wondered whether it can be merged, to benefit both projects. I just wanted to mention Loki because it was the original motivation for this change :)

@brancz

brancz commented Jun 5, 2019

Copy link
Copy Markdown
Member

lgtm 👍

@brancz
brancz merged commit 9fc3c61 into prometheus:master Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kubernetes service discovery for initContainers

5 participants