Skip to content

Commit

Permalink
fix: need to deep copy ProviderSpecific else it will change on all en…
Browse files Browse the repository at this point in the history
…dpoints using the same ProviderSpecific
  • Loading branch information
Tazer committed Mar 21, 2024
1 parent a667d82 commit d139597
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions endpoint/endpoint.go
Expand Up @@ -247,6 +247,9 @@ func (e *Endpoint) GetProviderSpecificProperty(key string) (string, bool) {

// SetProviderSpecificProperty sets the value of a ProviderSpecificProperty.
func (e *Endpoint) SetProviderSpecificProperty(key string, value string) {
// Make a copy of the ProviderSpecific slice to avoid modifying the original slice as it's reused across multiple endpoints.
// cause of the split here for example: https://github.com/kubernetes-sigs/external-dns/blob/master/source/service.go#L399
e.ProviderSpecific = e.ProviderSpecific.DeepCopy()
for i, providerSpecific := range e.ProviderSpecific {
if providerSpecific.Name == key {
e.ProviderSpecific[i] = ProviderSpecificProperty{
Expand Down

0 comments on commit d139597

Please sign in to comment.