diff --git a/discovery/kubernetes/pod.go b/discovery/kubernetes/pod.go index c3f9fb1c4..044b3bbad 100644 --- a/discovery/kubernetes/pod.go +++ b/discovery/kubernetes/pod.go @@ -216,7 +216,7 @@ func (p *Pod) buildPod(pod *apiv1.Pod) *targetgroup.Group { containers := append(pod.Spec.Containers, pod.Spec.InitContainers...) for i, c := range containers { - is_init := i >= len(pod.Spec.Containers) + isInit := i >= len(pod.Spec.Containers) // If no ports are defined for the container, create an anonymous // target per container. @@ -226,7 +226,7 @@ func (p *Pod) buildPod(pod *apiv1.Pod) *targetgroup.Group { tg.Targets = append(tg.Targets, model.LabelSet{ model.AddressLabel: lv(pod.Status.PodIP), podContainerNameLabel: lv(c.Name), - podContainerIsInit: lv(strconv.FormatBool(is_init)), + podContainerIsInit: lv(strconv.FormatBool(isInit)), }) continue } @@ -241,7 +241,7 @@ func (p *Pod) buildPod(pod *apiv1.Pod) *targetgroup.Group { podContainerPortNumberLabel: lv(ports), podContainerPortNameLabel: lv(port.Name), podContainerPortProtocolLabel: lv(string(port.Protocol)), - podContainerIsInit: lv(strconv.FormatBool(is_init)), + podContainerIsInit: lv(strconv.FormatBool(isInit)), }) } } diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 45d003e88..bf5e21144 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -754,10 +754,10 @@ Available meta labels: * `__meta_kubernetes_pod_annotation_`: Each annotation from the pod object. * `__meta_kubernetes_pod_annotationpresent_`: `true` for each annotation from the pod object. * `__meta_kubernetes_pod_container_name`: Name of the container the target address points to. +* `__meta_kubernetes_pod_container_port_is_init`: `true` if the container is an [InitContainer](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) * `__meta_kubernetes_pod_container_port_name`: Name of the container port. * `__meta_kubernetes_pod_container_port_number`: Number of the container port. * `__meta_kubernetes_pod_container_port_protocol`: Protocol of the container port. -* `__meta_kubernetes_pod_container_port_is_init`: Designates whether the container is an [InitContainer](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) * `__meta_kubernetes_pod_ready`: Set to `true` or `false` for the pod's ready state. * `__meta_kubernetes_pod_phase`: Set to `Pending`, `Running`, `Succeeded`, `Failed` or `Unknown` in the [lifecycle](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase).