Skip to content

Commit

Permalink
Merge pull request #1880 from aledbf/master
Browse files Browse the repository at this point in the history
Update go dependencies and cleanup deprecated packages
  • Loading branch information
aledbf authored Jan 7, 2018
2 parents a09527c + c795447 commit 983b994
Show file tree
Hide file tree
Showing 1,208 changed files with 84,099 additions and 32,965 deletions.
34 changes: 14 additions & 20 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@
branch = "master"
name = "github.com/paultag/sniff"

[[constraint]]
name = "github.com/pborman/uuid"
version = "1.1.0"

[[constraint]]
name = "github.com/pkg/errors"
version = "0.8.0"
Expand Down Expand Up @@ -95,16 +91,16 @@

[[constraint]]
name = "k8s.io/api"
branch = "release-1.8"
branch = "release-1.9"

[[constraint]]
name = "k8s.io/apimachinery"
branch = "release-1.8"
branch = "release-1.9"

[[constraint]]
name = "k8s.io/client-go"
version = "v5.0.1"
version = "v6.0.0"

[[constraint]]
name = "k8s.io/kubernetes"
version = "v1.8.3"
version = "v1.9.0"
19 changes: 9 additions & 10 deletions internal/ingress/controller/backend_ssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"k8s.io/ingress-nginx/internal/ingress"
"k8s.io/ingress-nginx/internal/ingress/store"
"k8s.io/ingress-nginx/internal/task"
"k8s.io/kubernetes/pkg/api"
)

const (
Expand Down Expand Up @@ -76,7 +75,7 @@ func buildSecretForBackendSSL() *apiv1.Secret {
return &apiv1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "foo_secret",
Namespace: api.NamespaceDefault,
Namespace: metav1.NamespaceDefault,
},
}
}
Expand Down Expand Up @@ -153,8 +152,8 @@ func TestSyncSecret(t *testing.T) {
Data map[string][]byte
expectSuccess bool
}{
{"getPemCertificate_error", "default/foo_secret", map[string][]byte{api.TLSPrivateKeyKey: dKey}, false},
{"normal_test", "default/foo_secret", map[string][]byte{api.TLSCertKey: dCrt, api.TLSPrivateKeyKey: dKey, tlscaName: dCa}, true},
{"getPemCertificate_error", "default/foo_secret", map[string][]byte{apiv1.TLSPrivateKeyKey: dKey}, false},
{"normal_test", "default/foo_secret", map[string][]byte{apiv1.TLSCertKey: dCrt, apiv1.TLSPrivateKeyKey: dKey, tlscaName: dCa}, true},
}

for _, foo := range foos {
Expand Down Expand Up @@ -200,12 +199,12 @@ func TestGetPemCertificate(t *testing.T) {
}{
{"sceret_not_exist", "default/foo_secret_not_exist", nil, true},
{"data_not_complete_all_not_exist", "default/foo_secret", map[string][]byte{}, true},
{"data_not_complete_TLSCertKey_not_exist", "default/foo_secret", map[string][]byte{api.TLSPrivateKeyKey: dKey, tlscaName: dCa}, false},
{"data_not_complete_TLSCertKeyAndCA_not_exist", "default/foo_secret", map[string][]byte{api.TLSPrivateKeyKey: dKey}, true},
{"data_not_complete_TLSPrivateKeyKey_not_exist", "default/foo_secret", map[string][]byte{api.TLSCertKey: dCrt, tlscaName: dCa}, false},
{"data_not_complete_TLSPrivateKeyKeyAndCA_not_exist", "default/foo_secret", map[string][]byte{api.TLSCertKey: dCrt}, true},
{"data_not_complete_CA_not_exist", "default/foo_secret", map[string][]byte{api.TLSCertKey: dCrt, api.TLSPrivateKeyKey: dKey}, false},
{"normal_test", "default/foo_secret", map[string][]byte{api.TLSCertKey: dCrt, api.TLSPrivateKeyKey: dKey, tlscaName: dCa}, false},
{"data_not_complete_TLSCertKey_not_exist", "default/foo_secret", map[string][]byte{apiv1.TLSPrivateKeyKey: dKey, tlscaName: dCa}, false},
{"data_not_complete_TLSCertKeyAndCA_not_exist", "default/foo_secret", map[string][]byte{apiv1.TLSPrivateKeyKey: dKey}, true},
{"data_not_complete_TLSPrivateKeyKey_not_exist", "default/foo_secret", map[string][]byte{apiv1.TLSCertKey: dCrt, tlscaName: dCa}, false},
{"data_not_complete_TLSPrivateKeyKeyAndCA_not_exist", "default/foo_secret", map[string][]byte{apiv1.TLSCertKey: dCrt}, true},
{"data_not_complete_CA_not_exist", "default/foo_secret", map[string][]byte{apiv1.TLSCertKey: dCrt, apiv1.TLSPrivateKeyKey: dKey}, false},
{"normal_test", "default/foo_secret", map[string][]byte{apiv1.TLSCertKey: dCrt, apiv1.TLSPrivateKeyKey: dKey, tlscaName: dCa}, false},
}

for _, foo := range foos {
Expand Down
27 changes: 6 additions & 21 deletions internal/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (

apiv1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
clientset "k8s.io/client-go/kubernetes"
Expand All @@ -55,15 +54,6 @@ const (
rootLocation = "/"
)

var (
cloner *conversion.Cloner
)

func init() {
cloner := conversion.NewCloner()
cloner.RegisterDeepCopyFunc(ingress.GetGeneratedDeepCopyFuncs)
}

// Configuration contains all the settings required by an Ingress controller
type Configuration struct {
APIServerHost string
Expand Down Expand Up @@ -554,17 +544,12 @@ func (n *NGINXController) getBackendServers(ingresses []*extensions.Ingress) ([]
if len(endps) > 0 {
glog.V(3).Infof("using custom default backend in server %v location %v (service %v/%v)",
server.Hostname, location.Path, location.DefaultBackend.Namespace, location.DefaultBackend.Name)
b, err := cloner.DeepCopy(upstream)
if err != nil {
glog.Errorf("unexpected error copying Upstream: %v", err)
} else {
name := fmt.Sprintf("custom-default-backend-%v", upstream.Name)
nb := b.(*ingress.Backend)
nb.Name = name
nb.Endpoints = endps
aUpstreams = append(aUpstreams, nb)
location.Backend = name
}
nb := upstream.DeepCopy()
name := fmt.Sprintf("custom-default-backend-%v", upstream.Name)
nb.Name = name
nb.Endpoints = endps
aUpstreams = append(aUpstreams, nb)
location.Backend = name
}
}
}
Expand Down
Loading

0 comments on commit 983b994

Please sign in to comment.