mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 17:46:57 +02:00
Merge pull request #4115 from PascalBourdier/remove-compareboolean
fix: remove useless functions
This commit is contained in:
commit
874dd2bcba
26
plan/plan.go
26
plan/plan.go
@ -18,7 +18,6 @@ package plan
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
@ -342,31 +341,6 @@ func normalizeDNSName(dnsName string) string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
// CompareBoolean is an implementation of PropertyComparator for comparing boolean-line values
|
|
||||||
// For example external-dns.alpha.kubernetes.io/cloudflare-proxied: "true"
|
|
||||||
// If value doesn't parse as boolean, the defaultValue is used
|
|
||||||
func CompareBoolean(defaultValue bool, name, current, previous string) bool {
|
|
||||||
var err error
|
|
||||||
|
|
||||||
v1, v2 := defaultValue, defaultValue
|
|
||||||
|
|
||||||
if previous != "" {
|
|
||||||
v1, err = strconv.ParseBool(previous)
|
|
||||||
if err != nil {
|
|
||||||
v1 = defaultValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if current != "" {
|
|
||||||
v2, err = strconv.ParseBool(current)
|
|
||||||
if err != nil {
|
|
||||||
v2 = defaultValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return v1 == v2
|
|
||||||
}
|
|
||||||
|
|
||||||
func IsManagedRecord(record string, managedRecords, excludeRecords []string) bool {
|
func IsManagedRecord(record string, managedRecords, excludeRecords []string) bool {
|
||||||
for _, r := range excludeRecords {
|
for _, r := range excludeRecords {
|
||||||
if record == r {
|
if record == r {
|
||||||
|
@ -1644,29 +1644,6 @@ func listAWSRecords(t *testing.T, client Route53API, zone string) []*route53.Res
|
|||||||
return recordSets
|
return recordSets
|
||||||
}
|
}
|
||||||
|
|
||||||
// Route53 stores wildcards escaped: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DomainNameFormat.html?shortFooter=true#domain-name-format-asterisk
|
|
||||||
func escapeAWSRecords(t *testing.T, provider *AWSProvider, zone string) {
|
|
||||||
recordSets := listAWSRecords(t, provider.client, zone)
|
|
||||||
|
|
||||||
changes := make([]*route53.Change, 0, len(recordSets))
|
|
||||||
for _, recordSet := range recordSets {
|
|
||||||
changes = append(changes, &route53.Change{
|
|
||||||
Action: aws.String(route53.ChangeActionUpsert),
|
|
||||||
ResourceRecordSet: recordSet,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(changes) != 0 {
|
|
||||||
_, err := provider.client.ChangeResourceRecordSetsWithContext(context.Background(), &route53.ChangeResourceRecordSetsInput{
|
|
||||||
HostedZoneId: aws.String(zone),
|
|
||||||
ChangeBatch: &route53.ChangeBatch{
|
|
||||||
Changes: changes,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
require.NoError(t, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func newAWSProvider(t *testing.T, domainFilter endpoint.DomainFilter, zoneIDFilter provider.ZoneIDFilter, zoneTypeFilter provider.ZoneTypeFilter, evaluateTargetHealth, dryRun bool, records []*route53.ResourceRecordSet) (*AWSProvider, *Route53APIStub) {
|
func newAWSProvider(t *testing.T, domainFilter endpoint.DomainFilter, zoneIDFilter provider.ZoneIDFilter, zoneTypeFilter provider.ZoneTypeFilter, evaluateTargetHealth, dryRun bool, records []*route53.ResourceRecordSet) (*AWSProvider, *Route53APIStub) {
|
||||||
return newAWSProviderWithTagFilter(t, domainFilter, zoneIDFilter, zoneTypeFilter, provider.NewZoneTagFilter([]string{}), evaluateTargetHealth, dryRun, records)
|
return newAWSProviderWithTagFilter(t, domainFilter, zoneIDFilter, zoneTypeFilter, provider.NewZoneTagFilter([]string{}), evaluateTargetHealth, dryRun, records)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user