Browse Source

fix(style): container_is_init to container_init

Removes 'is' keyword to comply style guide

Signed-off-by: sh0rez <me@shorez.de>
pull/5598/head
sh0rez 6 years ago
parent
commit
8ba23fb336
No known key found for this signature in database
GPG Key ID: 87C71DF9F8181FF1
  1. 2
      discovery/kubernetes/pod.go
  2. 18
      discovery/kubernetes/pod_test.go
  3. 2
      docs/configuration/configuration.md

2
discovery/kubernetes/pod.go

@ -141,7 +141,7 @@ const (
podContainerPortNameLabel = metaLabelPrefix + "pod_container_port_name" podContainerPortNameLabel = metaLabelPrefix + "pod_container_port_name"
podContainerPortNumberLabel = metaLabelPrefix + "pod_container_port_number" podContainerPortNumberLabel = metaLabelPrefix + "pod_container_port_number"
podContainerPortProtocolLabel = metaLabelPrefix + "pod_container_port_protocol" podContainerPortProtocolLabel = metaLabelPrefix + "pod_container_port_protocol"
podContainerIsInit = metaLabelPrefix + "pod_container_is_init" podContainerIsInit = metaLabelPrefix + "pod_container_init"
podReadyLabel = metaLabelPrefix + "pod_ready" podReadyLabel = metaLabelPrefix + "pod_ready"
podPhaseLabel = metaLabelPrefix + "pod_phase" podPhaseLabel = metaLabelPrefix + "pod_phase"
podLabelPrefix = metaLabelPrefix + "pod_label_" podLabelPrefix = metaLabelPrefix + "pod_label_"

18
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_name": "testport",
"__meta_kubernetes_pod_container_port_number": "9000", "__meta_kubernetes_pod_container_port_number": "9000",
"__meta_kubernetes_pod_container_port_protocol": "TCP", "__meta_kubernetes_pod_container_port_protocol": "TCP",
"__meta_kubernetes_pod_container_is_init": "false", "__meta_kubernetes_pod_container_init": "false",
}, },
}, },
Labels: model.LabelSet{ Labels: model.LabelSet{
@ -207,7 +207,7 @@ func TestPodDiscoveryBeforeRun(t *testing.T) {
"__meta_kubernetes_pod_container_port_name": "testport0", "__meta_kubernetes_pod_container_port_name": "testport0",
"__meta_kubernetes_pod_container_port_number": "9000", "__meta_kubernetes_pod_container_port_number": "9000",
"__meta_kubernetes_pod_container_port_protocol": "TCP", "__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", "__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_name": "testport1",
"__meta_kubernetes_pod_container_port_number": "9001", "__meta_kubernetes_pod_container_port_number": "9001",
"__meta_kubernetes_pod_container_port_protocol": "UDP", "__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", "__address__": "1.2.3.4",
"__meta_kubernetes_pod_container_name": "testcontainer1", "__meta_kubernetes_pod_container_name": "testcontainer1",
"__meta_kubernetes_pod_container_is_init": "false", "__meta_kubernetes_pod_container_init": "false",
}, },
}, },
Labels: model.LabelSet{ Labels: model.LabelSet{
@ -252,9 +252,9 @@ func TestPodDiscoveryInitContainer(t *testing.T) {
key := fmt.Sprintf("pod/%s/testpod", ns) key := fmt.Sprintf("pod/%s/testpod", ns)
expected := expectedPodTargetGroups(ns) expected := expectedPodTargetGroups(ns)
expected[key].Targets = append(expected[key].Targets, model.LabelSet{ expected[key].Targets = append(expected[key].Targets, model.LabelSet{
"__address__": "1.2.3.4", "__address__": "1.2.3.4",
"__meta_kubernetes_pod_container_name": "initcontainer", "__meta_kubernetes_pod_container_name": "initcontainer",
"__meta_kubernetes_pod_container_is_init": "true", "__meta_kubernetes_pod_container_init": "true",
}) })
expected[key].Labels["__meta_kubernetes_pod_phase"] = "Pending" expected[key].Labels["__meta_kubernetes_pod_phase"] = "Pending"
expected[key].Labels["__meta_kubernetes_pod_ready"] = "false" expected[key].Labels["__meta_kubernetes_pod_ready"] = "false"

2
docs/configuration/configuration.md

@ -753,8 +753,8 @@ Available meta labels:
* `__meta_kubernetes_pod_labelpresent_<labelname>`: `true`for each label from the pod object. * `__meta_kubernetes_pod_labelpresent_<labelname>`: `true`for each label from the pod object.
* `__meta_kubernetes_pod_annotation_<annotationname>`: Each annotation from the pod object. * `__meta_kubernetes_pod_annotation_<annotationname>`: Each annotation from the pod object.
* `__meta_kubernetes_pod_annotationpresent_<annotationname>`: `true` for each annotation from the pod object. * `__meta_kubernetes_pod_annotationpresent_<annotationname>`: `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_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_name`: Name of the container port.
* `__meta_kubernetes_pod_container_port_number`: Number 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_protocol`: Protocol of the container port.

Loading…
Cancel
Save