Skip to content

Commit

Permalink
Merge pull request #1382 from aledbf/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
aledbf authored Sep 17, 2017
2 parents f478084 + 0661eaa commit 1a68536
Show file tree
Hide file tree
Showing 29 changed files with 264 additions and 281 deletions.
12 changes: 1 addition & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,10 @@ notifications:
email: true

go:
- 1.8.3
- 1.9

go_import_path: k8s.io/ingress

env:
global:
# to add additional secure variables:
# docker run --rm caktux/travis-cli encrypt key=value -r kubernetes/ingress
- RELEASE="ci-${TRAVIS_BUILD_ID}"

before_script:
- export PATH=$PATH:$PWD/hack/e2e-internal/

jobs:
include:
- stage: Static Check
Expand All @@ -34,4 +25,3 @@ jobs:
- go get github.com/modocache/gover
- if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
- make cover
#- make test-e2e
18 changes: 0 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,6 @@ all: fmt lint vet

BUILDTAGS=

# building inside travis generates a custom version of the
# backends in order to run e2e tests agains the build.
ifdef TRAVIS_BUILD_ID
RELEASE := ci-build-${TRAVIS_BUILD_ID}
endif

# 0.0 shouldn't clobber any release builds
RELEASE?=0.0

# by default build a linux version
GOOS?=linux

REPO_INFO=$(shell git config --get remote.origin.url)

ifndef COMMIT
COMMIT := git-$(shell git rev-parse --short HEAD)
endif

# base package. It contains the common and backends code
PKG := "k8s.io/ingress"

Expand Down
19 changes: 9 additions & 10 deletions controllers/nginx/pkg/cmd/controller/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ import (
"github.com/spf13/pflag"

proxyproto "github.com/armon/go-proxyproto"
api "k8s.io/api/core/v1"
api_v1 "k8s.io/api/core/v1"
apiv1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"

"k8s.io/ingress/controllers/nginx/pkg/config"
Expand Down Expand Up @@ -83,7 +82,7 @@ func newNGINXController() *NGINXController {

n := &NGINXController{
binary: ngx,
configmap: &api_v1.ConfigMap{},
configmap: &apiv1.ConfigMap{},
isIPV6Enabled: isIPv6Enabled(),
resolver: h,
ports: &config.ListenPorts{},
Expand Down Expand Up @@ -123,7 +122,7 @@ type NGINXController struct {
controller *controller.GenericController
t *ngx_template.Template

configmap *api_v1.ConfigMap
configmap *apiv1.ConfigMap

storeLister ingress.StoreLister

Expand Down Expand Up @@ -309,7 +308,7 @@ func (n NGINXController) DefaultEndpoint() ingress.Endpoint {
return ingress.Endpoint{
Address: "127.0.0.1",
Port: fmt.Sprintf("%v", n.ports.Default),
Target: &api.ObjectReference{},
Target: &apiv1.ObjectReference{},
}
}

Expand Down Expand Up @@ -443,7 +442,7 @@ Error: %v
}

// SetConfig sets the configured configmap
func (n *NGINXController) SetConfig(cmap *api_v1.ConfigMap) {
func (n *NGINXController) SetConfig(cmap *apiv1.ConfigMap) {
n.configmap = cmap
n.isProxyProtocolEnabled = false

Expand All @@ -469,7 +468,7 @@ func (n *NGINXController) SetListers(lister ingress.StoreLister) {
}

// UpdateIngressStatus custom Ingress status update
func (n *NGINXController) UpdateIngressStatus(*extensions.Ingress) []api_v1.LoadBalancerIngress {
func (n *NGINXController) UpdateIngressStatus(*extensions.Ingress) []apiv1.LoadBalancerIngress {
return nil
}

Expand Down Expand Up @@ -598,7 +597,7 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
}

if exists {
setHeaders = cmap.(*api_v1.ConfigMap).Data
setHeaders = cmap.(*apiv1.ConfigMap).Data
}
}

Expand All @@ -610,7 +609,7 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
}

if exists {
addHeaders = cmap.(*api_v1.ConfigMap).Data
addHeaders = cmap.(*apiv1.ConfigMap).Data
}
}

Expand All @@ -623,7 +622,7 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
}

if exists {
secret := s.(*api_v1.Secret)
secret := s.(*apiv1.Secret)
nsSecName := strings.Replace(secretName, "/", "-", -1)

dh, ok := secret.Data["dhparam.pem"]
Expand Down
1 change: 1 addition & 0 deletions controllers/nginx/pkg/cmd/controller/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net"

"github.com/golang/glog"

"github.com/paultag/sniff/parser"
)

Expand Down
4 changes: 2 additions & 2 deletions controllers/nginx/pkg/cmd/controller/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"os/exec"
"syscall"

"k8s.io/kubernetes/pkg/util/sysctl"

"github.com/golang/glog"

"k8s.io/kubernetes/pkg/util/sysctl"
)

// sysctlSomaxconn returns the value of net.core.somaxconn, i.e.
Expand Down
1 change: 1 addition & 0 deletions controllers/nginx/pkg/metric/collector/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package collector

import (
"github.com/golang/glog"

"github.com/prometheus/client_golang/prometheus"
)

Expand Down
1 change: 1 addition & 0 deletions controllers/nginx/pkg/metric/collector/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"path/filepath"

"github.com/golang/glog"

