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

Use apps/v1 api group in e2e tests #4135

Merged
merged 1 commit into from
May 29, 2019
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
6 changes: 3 additions & 3 deletions test/e2e/defaultbackend/custom_default_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/parnurzeal/gorequest"

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

"k8s.io/ingress-nginx/test/e2e/framework"
)
Expand All @@ -37,11 +37,11 @@ var _ = framework.IngressNginxDescribe("Custom Default Backend", func() {
f.NewEchoDeploymentWithReplicas(1)

framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
func(deployment *appsv1beta1.Deployment) error {
func(deployment *appsv1.Deployment) error {
args := deployment.Spec.Template.Spec.Containers[0].Args
args = append(args, "--default-backend-service=$(POD_NAMESPACE)/http-svc")
deployment.Spec.Template.Spec.Containers[0].Args = args
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
_, err := f.KubeClientSet.AppsV1().Deployments(f.Namespace).Update(deployment)

return err
})
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"strings"
"time"

appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
apiextcs "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
Expand Down Expand Up @@ -306,8 +306,8 @@ func (f *Framework) DeleteNGINXPod(grace int64) {
}

// UpdateDeployment runs the given updateFunc on the deployment and waits for it to be updated
func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name string, replicas int, updateFunc func(d *appsv1beta1.Deployment) error) error {
deployment, err := kubeClientSet.AppsV1beta1().Deployments(namespace).Get(name, metav1.GetOptions{})
func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name string, replicas int, updateFunc func(d *appsv1.Deployment) error) error {
deployment, err := kubeClientSet.AppsV1().Deployments(namespace).Get(name, metav1.GetOptions{})
if err != nil {
return err
}
Expand All @@ -320,13 +320,13 @@ func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name

if *deployment.Spec.Replicas != int32(replicas) {
klog.Infof("updating replica count from %v to %v...", *deployment.Spec.Replicas, replicas)
deployment, err := kubeClientSet.AppsV1beta1().Deployments(namespace).Get(name, metav1.GetOptions{})
deployment, err := kubeClientSet.AppsV1().Deployments(namespace).Get(name, metav1.GetOptions{})
if err != nil {
return err
}

deployment.Spec.Replicas = NewInt32(int32(replicas))
_, err = kubeClientSet.AppsV1beta1().Deployments(namespace).Update(deployment)
_, err = kubeClientSet.AppsV1().Deployments(namespace).Update(deployment)
if err != nil {
return errors.Wrapf(err, "scaling the number of replicas to %v", replicas)
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/settings/default_ssl_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

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

"k8s.io/ingress-nginx/test/e2e/framework"
)
Expand All @@ -47,11 +47,11 @@ var _ = framework.IngressNginxDescribe("default-ssl-certificate", func() {
Expect(err).NotTo(HaveOccurred())

framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
func(deployment *appsv1beta1.Deployment) error {
func(deployment *appsv1.Deployment) error {
args := deployment.Spec.Template.Spec.Containers[0].Args
args = append(args, "--default-ssl-certificate=$(POD_NAMESPACE)/"+secretName)
deployment.Spec.Template.Spec.Containers[0].Args = args
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
_, err := f.KubeClientSet.AppsV1().Deployments(f.Namespace).Update(deployment)

return err
})
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/settings/disable_catch_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
. "github.com/onsi/gomega"

"github.com/parnurzeal/gorequest"
appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/util/intstr"

Expand All @@ -38,11 +38,11 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
f.NewEchoDeploymentWithReplicas(1)

framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
func(deployment *appsv1beta1.Deployment) error {
func(deployment *appsv1.Deployment) error {
args := deployment.Spec.Template.Spec.Containers[0].Args
args = append(args, "--disable-catch-all=true")
deployment.Spec.Template.Spec.Containers[0].Args = args
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
_, err := f.KubeClientSet.AppsV1().Deployments(f.Namespace).Update(deployment)

return err
})
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/settings/ingress_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/parnurzeal/gorequest"
appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1"

"k8s.io/ingress-nginx/test/e2e/framework"
)
Expand Down Expand Up @@ -76,11 +76,11 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
Context("With a specific ingress-class", func() {
BeforeEach(func() {
framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
func(deployment *appsv1beta1.Deployment) error {
func(deployment *appsv1.Deployment) error {
args := deployment.Spec.Template.Spec.Containers[0].Args
args = append(args, "--ingress-class=testclass")
deployment.Spec.Template.Spec.Containers[0].Args = args
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
_, err := f.KubeClientSet.AppsV1().Deployments(f.Namespace).Update(deployment)

return err
})
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/settings/pod_security_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
. "github.com/onsi/gomega"
"github.com/parnurzeal/gorequest"

appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down Expand Up @@ -65,11 +65,11 @@ var _ = framework.IngressNginxDescribe("[Serial] Pod Security Policies", func()

// update the deployment just to trigger a rolling update and the use of the security policy
err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
func(deployment *appsv1beta1.Deployment) error {
func(deployment *appsv1.Deployment) error {
args := deployment.Spec.Template.Spec.Containers[0].Args
args = append(args, "--v=2")
deployment.Spec.Template.Spec.Containers[0].Args = args
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
_, err := f.KubeClientSet.AppsV1().Deployments(f.Namespace).Update(deployment)

return err
})
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/status/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1 "k8s.io/api/apps/v1"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
Expand All @@ -50,7 +50,7 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() {
Expect(err).NotTo(HaveOccurred(), "unexpected error starting kubectl proxy")

err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
func(deployment *appsv1beta1.Deployment) error {
func(deployment *appsv1.Deployment) error {
args := deployment.Spec.Template.Spec.Containers[0].Args
args = append(args, fmt.Sprintf("--apiserver-host=http://%s:%d", address.String(), port))
args = append(args, "--publish-status-address=1.1.0.0")
Expand All @@ -67,7 +67,7 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() {
}

deployment.Spec.Template.Spec.Containers[0].Args = args
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
_, err := f.KubeClientSet.AppsV1().Deployments(f.Namespace).Update(deployment)
return err
})
Expect(err).NotTo(HaveOccurred(), "unexpected error updating ingress controller deployment flags")
Expand Down