Repository: kubernetes-sigs/external-dns (language: go)

Issue:
No DNS update when new provider-specific properties are added to an existing ingress
**What happened**:

I added the annotation `external-dns.alpha.kubernetes.io/aws-health-check-id` to an existing ingress that did not initially have the annotation. This did not result in any change to the Route53 record (managed by external-dns) associated with the ingress.

**What you expected to happen**:

I expected external-dns to update the Route53 record associated with the ingress and add the health check ID.

**How to reproduce it (as minimally and precisely as possible)**:

Create an ingress as follows (change the host to match a zone managed by external-dns in the cluster, add an ingress class name if necessary):

```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    external-dns.alpha.kubernetes.io/aws-weight: "100"
    external-dns.alpha.kubernetes.io/set-identifier: external-dns-test
  name: external-dns-test
  namespace: default
spec:
  rules:
  - host: external-dns-test.example.test
    http:
      paths:
      - backend:
          service:
            name: some-ingress
            port:
              number: 8080
        path: /
        pathType: Prefix
```

Wait until external-dns creates the Route53 record for the above ingress. Then annotate the ingress with a Route53 health check ID in your account (`3ae8435c-7087-400a-ac01-d3ea49f2f1f6` in this example):

```
% kubectl -ndefault annotate ingress external-dns-test external-dns.alpha.kubernetes.io/aws-health-check-id=3ae8435c-7087-400a-ac01-d3ea49f2f1f6
```

Doing the above will not cause external-dns to add the health check ID to the Route53 record.

**Anything else we need to know?**:

**Environment**:
- External-DNS version (use `external-dns --version`): Confirmed on `v0.12.2`, `v0.11.1`
- DNS provider: AWS (Route53)
- Others: I think this is because [shouldUpdateProviderSpecific](https://github.com/kubernetes-sigs/external-dns/blob/v0.12.2/plan/plan.go#L211) does not return `true` when `desired` has provider-specific properties not in `current`.


Discussion / hints:
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:
- After 90d of inactivity, `lifecycle/stale` is applied
- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied
- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed

You can:
- Mark this issue or PR as fresh with `/remove-lifecycle stale`
- Mark this issue or PR as rotten with `/lifecycle rotten`
- Close this issue or PR with `/close`
- Offer to help out with [Issue Triage][1]

Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community).

/lifecycle stale

[1]: https://www.kubernetes.dev/docs/guide/issue-triage/
+1

Fix patch:
diff --git a/plan/plan.go b/plan/plan.go
index d7bac70909..7eb4d9fe10 100644
--- a/plan/plan.go
+++ b/plan/plan.go
@@ -209,16 +209,17 @@ func shouldUpdateTTL(desired, current *endpoint.Endpoint) bool {
 }
 
 func (p *Plan) shouldUpdateProviderSpecific(desired, current *endpoint.Endpoint) bool {
-	desiredProperties := map[string]endpoint.ProviderSpecificProperty{}
+	currentProperties := map[string]endpoint.ProviderSpecificProperty{}
 
-	if desired.ProviderSpecific != nil {
-		for _, d := range desired.ProviderSpecific {
-			desiredProperties[d.Name] = d
+	if current.ProviderSpecific != nil {
+		for _, d := range current.ProviderSpecific {
+			currentProperties[d.Name] = d
 		}
 	}
-	if current.ProviderSpecific != nil {
-		for _, c := range current.ProviderSpecific {
-			if d, ok := desiredProperties[c.Name]; ok {
+
+	if desired.ProviderSpecific != nil {
+		for _, d := range desired.ProviderSpecific {
+			if c, ok := currentProperties[d.Name]; ok {
 				if p.PropertyComparator != nil {
 					if !p.PropertyComparator(c.Name, c.Value, d.Value) {
 						return true
@@ -228,10 +229,10 @@ func (p *Plan) shouldUpdateProviderSpecific(desired, current *endpoint.Endpoint)
 				}
 			} else {
 				if p.PropertyComparator != nil {
-					if !p.PropertyComparator(c.Name, c.Value, "") {
+					if !p.PropertyComparator(c.Name, "", d.Value) {
 						return true
 					}
-				} else if c.Value != "" {
+				} else if d.Value != "" {
 					return true
 				}
 			}


Test patch: