diff --git a/internal/store/ingress.go b/internal/store/ingress.go index fae13e7cac..ffa92c0e3e 100644 --- a/internal/store/ingress.go +++ b/internal/store/ingress.go @@ -147,6 +147,12 @@ func ingressMetricFamilies(allowAnnotationsList, allowLabelsList []string) []gen LabelValues: []string{rule.Host, path.Path, path.Backend.Service.Name, strconv.Itoa(int(path.Backend.Service.Port.Number))}, Value: 1, }) + } else { + ms = append(ms, &metric.Metric{ + LabelKeys: []string{"host", "path", "service_name", "service_port"}, + LabelValues: []string{rule.Host, path.Path, "", ""}, + Value: 1, + }) } } } diff --git a/internal/store/ingress_test.go b/internal/store/ingress_test.go index a9754bb65e..eb802b22ab 100644 --- a/internal/store/ingress_test.go +++ b/internal/store/ingress_test.go @@ -19,6 +19,7 @@ package store import ( "testing" + v1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -144,6 +145,15 @@ func TestIngressStore(t *testing.T) { }, }, }, + { + Path: "/somepath2", + Backend: networkingv1.IngressBackend{ + Resource: &v1.TypedLocalObjectReference{ + Kind: "somekind", + Name: "somename", + }, + }, + }, }, }, }, @@ -159,6 +169,7 @@ func TestIngressStore(t *testing.T) { kube_ingress_created{namespace="ns4",ingress="ingress4"} 1.501569018e+09 kube_ingress_labels{namespace="ns4",ingress="ingress4"} 1 kube_ingress_path{namespace="ns4",ingress="ingress4",host="somehost",path="/somepath",service_name="someservice",service_port="1234"} 1 + kube_ingress_path{namespace="ns4",ingress="ingress4",host="somehost",path="/somepath2",service_name="",service_port=""} 1 `, MetricNames: []string{"kube_ingress_info", "kube_ingress_metadata_resource_version", "kube_ingress_created", "kube_ingress_labels", "kube_ingress_path", "kube_ingress_tls"}, },