Skip to content

Commit 0033044

Browse files
committed
test(aws): add comprehensive tests and remove old logic
Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
1 parent b50b0a5 commit 0033044

File tree

2 files changed

+491
-99
lines changed

2 files changed

+491
-99
lines changed

provider/aws/aws.go

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ func (p *AWSProvider) adjustEndpointAndNewAaaaIfNeeded(ep *endpoint.Endpoint) *e
898898
ep.DeleteProviderSpecificProperty(providerSpecificEvaluateTargetHealth)
899899
}
900900
default:
901-
// TODO fix
901+
// TODO: fix For records other than A, AAAA, and CNAME, if an alias record is set, the alias record processing is not performed. This will be fixed in another PR.
902902
aliasString, _ := ep.GetProviderSpecificProperty(providerSpecificAlias)
903903
switch aliasString {
904904
case "true":
@@ -914,67 +914,6 @@ func (p *AWSProvider) adjustEndpointAndNewAaaaIfNeeded(ep *endpoint.Endpoint) *e
914914
return additionalAAAA
915915
}
916916

917-
func (p *AWSProvider) oldAdjustEndpointAndNewAaaaIfNeeded(ep *endpoint.Endpoint) *endpoint.Endpoint {
918-
var result *endpoint.Endpoint
919-
920-
alias := false
921-
922-
if aliasString, ok := ep.GetProviderSpecificProperty(providerSpecificAlias); ok {
923-
alias = aliasString == "true"
924-
if alias {
925-
if !slices.Contains([]string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME}, ep.RecordType) {
926-
ep.DeleteProviderSpecificProperty(providerSpecificAlias)
927-
}
928-
} else {
929-
if ep.RecordType == endpoint.RecordTypeCNAME {
930-
if aliasString != "false" {
931-
ep.SetProviderSpecificProperty(providerSpecificAlias, "false")
932-
}
933-
} else {
934-
ep.DeleteProviderSpecificProperty(providerSpecificAlias)
935-
}
936-
}
937-
} else if ep.RecordType == endpoint.RecordTypeCNAME {
938-
alias = useAlias(ep, p.preferCNAME)
939-
log.Debugf("Modifying endpoint: %v, setting %s=%v", ep, providerSpecificAlias, alias)
940-
ep.SetProviderSpecificProperty(providerSpecificAlias, strconv.FormatBool(alias))
941-
}
942-
943-
if alias {
944-
if ep.RecordTTL.IsConfigured() {
945-
log.Debugf("Modifying endpoint: %v, setting ttl=%v", ep, defaultTTL)
946-
ep.RecordTTL = defaultTTL
947-
}
948-
if prop, ok := ep.GetProviderSpecificProperty(providerSpecificEvaluateTargetHealth); ok {
949-
if prop != "true" && prop != "false" {
950-
ep.SetProviderSpecificProperty(providerSpecificEvaluateTargetHealth, "false")
951-
}
952-
} else {
953-
ep.SetProviderSpecificProperty(providerSpecificEvaluateTargetHealth, strconv.FormatBool(p.evaluateTargetHealth))
954-
}
955-
956-
if ep.RecordType == endpoint.RecordTypeCNAME {
957-
// This needs to match two records from Route53, one alias for 'A' (IPv4)
958-
// and one alias for 'AAAA' (IPv6).
959-
result = &endpoint.Endpoint{
960-
DNSName: ep.DNSName,
961-
Targets: ep.Targets,
962-
RecordType: endpoint.RecordTypeAAAA,
963-
RecordTTL: ep.RecordTTL,
964-
Labels: ep.Labels,
965-
ProviderSpecific: ep.ProviderSpecific,
966-
SetIdentifier: ep.SetIdentifier,
967-
}
968-
ep.RecordType = endpoint.RecordTypeA
969-
}
970-
} else {
971-
ep.DeleteProviderSpecificProperty(providerSpecificEvaluateTargetHealth)
972-
}
973-
974-
adjustGeoProximityLocationEndpoint(ep)
975-
return result
976-
}
977-
978917
// if the endpoint is using geoproximity, set the bias to 0 if not set
979918
// this is needed to avoid unnecessary Upserts if the desired endpoint doesn't specify a bias
980919
func adjustGeoProximityLocationEndpoint(ep *endpoint.Endpoint) {

0 commit comments

Comments
 (0)