Repository: knative/pkg (go)

Issue:
Eventing TLS: prioritize destination CA certs over resolved addressable CA certs 
<!--
Pro-tip: You can leave this block commented, and it still works!

Select the appropriate areas for your issue:

/area API

Classify what kind of issue this is:

/kind bug

-->

This condition is prioritizing `addr` over `dest`

https://github.com/knative/pkg/blob/559de7ee8c6788ec4561b170181556f6fa0a36af/resolver/addressable_resolver.go#L257-L259

we should set `addr.CACerts` to whatever `dest.CACerts` has set if `dest.CACerts` is set/non empty regardless of the value of `addr.CACerts`

## Additional Info

- The fix should be backported to `release-1.11` branch 

/good-first-issue

Pull request:
prioritize destination CA certs over resolved addressable CA certs
<!-- Thanks for sending a pull request! -->

# Changes

<!-- 
Describe your changes here- ideally you can get that description straight from
your descriptive commit message(s)! 

- :gift: Add new feature
- :bug: Fix bug
- :broom: Update or clean up current behavior
- :wastebasket: Remove feature or internal logic
-->

-

<!--
In addition, categorize the changes you're making using the "/kind" Prow command, example:

/kind bug: Fix bug

Supported kinds are: api-change, bug, cleanup, deprecation, removal, documentation, enhancement, performance

-->
/kind fix bug

<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #2837 

<!-- Please include the 'why' behind your changes if no issue exists -->

**Release Note**

<!--
:page_facing_up: If this change has user-visible impact, write a release note in the block
below. Include the string "action required" if additional action is required of
users switching to the new release, for example in case of a breaking change.

Write as if you are speaking to users, not other Knative contributors. If this
change has no user-visible impact, no release-note is needed.
-->
```release-note
prioritize destination CA certs over resolved addressable CA certs
```

**Docs**

<!--
:book: If this change has user-visible impact, link to an issue or PR in
https://github.com/knative/docs.

See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files

Please use the following format for linking documentation:
- [knative/docs]: <issue or pr link>
- [Feature Track]: <link>
- [Usage]: <link>
- [Other doc]: <link>
-->
```docs

```


Patch:
diff --git a/resolver/addressable_resolver.go b/resolver/addressable_resolver.go
index bbbcb78b6..e0b2f3a44 100644
--- a/resolver/addressable_resolver.go
+++ b/resolver/addressable_resolver.go
@@ -257,7 +257,7 @@ func (r *URIResolver) addressableFromDestinationRef(ctx context.Context, dest du
 		return nil, apierrs.NewBadRequest(fmt.Sprintf("hostname missing in address of %s", dest.Ref))
 	}
 
-	if addr.CACerts == nil {
+	if dest.CACerts != nil && *dest.CACerts != "" {
 		addr.CACerts = dest.CACerts
 	}
 


Test patch:
diff --git a/resolver/addressable_resolver_test.go b/resolver/addressable_resolver_test.go
index b5701ddaf..589a03680 100644
--- a/resolver/addressable_resolver_test.go
+++ b/resolver/addressable_resolver_test.go
@@ -848,7 +848,7 @@ func TestAddressableFromDestinationV1CACerts(t *testing.T) {
 			addressableWithCACert(),
 		},
 		addr:     addressableWithCACert(),
-		wantCert: CACert,
+		wantCert: certDestination,
 	}}
 
 	for n, tc := range tests {