Skip to content

Commit

Permalink
Use apps.Deployment instead of extensions.Deployment (#345)
Browse files Browse the repository at this point in the history
* Use apps.Deployment instead of extensions.Deployment

* import as appsv1 instead of v1
  • Loading branch information
Ville Aikas authored and knative-prow-robot committed Mar 27, 2019
1 parent 0f749ef commit 8b3dc0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ import (
"github.com/mattbaird/jsonpatch"
admissionv1beta1 "k8s.io/api/admission/v1beta1"
admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
appsv1 "k8s.io/api/apps/v1"
authenticationv1 "k8s.io/api/authentication/v1"
corev1 "k8s.io/api/core/v1"
v1beta1 "k8s.io/api/extensions/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -60,7 +60,7 @@ const (
)

var (
deploymentKind = v1beta1.SchemeGroupVersion.WithKind("Deployment")
deploymentKind = appsv1.SchemeGroupVersion.WithKind("Deployment")
errMissingNewObject = errors.New("the new object may not be nil")
)

Expand Down Expand Up @@ -398,7 +398,7 @@ func (ac *AdmissionController) register(
}

// Set the owner to our deployment.
deployment, err := ac.Client.ExtensionsV1beta1().Deployments(ac.Options.Namespace).Get(ac.Options.DeploymentName, metav1.GetOptions{})
deployment, err := ac.Client.Apps().Deployments(ac.Options.Namespace).Get(ac.Options.DeploymentName, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("failed to fetch our deployment: %v", err)
}
Expand Down
7 changes: 3 additions & 4 deletions webhook/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/kubernetes"

// corev1 "k8s.io/api/core/v1"
"k8s.io/api/extensions/v1beta1"
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fakekubeclientset "k8s.io/client-go/kubernetes/fake"

Expand Down Expand Up @@ -589,13 +588,13 @@ func TestSettingWebhookClientAuth(t *testing.T) {
}

func createDeployment(ac *AdmissionController) {
deployment := &v1beta1.Deployment{
deployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "whatever",
Namespace: "knative-something",
},
}
ac.Client.ExtensionsV1beta1().Deployments("knative-something").Create(deployment)
ac.Client.Apps().Deployments("knative-something").Create(deployment)
}

func createResource(name string) *Resource {
Expand Down

0 comments on commit 8b3dc0d

Please sign in to comment.