Update label from `class` to `class_name`

Signed-off-by: Mike Eves <michael.eves@autotrader.co.uk>
pull/8916/head
Mike Eves 4 years ago
parent aab51ffe2a
commit 7e1111ff14

@ -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 {

@ -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,
},

@ -1342,7 +1342,7 @@ Available meta labels:
* `__meta_kubernetes_ingress_labelpresent_<labelname>`: `true` for each label from the ingress object.
* `__meta_kubernetes_ingress_annotation_<annotationname>`: Each annotation from the ingress object.
* `__meta_kubernetes_ingress_annotationpresent_<annotationname>`: `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 `/`.

Loading…
Cancel
Save