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

v1beta1: Update all controllers to use networking.k8s.io/v1beta1 #4081

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions cmd/plugin/commands/ingresses/ingresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"
"text/tabwriter"

"k8s.io/api/extensions/v1beta1"
networking "k8s.io/api/networking/v1beta1"
"k8s.io/cli-runtime/pkg/genericclioptions"

"k8s.io/ingress-nginx/cmd/plugin/request"
Expand Down Expand Up @@ -130,7 +130,7 @@ type ingressRow struct {
NumEndpoints string
}

func getIngressRows(ingresses *[]v1beta1.Ingress) []ingressRow {
func getIngressRows(ingresses *[]networking.Ingress) []ingressRow {
rows := make([]ingressRow, 0)

for _, ing := range *ingresses {
Expand Down
4 changes: 2 additions & 2 deletions cmd/plugin/commands/lint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

appsv1 "k8s.io/api/apps/v1"

"k8s.io/api/extensions/v1beta1"
networking "k8s.io/api/networking/v1beta1"
kmeta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/ingress-nginx/cmd/plugin/lints"
Expand Down Expand Up @@ -178,7 +178,7 @@ func checkObjectArray(lints []lint, objects []kmeta.Object, opts lintOptions) {
}

func ingresses(opts lintOptions) error {
var ings []v1beta1.Ingress
var ings []networking.Ingress
var err error
if opts.allNamespaces {
ings, err = request.GetIngressDefinitions(opts.flags, "")
Expand Down
16 changes: 8 additions & 8 deletions cmd/plugin/lints/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"strings"

"k8s.io/api/extensions/v1beta1"
networking "k8s.io/api/networking/v1beta1"
kmeta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/ingress-nginx/cmd/plugin/util"
)
Expand All @@ -30,12 +30,12 @@ type IngressLint struct {
message string
issue int
version string
f func(ing v1beta1.Ingress) bool
f func(ing networking.Ingress) bool
}

// Check returns true if the lint detects an issue
func (lint IngressLint) Check(obj kmeta.Object) bool {
ing := obj.(*v1beta1.Ingress)
ing := obj.(*networking.Ingress)
return lint.f(*ing)
}

Expand Down Expand Up @@ -87,7 +87,7 @@ func GetIngressLints() []IngressLint {
}
}

func xForwardedPrefixIsBool(ing v1beta1.Ingress) bool {
func xForwardedPrefixIsBool(ing networking.Ingress) bool {
for name, val := range ing.Annotations {
if strings.HasSuffix(name, "/x-forwarded-prefix") && (val == "true" || val == "false") {
return true
Expand All @@ -96,7 +96,7 @@ func xForwardedPrefixIsBool(ing v1beta1.Ingress) bool {
return false
}

func annotationPrefixIsNginxCom(ing v1beta1.Ingress) bool {
func annotationPrefixIsNginxCom(ing networking.Ingress) bool {
for name := range ing.Annotations {
if strings.HasPrefix(name, "nginx.com/") {
return true
Expand All @@ -105,7 +105,7 @@ func annotationPrefixIsNginxCom(ing v1beta1.Ingress) bool {
return false
}

func annotationPrefixIsNginxOrg(ing v1beta1.Ingress) bool {
func annotationPrefixIsNginxOrg(ing networking.Ingress) bool {
for name := range ing.Annotations {
if strings.HasPrefix(name, "nginx.org/") {
return true
Expand All @@ -114,7 +114,7 @@ func annotationPrefixIsNginxOrg(ing v1beta1.Ingress) bool {
return false
}

func rewriteTargetWithoutCaptureGroup(ing v1beta1.Ingress) bool {
func rewriteTargetWithoutCaptureGroup(ing networking.Ingress) bool {
for name, val := range ing.Annotations {
if strings.HasSuffix(name, "/rewrite-target") && !strings.Contains(val, "$1") {
return true
Expand All @@ -128,7 +128,7 @@ func removedAnnotation(annotationName string, issueNumber int, version string) I
message: fmt.Sprintf("Contains the removed %v annotation.", annotationName),
issue: issueNumber,
version: version,
f: func(ing v1beta1.Ingress) bool {
f: func(ing networking.Ingress) bool {
for annotation := range ing.Annotations {
if strings.HasSuffix(annotation, "/"+annotationName) {
return true
Expand Down
14 changes: 7 additions & 7 deletions cmd/plugin/request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (

appsv1 "k8s.io/api/apps/v1"
apiv1 "k8s.io/api/core/v1"
"k8s.io/api/extensions/v1beta1"
networking "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/cli-runtime/pkg/genericclioptions"
appsv1client "k8s.io/client-go/kubernetes/typed/apps/v1"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
extensions "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
netv1beta1client "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
"k8s.io/ingress-nginx/cmd/plugin/util"
)

Expand Down Expand Up @@ -90,20 +90,20 @@ func GetDeployments(flags *genericclioptions.ConfigFlags, namespace string) ([]a
}

// GetIngressDefinitions returns an array of Ingress resource definitions
func GetIngressDefinitions(flags *genericclioptions.ConfigFlags, namespace string) ([]v1beta1.Ingress, error) {
func GetIngressDefinitions(flags *genericclioptions.ConfigFlags, namespace string) ([]networking.Ingress, error) {
rawConfig, err := flags.ToRESTConfig()
if err != nil {
return make([]v1beta1.Ingress, 0), err
return make([]networking.Ingress, 0), err
}

api, err := extensions.NewForConfig(rawConfig)
api, err := netv1beta1client.NewForConfig(rawConfig)
if err != nil {
return make([]v1beta1.Ingress, 0), err
return make([]networking.Ingress, 0), err
}

pods, err := api.Ingresses(namespace).List(metav1.ListOptions{})
if err != nil {
return make([]v1beta1.Ingress, 0), err
return make([]networking.Ingress, 0), err
}

return pods.Items, nil
Expand Down
41 changes: 29 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,42 @@ require (
cloud.google.com/go v0.37.2 // indirect
contrib.go.opencensus.io/exporter/ocagent v0.4.12 // indirect
github.com/Azure/go-autorest v11.7.1+incompatible // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/Sirupsen/logrus v1.4.0 // indirect
github.com/armon/go-proxyproto v0.0.0-20190211145416-68259f75880e
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/go-units v0.3.3 // indirect
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
github.com/eapache/channels v1.1.0
github.com/elazarl/goproxy v0.0.0-20190410145444-c548f45dcf1d // indirect
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/elazarl/goproxy/ext v0.0.0-20190410145444-c548f45dcf1d // indirect
github.com/emicklei/go-restful v2.9.3+incompatible // indirect
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
github.com/emicklei/go-restful v2.9.4+incompatible // indirect
github.com/evanphx/json-patch v4.2.0+incompatible // indirect
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
github.com/go-openapi/jsonpointer v0.19.0 // indirect
github.com/go-openapi/jsonreference v0.19.0 // indirect
github.com/go-openapi/spec v0.19.0 // indirect
github.com/go-openapi/swag v0.19.0 // indirect
github.com/gofortune/gofortune v0.0.1-snapshot // indirect
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/google/uuid v1.0.0
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/google/uuid v1.1.1
github.com/gophercloud/gophercloud v0.0.0-20190410012400-2c55d17f707c // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/imdario/mergo v0.3.7
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v1.1.6
github.com/kisielk/errcheck v1.2.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
github.com/mailru/easyjson v0.0.0-20190403194419-1ea4449da983 // indirect
github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936
github.com/mitchellh/hashstructure v1.0.0
github.com/mitchellh/mapstructure v1.1.2
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/moul/http2curl v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20190414153302-2ae31c8b6b30 // indirect
github.com/ncabatoff/go-seq v0.0.0-20180805175032-b08ef85ed833 // indirect
github.com/ncabatoff/process-exporter v0.0.0-20180915144445-bdf24ef23850
github.com/ncabatoff/procfs v0.0.0-20180903163354-e1a38cb53622 // indirect
Expand All @@ -50,31 +58,40 @@ require (
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
github.com/prometheus/common v0.2.0
github.com/prometheus/procfs v0.0.0-20190328153300-af7bedc223fb // indirect
github.com/sirupsen/logrus v1.4.1 // indirect
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3
github.com/stretchr/objx v0.2.0 // indirect
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926
github.com/zakjan/cert-chain-resolver v0.0.0-20180703112424-6076e1ded272
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5 // indirect
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190513172155-8696927a2839 // indirect
google.golang.org/grpc v1.19.1
gopkg.in/fsnotify/fsnotify.v1 v1.4.7
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/pool.v3 v3.1.1

k8s.io/api v0.0.0-20190313235455-40a48860b5ab
k8s.io/api v0.0.0-20190512063542-eae0ddcf85ba
k8s.io/apiextensions-apiserver v0.0.0-20190315093550-53c4693659ed
k8s.io/apimachinery v0.0.0-20190313205120-d7deff9243b1
k8s.io/apimachinery v0.0.0-20190511063452-5b67e417bf61
k8s.io/apiserver v0.0.0-20190313205120-8b27c41bdbb1
k8s.io/cli-runtime v0.0.0-20190314001948-2899ed30580f
k8s.io/client-go v11.0.0+incompatible
k8s.io/cloud-provider v0.0.0-20190323031113-9c9d72d1bf90 // indirect
k8s.io/code-generator v0.0.0-00010101000000-000000000000
k8s.io/component-base v0.0.0-20190313120452-4727f38490bc
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a // indirect
k8s.io/klog v0.3.0
k8s.io/kube-openapi v0.0.0-20190320154901-5e45bb682580 // indirect
k8s.io/kube-openapi v0.0.0-20190510232812-a01b7d5d6c22 // indirect
k8s.io/kubernetes v1.14.1
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 // indirect
sigs.k8s.io/kind v0.0.0-20190510193412-0a6ceaec7a64 // indirect
sigs.k8s.io/kustomize v2.0.3+incompatible // indirect
sigs.k8s.io/yaml v1.1.0 // indirect
)

replace (
Expand Down
Loading