Skip to content

Commit

Permalink
Initial work to fix #2953
Browse files Browse the repository at this point in the history
The previous code version only iterates over current ProviderSpecific properties. This new version iterates over desired properties, including those that were just set
  • Loading branch information
gjmveloso committed Nov 21, 2022
1 parent 2f4c40b commit 4adf284
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
Expand Down

0 comments on commit 4adf284

Please sign in to comment.