common "github.com/ncabatoff/process-exporter"
"github.com/ncabatoff/process-exporter/proc"
"github.com/prometheus/client_golang/prometheus"
Expand Down
1 change: 1 addition & 0 deletions controllers/nginx/pkg/metric/collector/vts.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"reflect"

"github.com/golang/glog"

"github.com/prometheus/client_golang/prometheus"
)

Expand Down
1 change: 1 addition & 0 deletions controllers/nginx/pkg/template/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"strings"

"github.com/golang/glog"

"github.com/mitchellh/mapstructure"

"k8s.io/ingress/controllers/nginx/pkg/config"
Expand Down
1 change: 1 addition & 0 deletions controllers/nginx/pkg/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
text_template "text/template"

"github.com/golang/glog"

"github.com/pborman/uuid"

extensions "k8s.io/api/extensions/v1beta1"
Expand Down
2 changes: 1 addition & 1 deletion controllers/nginx/pkg/template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package template
import (
"encoding/json"
"io/ioutil"
"net"
"os"
"path"
"reflect"
Expand All @@ -29,7 +30,6 @@ import (
"k8s.io/ingress/core/pkg/ingress"
"k8s.io/ingress/core/pkg/ingress/annotations/authreq"
"k8s.io/ingress/core/pkg/ingress/annotations/rewrite"
"net"
)

var (
Expand Down
1 change: 1 addition & 0 deletions core/pkg/ingress/controller/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package controller

import (
"github.com/golang/glog"

extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/ingress/core/pkg/ingress/annotations/alias"
"k8s.io/ingress/core/pkg/ingress/annotations/auth"
Expand Down
20 changes: 10 additions & 10 deletions core/pkg/ingress/controller/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package controller
import (
"testing"

api "k8s.io/api/core/v1"
apiv1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"

"k8s.io/ingress/core/pkg/ingress/defaults"
Expand All @@ -40,19 +40,19 @@ const (
)

type mockCfg struct {
MockSecrets map[string]*api.Secret
MockServices map[string]*api.Service
MockSecrets map[string]*apiv1.Secret
MockServices map[string]*apiv1.Service
}

func (m mockCfg) GetDefaultBackend() defaults.Backend {
return defaults.Backend{}
}

func (m mockCfg) GetSecret(name string) (*api.Secret, error) {
func (m mockCfg) GetSecret(name string) (*apiv1.Secret, error) {
return m.MockSecrets[name], nil
}

func (m mockCfg) GetService(name string) (*api.Service, error) {
func (m mockCfg) GetService(name string) (*apiv1.Service, error) {
return m.MockServices[name], nil
}

Expand Down Expand Up @@ -88,9 +88,9 @@ func buildIngress() *extensions.Ingress {
}

return &extensions.Ingress{
ObjectMeta: meta_v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: api.NamespaceDefault,
Namespace: apiv1.NamespaceDefault,
},
Spec: extensions.IngressSpec{
Backend: &extensions.IngressBackend{
Expand Down Expand Up @@ -142,9 +142,9 @@ func TestSecureUpstream(t *testing.T) {

func TestSecureVerifyCACert(t *testing.T) {
ec := newAnnotationExtractor(mockCfg{
MockSecrets: map[string]*api.Secret{
MockSecrets: map[string]*apiv1.Secret{
"default/secure-verify-ca": {
ObjectMeta: meta_v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "secure-verify-ca",
},
},
Expand Down
8 changes: 4 additions & 4 deletions core/pkg/ingress/controller/backend_ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/golang/glog"

api "k8s.io/api/core/v1"
apiv1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/cache"

"k8s.io/ingress/core/pkg/ingress"
Expand Down Expand Up @@ -75,9 +75,9 @@ func (ic *GenericController) getPemCertificate(secretName string) (*ingress.SSLC
return nil, fmt.Errorf("secret named %v does not exist", secretName)
}

secret := secretInterface.(*api.Secret)
cert, okcert := secret.Data[api.TLSCertKey]
key, okkey := secret.Data[api.TLSPrivateKeyKey]
secret := secretInterface.(*apiv1.Secret)
cert, okcert := secret.Data[apiv1.TLSCertKey]
key, okkey := secret.Data[apiv1.TLSPrivateKeyKey]

ca := secret.Data["ca.crt"]

Expand Down
14 changes: 7 additions & 7 deletions core/pkg/ingress/controller/backend_ssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ package controller

import (
"encoding/base64"
"fmt"
"io/ioutil"
"testing"

"fmt"

api_v1 "k8s.io/api/core/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
testclient "k8s.io/client-go/kubernetes/fake"
cache_client "k8s.io/client-go/tools/cache"

"k8s.io/ingress/core/pkg/ingress"
"k8s.io/ingress/core/pkg/ingress/store"
"k8s.io/kubernetes/pkg/api"
Expand Down Expand Up @@ -70,9 +70,9 @@ func buildIngListenerForBackendSSL() store.IngressLister {
return ingLister
}

func buildSecretForBackendSSL() *api_v1.Secret {
return &api_v1.Secret{
ObjectMeta: meta_v1.ObjectMeta{
func buildSecretForBackendSSL() *apiv1.Secret {
return &apiv1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "foo_secret",
Namespace: api.NamespaceDefault,
},
Expand Down
Loading

0 comments on commit 1a68536

Please sign in to comment.