mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 09:36:58 +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
|
var matched = false
|
||||||
|
|
||||||
for _, nameFilter := range sc.ingressClassNames {
|
for _, nameFilter := range sc.ingressClassNames {
|
||||||
if ingress.Spec.IngressClassName != nil && nameFilter == *ingress.Spec.IngressClassName {
|
if ingress.Spec.IngressClassName != nil && len(*ingress.Spec.IngressClassName) > 0 {
|
||||||
matched = true
|
if nameFilter == *ingress.Spec.IngressClassName {
|
||||||
|
matched = true
|
||||||
|
}
|
||||||
} else if matchLabelSelector(selector, ingress.Annotations) {
|
} else if matchLabelSelector(selector, ingress.Annotations) {
|
||||||
matched = true
|
matched = true
|
||||||
}
|
}
|
||||||
|
@ -1282,7 +1282,7 @@ func testIngressEndpoints(t *testing.T) {
|
|||||||
tlsdnsnames: [][]string{{"int-annodmz.example.org"}},
|
tlsdnsnames: [][]string{{"int-annodmz.example.org"}},
|
||||||
ips: []string{"5.6.7.8"},
|
ips: []string{"5.6.7.8"},
|
||||||
annotations: map[string]string{
|
annotations: map[string]string{
|
||||||
"kubernetes.io/ingress.class": "dmz", // match
|
"kubernetes.io/ingress.class": "dmz", // match but ignored (non-empty ingressClassName)
|
||||||
},
|
},
|
||||||
ingressClassName: "internal",
|
ingressClassName: "internal",
|
||||||
},
|
},
|
||||||
@ -1302,7 +1302,7 @@ func testIngressEndpoints(t *testing.T) {
|
|||||||
tlsdnsnames: [][]string{{"empty-annotdmz.example.org"}},
|
tlsdnsnames: [][]string{{"empty-annotdmz.example.org"}},
|
||||||
ips: []string{"7.8.9.0"},
|
ips: []string{"7.8.9.0"},
|
||||||
annotations: map[string]string{
|
annotations: map[string]string{
|
||||||
"kubernetes.io/ingress.class": "dmz", // match
|
"kubernetes.io/ingress.class": "dmz", // match (empty ingressClassName)
|
||||||
},
|
},
|
||||||
ingressClassName: "",
|
ingressClassName: "",
|
||||||
},
|
},
|
||||||
@ -1333,11 +1333,6 @@ func testIngressEndpoints(t *testing.T) {
|
|||||||
RecordType: endpoint.RecordTypeA,
|
RecordType: endpoint.RecordTypeA,
|
||||||
Targets: endpoint.Targets{"4.5.6.7"},
|
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",
|
DNSName: "dmz-annoint.example.org",
|
||||||
RecordType: endpoint.RecordTypeA,
|
RecordType: endpoint.RecordTypeA,
|
||||||
|
Loading…
Reference in New Issue
Block a user