mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 14:09:41 -08:00
feat(discovery/kubernetes): include InitContainers
Includes InitContainers in the ServiceDiscovery Signed-off-by: sh0rez <me@shorez.de>
This commit is contained in:
parent
212ff4b659
commit
bea07fe866
|
@ -213,7 +213,8 @@ func (p *Pod) buildPod(pod *apiv1.Pod) *targetgroup.Group {
|
||||||
tg.Labels = podLabels(pod)
|
tg.Labels = podLabels(pod)
|
||||||
tg.Labels[namespaceLabel] = lv(pod.Namespace)
|
tg.Labels[namespaceLabel] = lv(pod.Namespace)
|
||||||
|
|
||||||
for _, c := range pod.Spec.Containers {
|
containers := append(pod.Spec.Containers, pod.Spec.InitContainers...)
|
||||||
|
for _, c := range containers {
|
||||||
// If no ports are defined for the container, create an anonymous
|
// If no ports are defined for the container, create an anonymous
|
||||||
// target per container.
|
// target per container.
|
||||||
if len(c.Ports) == 0 {
|
if len(c.Ports) == 0 {
|
||||||
|
|
Loading…
Reference in a new issue