Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint code #1234

Merged
merged 1 commit into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions controllers/nginx/pkg/cmd/controller/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ func (s *statsCollector) stop(sm statusModule) {
case defaultStatusModule:
s.basic.Stop()
prometheus.Unregister(s.basic)
break
case vtsStatusModule:
s.vts.Stop()
prometheus.Unregister(s.vts)
break
}
}

Expand Down
6 changes: 3 additions & 3 deletions controllers/nginx/pkg/metric/collector/vts.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ func (p vtsCollector) scrapeVts(ch chan<- prometheus.Metric) {
reflectMetrics(&zone.Cache, p.data.filterZoneCache, ch, p.ingressClass, p.watchNamespace, serverZone, country)

ch <- prometheus.MustNewConstMetric(p.data.filterZoneBytes,
prometheus.CounterValue, float64(zone.InBytes), p.ingressClass, p.watchNamespace, serverZone, country, "in")
prometheus.CounterValue, zone.InBytes, p.ingressClass, p.watchNamespace, serverZone, country, "in")
ch <- prometheus.MustNewConstMetric(p.data.filterZoneBytes,
prometheus.CounterValue, float64(zone.OutBytes), p.ingressClass, p.watchNamespace, serverZone, country, "out")
prometheus.CounterValue, zone.OutBytes, p.ingressClass, p.watchNamespace, serverZone, country, "out")
}
}
}
Expand All @@ -266,7 +266,7 @@ func reflectMetrics(value interface{}, desc *prometheus.Desc, ch chan<- promethe
tag := val.Type().Field(i).Tag
l := append(labels, tag.Get("json"))
ch <- prometheus.MustNewConstMetric(desc,
prometheus.CounterValue, float64(val.Field(i).Interface().(float64)),
prometheus.CounterValue, val.Field(i).Interface().(float64),
l...)
}
}
4 changes: 2 additions & 2 deletions core/pkg/base64/base64.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
)

// Base64Encode
func Base64Encode(s string) string {
// Encode encodes a string to base64 removing the equals character
func Encode(s string) string {
str := base64.URLEncoding.EncodeToString([]byte(s))
return strings.Replace(str, "=", "", -1)
}
2 changes: 1 addition & 1 deletion core/pkg/ingress/annotations/authreq/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (a authReq) Parse(ing *extensions.Ingress) (interface{}, error) {

harr := strings.Split(hstr, ",")
for _, header := range harr {
header := strings.TrimSpace(header)
header = strings.TrimSpace(header)
if len(header) > 0 {
if !validHeader(header) {
return nil, ing_errors.NewLocationDenied("invalid headers list")
Expand Down
2 changes: 1 addition & 1 deletion core/pkg/ingress/annotations/ratelimit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (a ratelimit) Parse(ing *extensions.Ingress) (interface{}, error) {
LimitRate: lr,
LimitRateAfter: lra,
Name: zoneName,
ID: base64.Base64Encode(zoneName),
ID: base64.Encode(zoneName),
Whitelist: cidrs,
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion core/pkg/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ func (ic *GenericController) createServers(data []interface{},
fakeCertificatePath := fmt.Sprintf("%v/%v.pem", ingress.DefaultSSLDirectory, fakeCertificate)

// Only generates a new certificate if it doesn't exists physically
_, err := os.Stat(fakeCertificatePath)
_, err = os.Stat(fakeCertificatePath)
if err != nil {
glog.V(3).Infof("No Default SSL Certificate found. Generating a new one")
defCert, defKey := ssl.GetFakeSSLCert()
Expand Down
5 changes: 0 additions & 5 deletions core/pkg/net/ssl/ssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ import (
"k8s.io/ingress/core/pkg/ingress"
)

const (
rsaBits = 2048
validFor = 365 * 24 * time.Hour
)

// generateRSACerts generates a self signed certificate using a self generated ca
func generateRSACerts(host string) (*triple.KeyPair, *triple.KeyPair, error) {
ca, err := triple.NewCA("self-sign-ca")
Expand Down