Skip to content

Commit

Permalink
Merge pull request #4115 from PascalBourdier/remove-compareboolean
Browse files Browse the repository at this point in the history
fix: remove useless functions
  • Loading branch information
k8s-ci-robot committed Dec 29, 2023
2 parents 9546500 + 279cc2d commit 874dd2b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
26 changes: 0 additions & 26 deletions plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package plan

import (
"fmt"
"strconv"
"strings"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -342,31 +341,6 @@ func normalizeDNSName(dnsName string) string {
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 {
for _, r := range excludeRecords {
if record == r {
Expand Down
23 changes: 0 additions & 23 deletions provider/aws/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1644,29 +1644,6 @@ func listAWSRecords(t *testing.T, client Route53API, zone string) []*route53.Res
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) {
return newAWSProviderWithTagFilter(t, domainFilter, zoneIDFilter, zoneTypeFilter, provider.NewZoneTagFilter([]string{}), evaluateTargetHealth, dryRun, records)
}
Expand Down

0 comments on commit 874dd2b

Please sign in to comment.