mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-05 17:16:59 +02:00
ingress: ignore annotation when ingressclassname is non empty
This commit is contained in:
parent
e3842a4be6
commit
42077cd35a
@ -258,9 +258,10 @@ func (sc *ingressSource) filterByIngressClass(ingresses []*networkv1.Ingress) ([
|
||||
var matched = false
|
||||
|
||||
for _, nameFilter := range sc.ingressClassNames {
|
||||
if ingress.Spec.IngressClassName != nil && nameFilter == *ingress.Spec.IngressClassName {
|
||||
matched = true
|
||||
|
||||
if ingress.Spec.IngressClassName != nil && len(*ingress.Spec.IngressClassName) > 0 {
|
||||
if nameFilter == *ingress.Spec.IngressClassName {
|
||||
matched = true
|
||||
}
|
||||
} else if matchLabelSelector(selector, ingress.Annotations) {
|
||||
matched = true
|
||||
}
|
||||
|
@ -1282,7 +1282,7 @@ func testIngressEndpoints(t *testing.T) {
|
||||
tlsdnsnames: [][]string{{"int-annodmz.example.org"}},
|
||||
ips: []string{"5.6.7.8"},
|
||||
annotations: map[string]string{
|
||||
"kubernetes.io/ingress.class": "dmz", // match
|
||||
"kubernetes.io/ingress.class": "dmz", // match but ignored (non-empty ingressClassName)
|
||||
},
|
||||
ingressClassName: "internal",
|
||||
},
|
||||
@ -1302,7 +1302,7 @@ func testIngressEndpoints(t *testing.T) {
|
||||
tlsdnsnames: [][]string{{"empty-annotdmz.example.org"}},
|
||||
ips: []string{"7.8.9.0"},
|
||||
annotations: map[string]string{
|
||||
"kubernetes.io/ingress.class": "dmz", // match
|
||||
"kubernetes.io/ingress.class": "dmz", // match (empty ingressClassName)
|
||||
},
|
||||
ingressClassName: "",
|
||||
},
|
||||
@ -1333,11 +1333,6 @@ func testIngressEndpoints(t *testing.T) {
|
||||
RecordType: endpoint.RecordTypeA,
|
||||
Targets: endpoint.Targets{"4.5.6.7"},
|
||||
},
|
||||
{
|
||||
DNSName: "int-annodmz.example.org",
|
||||
RecordType: endpoint.RecordTypeA,
|
||||
Targets: endpoint.Targets{"5.6.7.8"},
|
||||
},
|
||||
{
|
||||
DNSName: "dmz-annoint.example.org",
|
||||
RecordType: endpoint.RecordTypeA,
|
||||
|
Loading…
Reference in New Issue
Block a user