Update label from class to class_name

Signed-off-by: Mike Eves <michael.eves@autotrader.co.uk>
This commit is contained in:
Mike Eves 2021-06-11 13:43:22 +01:00
parent aab51ffe2a
commit 7e1111ff14
3 changed files with 9 additions and 9 deletions

View File

@ -147,7 +147,7 @@ const (
ingressSchemeLabel = metaLabelPrefix + "ingress_scheme" ingressSchemeLabel = metaLabelPrefix + "ingress_scheme"
ingressHostLabel = metaLabelPrefix + "ingress_host" ingressHostLabel = metaLabelPrefix + "ingress_host"
ingressPathLabel = metaLabelPrefix + "ingress_path" ingressPathLabel = metaLabelPrefix + "ingress_path"
ingressClassLabel = metaLabelPrefix + "ingress_class" ingressClassNameLabel = metaLabelPrefix + "ingress_class_name"
) )
func ingressLabels(ingress *v1beta1.Ingress) model.LabelSet { func ingressLabels(ingress *v1beta1.Ingress) model.LabelSet {
@ -156,9 +156,9 @@ func ingressLabels(ingress *v1beta1.Ingress) model.LabelSet {
ls[ingressNameLabel] = lv(ingress.Name) ls[ingressNameLabel] = lv(ingress.Name)
ls[namespaceLabel] = lv(ingress.Namespace) ls[namespaceLabel] = lv(ingress.Namespace)
if ingress.Spec.IngressClassName == nil { if ingress.Spec.IngressClassName == nil {
ls[ingressClassLabel] = lv("") ls[ingressClassNameLabel] = lv("")
} else { } else {
ls[ingressClassLabel] = lv(*ingress.Spec.IngressClassName) ls[ingressClassNameLabel] = lv(*ingress.Spec.IngressClassName)
} }
for k, v := range ingress.Labels { for k, v := range ingress.Labels {

View File

@ -33,7 +33,7 @@ const (
TLSMixed TLSMixed
) )
func makeIngress(tls TLSMode, excludeClass bool) *v1beta1.Ingress { func makeIngress(tls TLSMode, excludeClassName bool) *v1beta1.Ingress {
ret := &v1beta1.Ingress{ ret := &v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "testingress", Name: "testingress",
@ -82,7 +82,7 @@ func makeIngress(tls TLSMode, excludeClass bool) *v1beta1.Ingress {
ret.Spec.TLS = []v1beta1.IngressTLS{{Hosts: []string{"example.com"}}} ret.Spec.TLS = []v1beta1.IngressTLS{{Hosts: []string{"example.com"}}}
} }
if excludeClass { if excludeClassName {
ret.Spec.IngressClassName = nil ret.Spec.IngressClassName = nil
} }
@ -93,7 +93,7 @@ func classString(v string) *string {
return &v 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" scheme1 := "http"
scheme2 := "http" scheme2 := "http"
@ -107,7 +107,7 @@ func expectedTargetGroups(ns string, tls TLSMode, excludeClass bool) map[string]
scheme1 = "https" scheme1 = "https"
} }
if excludeClass { if excludeClassName {
ingressClassName = "" 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_labelpresent_test_label": "true",
"__meta_kubernetes_ingress_annotation_test_annotation": "testannotationvalue", "__meta_kubernetes_ingress_annotation_test_annotation": "testannotationvalue",
"__meta_kubernetes_ingress_annotationpresent_test_annotation": "true", "__meta_kubernetes_ingress_annotationpresent_test_annotation": "true",
"__meta_kubernetes_ingress_class": lv(ingressClassName), "__meta_kubernetes_ingress_class_name": lv(ingressClassName),
}, },
Source: key, Source: key,
}, },

View File

@ -1342,7 +1342,7 @@ Available meta labels:
* `__meta_kubernetes_ingress_labelpresent_<labelname>`: `true` for each label from the ingress object. * `__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_annotation_<annotationname>`: Each annotation from the ingress object.
* `__meta_kubernetes_ingress_annotationpresent_<annotationname>`: `true` for 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 * `__meta_kubernetes_ingress_scheme`: Protocol scheme of ingress, `https` if TLS
config is set. Defaults to `http`. config is set. Defaults to `http`.
* `__meta_kubernetes_ingress_path`: Path from ingress spec. Defaults to `/`. * `__meta_kubernetes_ingress_path`: Path from ingress spec. Defaults to `/`.