Skip to content

Commit

Permalink
Merge 088df59 into 432d069
Browse files Browse the repository at this point in the history
  • Loading branch information
tariq1890 committed Jan 23, 2020
2 parents 432d069 + 088df59 commit 3ffb3c6
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 21 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ linters:
- misspell
- unconvert
- staticcheck
- gosimple
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ matrix:
- go: tip

env:
- GOLANGCI_RELEASE="v1.22.2"
- GOLANGCI_RELEASE="v1.23.1"

before_install:
- GO111MODULE=off go get github.com/mattn/goveralls
Expand Down
5 changes: 1 addition & 4 deletions provider/akamai_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ func (m *mockAkamaiClient) Do(config edgegrid.Config, req *http.Request) (*http.
handler := func(w http.ResponseWriter, r *http.Request) (isError bool) {
b, _ := ioutil.ReadAll(r.Body)
io.WriteString(w, string(b))
if string(b) == "{\"status\": 404 }" {
return true
}
return false
return string(b) == "{\"status\": 404 }"
}
w := httptest.NewRecorder()
err := handler(w, req)
Expand Down
2 changes: 1 addition & 1 deletion provider/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ func batchChangeSet(cs []*route53.Change, batchSize int) [][]*route53.Change {

batchChanges := make([][]*route53.Change, 0)

changesByName := make(map[string][]*route53.Change, 0)
changesByName := make(map[string][]*route53.Change)
for _, v := range cs {
changesByName[*v.ResourceRecordSet.Name] = append(changesByName[*v.ResourceRecordSet.Name], v)
}
Expand Down
8 changes: 2 additions & 6 deletions provider/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ func (r *Route53APIStub) ListResourceRecordSetsPagesWithContext(ctx context.Cont
output.ResourceRecordSets = []*route53.ResourceRecordSet{}
} else {
for _, rrsets := range r.recordSets[aws.StringValue(input.HostedZoneId)] {
for _, rrset := range rrsets {
output.ResourceRecordSets = append(output.ResourceRecordSets, rrset)
}
output.ResourceRecordSets = append(output.ResourceRecordSets, rrsets...)
}
}
lastPage := true
Expand Down Expand Up @@ -1131,9 +1129,7 @@ func listAWSRecords(t *testing.T, client Route53API, zone string) []*route53.Res
require.NoError(t, client.ListResourceRecordSetsPagesWithContext(context.Background(), &route53.ListResourceRecordSetsInput{
HostedZoneId: aws.String(zone),
}, func(resp *route53.ListResourceRecordSetsOutput, _ bool) bool {
for _, recordSet := range resp.ResourceRecordSets {
recordSets = append(recordSets, recordSet)
}
recordSets = append(recordSets, resp.ResourceRecordSets...)
return true
}))

Expand Down
2 changes: 1 addition & 1 deletion provider/dyn.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ func (d *dynProviderState) Records(ctx context.Context) ([]*endpoint.Endpoint, e
for _, zone := range zones {
serial, err := d.fetchZoneSerial(client, zone)
if err != nil {
if strings.Index(err.Error(), "404 Not Found") >= 0 {
if strings.Contains(err.Error(), "404 Not Found") {
log.Infof("Ignore zone %s as it does not exist", zone)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion provider/ns1.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func newNS1ProviderWithHTTPClient(config NS1Config, client *http.Client) (*NS1Pr
clientArgs = append(clientArgs, api.SetEndpoint(config.NS1Endpoint))
}

if config.NS1IgnoreSSL == true {
if config.NS1IgnoreSSL {
log.Info("ns1-ignoressl flag is True, skipping SSL verification")
defaultTransport := http.DefaultTransport.(*http.Transport)
tr := &http.Transport{
Expand Down
2 changes: 1 addition & 1 deletion source/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func NewIstioGatewaySource(

// wait for the local cache to be populated.
err = wait.Poll(time.Second, 60*time.Second, func() (bool, error) {
return serviceInformer.Informer().HasSynced() == true, nil
return serviceInformer.Informer().HasSynced(), nil
})
if err != nil {
return nil, fmt.Errorf("failed to sync cache: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion source/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func NewIngressSource(kubeClient kubernetes.Interface, namespace, annotationFilt

// wait for the local cache to be populated.
err = wait.Poll(time.Second, 60*time.Second, func() (bool, error) {
return ingressInformer.Informer().HasSynced() == true, nil
return ingressInformer.Informer().HasSynced(), nil
})
if err != nil {
return nil, fmt.Errorf("failed to sync cache: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion source/ingressroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func NewContourIngressRouteSource(

// wait for the local cache to be populated.
err = wait.Poll(time.Second, 60*time.Second, func() (bool, error) {
return ingressRouteInformer.Informer().HasSynced() == true, nil
return ingressRouteInformer.Informer().HasSynced(), nil
})
if err != nil {
return nil, fmt.Errorf("failed to sync cache: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion source/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewNodeSource(kubeClient kubernetes.Interface, annotationFilter, fqdnTempla

// wait for the local cache to be populated.
err = wait.Poll(time.Second, 60*time.Second, func() (bool, error) {
return nodeInformer.Informer().HasSynced() == true, nil
return nodeInformer.Informer().HasSynced(), nil
})
if err != nil {
return nil, fmt.Errorf("failed to sync cache: %v", err)
Expand Down
6 changes: 3 additions & 3 deletions source/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func NewServiceSource(kubeClient kubernetes.Interface, namespace, annotationFilt

// wait for the local cache to be populated.
err = wait.Poll(time.Second, 60*time.Second, func() (bool, error) {
return serviceInformer.Informer().HasSynced() == true, nil
return serviceInformer.Informer().HasSynced(), nil
})
if err != nil {
return nil, fmt.Errorf("failed to sync cache: %v", err)
Expand Down Expand Up @@ -234,9 +234,9 @@ func (sc *serviceSource) extractHeadlessEndpoints(svc *v1.Service, hostname stri
headlessDomains = append(headlessDomains, fmt.Sprintf("%s.%s", v.Spec.Hostname, hostname))
}
for _, headlessDomain := range headlessDomains {
if sc.publishHostIP == true {
if sc.publishHostIP {
log.Debugf("Generating matching endpoint %s with HostIP %s", headlessDomain, v.Status.HostIP)
// To reduce traffice on the DNS API only add record for running Pods. Good Idea?
// To reduce traffic on the DNS API only add record for running Pods. Good Idea?
if v.Status.Phase == v1.PodRunning {
targetsByHeadlessDomain[headlessDomain] = append(targetsByHeadlessDomain[headlessDomain], v.Status.HostIP)
} else {
Expand Down

0 comments on commit 3ffb3c6

Please sign in to comment.