diff --git a/discovery/kubernetes/pod.go b/discovery/kubernetes/pod.go index 044b3bbad..4f522e96a 100644 --- a/discovery/kubernetes/pod.go +++ b/discovery/kubernetes/pod.go @@ -141,7 +141,7 @@ const ( podContainerPortNameLabel = metaLabelPrefix + "pod_container_port_name" podContainerPortNumberLabel = metaLabelPrefix + "pod_container_port_number" podContainerPortProtocolLabel = metaLabelPrefix + "pod_container_port_protocol" - podContainerIsInit = metaLabelPrefix + "pod_container_is_init" + podContainerIsInit = metaLabelPrefix + "pod_container_init" podReadyLabel = metaLabelPrefix + "pod_ready" podPhaseLabel = metaLabelPrefix + "pod_phase" podLabelPrefix = metaLabelPrefix + "pod_label_" diff --git a/discovery/kubernetes/pod_test.go b/discovery/kubernetes/pod_test.go index dcf16cd14..25952de4e 100644 --- a/discovery/kubernetes/pod_test.go +++ b/discovery/kubernetes/pod_test.go @@ -170,7 +170,7 @@ func expectedPodTargetGroups(ns string) map[string]*targetgroup.Group { "__meta_kubernetes_pod_container_port_name": "testport", "__meta_kubernetes_pod_container_port_number": "9000", "__meta_kubernetes_pod_container_port_protocol": "TCP", - "__meta_kubernetes_pod_container_is_init": "false", + "__meta_kubernetes_pod_container_init": "false", }, }, Labels: model.LabelSet{ @@ -207,7 +207,7 @@ func TestPodDiscoveryBeforeRun(t *testing.T) { "__meta_kubernetes_pod_container_port_name": "testport0", "__meta_kubernetes_pod_container_port_number": "9000", "__meta_kubernetes_pod_container_port_protocol": "TCP", - "__meta_kubernetes_pod_container_is_init": "false", + "__meta_kubernetes_pod_container_init": "false", }, { "__address__": "1.2.3.4:9001", @@ -215,12 +215,12 @@ func TestPodDiscoveryBeforeRun(t *testing.T) { "__meta_kubernetes_pod_container_port_name": "testport1", "__meta_kubernetes_pod_container_port_number": "9001", "__meta_kubernetes_pod_container_port_protocol": "UDP", - "__meta_kubernetes_pod_container_is_init": "false", + "__meta_kubernetes_pod_container_init": "false", }, { - "__address__": "1.2.3.4", - "__meta_kubernetes_pod_container_name": "testcontainer1", - "__meta_kubernetes_pod_container_is_init": "false", + "__address__": "1.2.3.4", + "__meta_kubernetes_pod_container_name": "testcontainer1", + "__meta_kubernetes_pod_container_init": "false", }, }, Labels: model.LabelSet{ @@ -252,9 +252,9 @@ func TestPodDiscoveryInitContainer(t *testing.T) { key := fmt.Sprintf("pod/%s/testpod", ns) expected := expectedPodTargetGroups(ns) expected[key].Targets = append(expected[key].Targets, model.LabelSet{ - "__address__": "1.2.3.4", - "__meta_kubernetes_pod_container_name": "initcontainer", - "__meta_kubernetes_pod_container_is_init": "true", + "__address__": "1.2.3.4", + "__meta_kubernetes_pod_container_name": "initcontainer", + "__meta_kubernetes_pod_container_init": "true", }) expected[key].Labels["__meta_kubernetes_pod_phase"] = "Pending" expected[key].Labels["__meta_kubernetes_pod_ready"] = "false" diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index bf5e21144..e631cd674 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -753,8 +753,8 @@ Available meta labels: * `__meta_kubernetes_pod_labelpresent_`: `true`for each label from the pod object. * `__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_init`: `true` if the container is an [InitContainer](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) * `__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.