Skip to content

Commit

Permalink
improve metav1 package import statement (istio#42858)
Browse files Browse the repository at this point in the history
Signed-off-by: xin.li <xin.li@daocloud.io>

Signed-off-by: xin.li <xin.li@daocloud.io>
  • Loading branch information
my-git9 authored Jan 18, 2023
1 parent 5f471c3 commit d2ffbb9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions operator/pkg/helmreconciler/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sync"
"testing"

v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -61,7 +61,7 @@ func TestHelmReconciler_ApplyObject(t *testing.T) {
client: cl,
opts: &Options{},
iop: &v1alpha1.IstioOperator{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: "test-operator",
Namespace: "istio-operator-test",
},
Expand Down
6 changes: 3 additions & 3 deletions pilot/pkg/leaderelection/leaderelection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"go.uber.org/atomic"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/fake"
Expand Down Expand Up @@ -254,11 +254,11 @@ func TestLeaderElectionConfigMapRemoved(t *testing.T) {
client := fake.NewSimpleClientset()
watcher := &fakeDefaultWatcher{}
_, stop := createElection(t, "pod1", "", watcher, true, true, client)
if err := client.CoreV1().ConfigMaps("ns").Delete(context.TODO(), testLock, v1.DeleteOptions{}); err != nil {
if err := client.CoreV1().ConfigMaps("ns").Delete(context.TODO(), testLock, metav1.DeleteOptions{}); err != nil {
t.Fatal(err)
}
retry.UntilSuccessOrFail(t, func() error {
l, err := client.CoreV1().ConfigMaps("ns").List(context.TODO(), v1.ListOptions{})
l, err := client.CoreV1().ConfigMaps("ns").List(context.TODO(), metav1.ListOptions{})
if err != nil {
return err
}
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/pilot/mcs/autoexport/autoexport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"time"

k8sErrors "k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"istio.io/istio/pkg/test/framework"
"istio.io/istio/pkg/test/framework/components/echo"
Expand Down Expand Up @@ -71,7 +71,7 @@ func TestAutoExport(t *testing.T) {
ctx.NewSubTest("create").Run(func(ctx framework.TestContext) {
retry.UntilSuccessOrFail(ctx, func() error {
serviceExport, err := cluster.Dynamic().Resource(serviceExportGVR).Namespace(echos.Namespace.Name()).Get(
context.TODO(), common.ServiceB, v1.GetOptions{})
context.TODO(), common.ServiceB, metav1.GetOptions{})
if err != nil {
return err
}
Expand All @@ -88,14 +88,14 @@ func TestAutoExport(t *testing.T) {
// Delete the echo Service and verify that the ServiceExport is automatically removed.
ctx.NewSubTest("delete").Run(func(ctx framework.TestContext) {
err := cluster.Kube().CoreV1().Services(echos.Namespace.Name()).Delete(
context.TODO(), common.ServiceB, v1.DeleteOptions{})
context.TODO(), common.ServiceB, metav1.DeleteOptions{})
if err != nil {
ctx.Fatalf("failed deleting service %s/%s in cluster %s: %v",
echos.Namespace, common.ServiceB, cluster.Name(), err)
}
retry.UntilSuccessOrFail(t, func() error {
_, err := cluster.Dynamic().Resource(serviceExportGVR).Namespace(echos.Namespace.Name()).Get(
context.TODO(), common.ServiceB, v1.GetOptions{})
context.TODO(), common.ServiceB, metav1.GetOptions{})

if err != nil && k8sErrors.IsNotFound(err) {
// Success! We automatically removed the ServiceExport when the Service
Expand All @@ -122,7 +122,7 @@ func TestAutoExport(t *testing.T) {
cluster := cluster
ctx.NewSubTest(strconv.Itoa(i)).RunParallel(func(ctx framework.TestContext) {
services, err := cluster.Dynamic().Resource(serviceExportGVR).Namespace(ns).List(
context.TODO(), v1.ListOptions{})
context.TODO(), metav1.ListOptions{})
if err != nil {
ctx.Fatal(err)
}
Expand Down

0 comments on commit d2ffbb9

Please sign in to comment.