remove ForceUpdate property on endpoint after reimplementation

Signed-off-by: Matias Charriere <matias@giantswarm.io>
This commit is contained in:
Matias Charriere 2023-06-15 11:48:50 +02:00
parent 44b5761330
commit df5e9aeace
No known key found for this signature in database
GPG Key ID: FBD58286F94A15EA
4 changed files with 7 additions and 36 deletions

View File

@ -170,8 +170,6 @@ type Endpoint struct {
Targets Targets `json:"targets,omitempty"`
// RecordType type of record, e.g. CNAME, A, AAAA, SRV, TXT etc
RecordType string `json:"recordType,omitempty"`
// Force planner to update record
ForceUpdate bool `json:"forceUpdate,omitempty"`
// Identifier to distinguish multiple records with the same name and type (e.g. Route53 records with routing policies other than 'simple')
SetIdentifier string `json:"setIdentifier,omitempty"`
// TTL for the record
@ -204,12 +202,11 @@ func NewEndpointWithTTL(dnsName, recordType string, ttl TTL, targets ...string)
}
return &Endpoint{
DNSName: strings.TrimSuffix(dnsName, "."),
Targets: cleanTargets,
RecordType: recordType,
ForceUpdate: false,
Labels: NewLabels(),
RecordTTL: ttl,
DNSName: strings.TrimSuffix(dnsName, "."),
Targets: cleanTargets,
RecordType: recordType,
Labels: NewLabels(),
RecordTTL: ttl,
}
}

View File

@ -63,8 +63,7 @@ func SameEndpoint(a, b *endpoint.Endpoint) bool {
a.Labels[endpoint.OwnerLabelKey] == b.Labels[endpoint.OwnerLabelKey] && a.RecordTTL == b.RecordTTL &&
a.Labels[endpoint.ResourceLabelKey] == b.Labels[endpoint.ResourceLabelKey] &&
a.Labels[endpoint.OwnedRecordLabelKey] == b.Labels[endpoint.OwnedRecordLabelKey] &&
SameProviderSpecific(a.ProviderSpecific, b.ProviderSpecific) &&
a.ForceUpdate == b.ForceUpdate
SameProviderSpecific(a.ProviderSpecific, b.ProviderSpecific)
}
// SameEndpoints compares two slices of endpoints regardless of order

View File

@ -163,7 +163,7 @@ func (p *Plan) Calculate() *Plan {
if row.current != nil && len(row.candidates) > 0 { // dns name is taken
update := t.resolver.ResolveUpdate(row.current, row.candidates)
// compare "update" to "current" to figure out if actual update is required
if shouldUpdateTTL(update, row.current) || targetChanged(update, row.current) || p.shouldUpdateProviderSpecific(update, row.current) || row.current.ForceUpdate {
if shouldUpdateTTL(update, row.current) || targetChanged(update, row.current) || p.shouldUpdateProviderSpecific(update, row.current) {
inheritOwner(row.current, update)
changes.UpdateNew = append(changes.UpdateNew, update)
changes.UpdateOld = append(changes.UpdateOld, row.current)

View File

@ -51,7 +51,6 @@ type PlanTestSuite struct {
domainFilterFiltered2 *endpoint.Endpoint
domainFilterFiltered3 *endpoint.Endpoint
domainFilterExcluded *endpoint.Endpoint
forceUpdate *endpoint.Endpoint
}
func (suite *PlanTestSuite) SetupTest() {
@ -231,12 +230,6 @@ func (suite *PlanTestSuite) SetupTest() {
Targets: endpoint.Targets{"1.1.1.1"},
RecordType: "A",
}
suite.forceUpdate = &endpoint.Endpoint{
DNSName: "foo.domain.tld",
Targets: endpoint.Targets{"1.2.3.5"},
RecordType: "A",
ForceUpdate: true,
}
}
func (suite *PlanTestSuite) TestSyncFirstRound() {
@ -650,24 +643,6 @@ func (suite *PlanTestSuite) TestDomainFiltersUpdate() {
validateEntries(suite.T(), changes.Delete, expectedDelete)
}
func (suite *PlanTestSuite) TestForceUpdate() {
current := []*endpoint.Endpoint{suite.forceUpdate}
desired := []*endpoint.Endpoint{suite.forceUpdate}
expectedUpdateOld := current
expectedUpdateNew := current
p := &Plan{
Policies: []Policy{&SyncPolicy{}},
Current: current,
Desired: desired,
ManagedRecords: []string{endpoint.RecordTypeA, endpoint.RecordTypeCNAME},
}
changes := p.Calculate().Changes
validateEntries(suite.T(), changes.UpdateNew, expectedUpdateNew)
validateEntries(suite.T(), changes.UpdateOld, expectedUpdateOld)
}
func (suite *PlanTestSuite) TestAAAARecords() {
current := []*endpoint.Endpoint{}