From 7e1111ff141f19887013977f570eb02ec002705c Mon Sep 17 00:00:00 2001 From: Mike Eves Date: Fri, 11 Jun 2021 13:43:22 +0100 Subject: [PATCH] Update label from `class` to `class_name` Signed-off-by: Mike Eves --- discovery/kubernetes/ingress.go | 6 +++--- discovery/kubernetes/ingress_test.go | 10 +++++----- docs/configuration/configuration.md | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/discovery/kubernetes/ingress.go b/discovery/kubernetes/ingress.go index b638421f3..68b4797ed 100644 --- a/discovery/kubernetes/ingress.go +++ b/discovery/kubernetes/ingress.go @@ -147,7 +147,7 @@ const ( ingressSchemeLabel = metaLabelPrefix + "ingress_scheme" ingressHostLabel = metaLabelPrefix + "ingress_host" ingressPathLabel = metaLabelPrefix + "ingress_path" - ingressClassLabel = metaLabelPrefix + "ingress_class" + ingressClassNameLabel = metaLabelPrefix + "ingress_class_name" ) func ingressLabels(ingress *v1beta1.Ingress) model.LabelSet { @@ -156,9 +156,9 @@ func ingressLabels(ingress *v1beta1.Ingress) model.LabelSet { ls[ingressNameLabel] = lv(ingress.Name) ls[namespaceLabel] = lv(ingress.Namespace) if ingress.Spec.IngressClassName == nil { - ls[ingressClassLabel] = lv("") + ls[ingressClassNameLabel] = lv("") } else { - ls[ingressClassLabel] = lv(*ingress.Spec.IngressClassName) + ls[ingressClassNameLabel] = lv(*ingress.Spec.IngressClassName) } for k, v := range ingress.Labels { diff --git a/discovery/kubernetes/ingress_test.go b/discovery/kubernetes/ingress_test.go index ff0cd46e8..02c566468 100644 --- a/discovery/kubernetes/ingress_test.go +++ b/discovery/kubernetes/ingress_test.go @@ -33,7 +33,7 @@ const ( TLSMixed ) -func makeIngress(tls TLSMode, excludeClass bool) *v1beta1.Ingress { +func makeIngress(tls TLSMode, excludeClassName bool) *v1beta1.Ingress { ret := &v1beta1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "testingress", @@ -82,7 +82,7 @@ func makeIngress(tls TLSMode, excludeClass bool) *v1beta1.Ingress { ret.Spec.TLS = []v1beta1.IngressTLS{{Hosts: []string{"example.com"}}} } - if excludeClass { + if excludeClassName { ret.Spec.IngressClassName = nil } @@ -93,7 +93,7 @@ func classString(v string) *string { return &v } -func expectedTargetGroups(ns string, tls TLSMode, excludeClass bool) map[string]*targetgroup.Group { +func expectedTargetGroups(ns string, tls TLSMode, excludeClassName bool) map[string]*targetgroup.Group { scheme1 := "http" scheme2 := "http" @@ -107,7 +107,7 @@ func expectedTargetGroups(ns string, tls TLSMode, excludeClass bool) map[string] scheme1 = "https" } - if excludeClass { + if excludeClassName { ingressClassName = "" } @@ -141,7 +141,7 @@ func expectedTargetGroups(ns string, tls TLSMode, excludeClass bool) map[string] "__meta_kubernetes_ingress_labelpresent_test_label": "true", "__meta_kubernetes_ingress_annotation_test_annotation": "testannotationvalue", "__meta_kubernetes_ingress_annotationpresent_test_annotation": "true", - "__meta_kubernetes_ingress_class": lv(ingressClassName), + "__meta_kubernetes_ingress_class_name": lv(ingressClassName), }, Source: key, }, diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 70fd570c4..87a55051e 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -1342,7 +1342,7 @@ Available meta labels: * `__meta_kubernetes_ingress_labelpresent_`: `true` for each label from the ingress object. * `__meta_kubernetes_ingress_annotation_`: Each annotation from the ingress object. * `__meta_kubernetes_ingress_annotationpresent_`: `true` for each annotation from the ingress object. -* `__meta_kubernetes_ingress_class`: Class from ingress spec, if present. +* `__meta_kubernetes_ingress_class_name`: Class name from ingress spec, if present. * `__meta_kubernetes_ingress_scheme`: Protocol scheme of ingress, `https` if TLS config is set. Defaults to `http`. * `__meta_kubernetes_ingress_path`: Path from ingress spec. Defaults to `/`.