fix static check of importing the same package multiple times
Signed-off-by: prateekpandey14 <prateekpandey14@gmail.com>
This commit is contained in:
@@ -25,7 +25,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apiserver/pkg/admission"
|
||||
"k8s.io/kubernetes/pkg/apis/core"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
)
|
||||
|
||||
func makeSvc(externalIPs ...string) *core.Service {
|
||||
@@ -98,7 +97,7 @@ func TestAdmission(t *testing.T) {
|
||||
attrs := admission.NewAttributesRecord(
|
||||
tc.newSvc, // new object
|
||||
tc.oldSvc, // old object
|
||||
api.Kind("Service").WithVersion("version"),
|
||||
core.Kind("Service").WithVersion("version"),
|
||||
tc.newSvc.Namespace,
|
||||
tc.newSvc.Name,
|
||||
corev1.Resource("services").WithVersion("version"),
|
||||
|
@@ -32,7 +32,6 @@ import (
|
||||
schedulingv1listers "k8s.io/client-go/listers/scheduling/v1"
|
||||
"k8s.io/component-base/featuregate"
|
||||
"k8s.io/kubernetes/pkg/apis/core"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
)
|
||||
@@ -99,7 +98,7 @@ func (p *Plugin) SetExternalKubeInformerFactory(f informers.SharedInformerFactor
|
||||
}
|
||||
|
||||
var (
|
||||
podResource = api.Resource("pods")
|
||||
podResource = core.Resource("pods")
|
||||
priorityClassResource = scheduling.Resource("priorityclasses")
|
||||
)
|
||||
|
||||
@@ -146,13 +145,13 @@ func (p *Plugin) Validate(ctx context.Context, a admission.Attributes, o admissi
|
||||
// admitPod makes sure a new pod does not set spec.Priority field. It also makes sure that the PriorityClassName exists if it is provided and resolves the pod priority from the PriorityClassName.
|
||||
func (p *Plugin) admitPod(a admission.Attributes) error {
|
||||
operation := a.GetOperation()
|
||||
pod, ok := a.GetObject().(*api.Pod)
|
||||
pod, ok := a.GetObject().(*core.Pod)
|
||||
if !ok {
|
||||
return errors.NewBadRequest("resource was marked with kind Pod but was unable to be converted")
|
||||
}
|
||||
|
||||
if operation == admission.Update {
|
||||
oldPod, ok := a.GetOldObject().(*api.Pod)
|
||||
oldPod, ok := a.GetOldObject().(*core.Pod)
|
||||
if !ok {
|
||||
return errors.NewBadRequest("resource was marked with kind Pod but was unable to be converted")
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@ import (
|
||||
"testing"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
nodev1 "k8s.io/api/node/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -34,7 +33,6 @@ import (
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
"k8s.io/component-base/featuregate"
|
||||
"k8s.io/kubernetes/pkg/apis/core"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
|
||||
@@ -257,18 +255,18 @@ func TestSetScheduling(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
|
||||
Handler: "bar",
|
||||
Scheduling: &nodev1.Scheduling{
|
||||
Tolerations: []v1.Toleration{
|
||||
Tolerations: []corev1.Toleration{
|
||||
{
|
||||
Key: "foo",
|
||||
Operator: v1.TolerationOpEqual,
|
||||
Operator: corev1.TolerationOpEqual,
|
||||
Value: "bar",
|
||||
Effect: v1.TaintEffectNoSchedule,
|
||||
Effect: corev1.TaintEffectNoSchedule,
|
||||
},
|
||||
{
|
||||
Key: "fizz",
|
||||
Operator: v1.TolerationOpEqual,
|
||||
Operator: corev1.TolerationOpEqual,
|
||||
Value: "buzz",
|
||||
Effect: v1.TaintEffectNoSchedule,
|
||||
Effect: corev1.TaintEffectNoSchedule,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -407,19 +405,19 @@ func TestAdmit(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: runtimeClassName},
|
||||
}
|
||||
|
||||
pod := api.Pod{
|
||||
pod := core.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "podname"},
|
||||
Spec: api.PodSpec{
|
||||
Spec: core.PodSpec{
|
||||
RuntimeClassName: &runtimeClassName,
|
||||
},
|
||||
}
|
||||
|
||||
attributes := admission.NewAttributesRecord(&pod,
|
||||
nil,
|
||||
api.Kind("kind").WithVersion("version"),
|
||||
core.Kind("kind").WithVersion("version"),
|
||||
"",
|
||||
"",
|
||||
api.Resource("pods").WithVersion("version"),
|
||||
core.Resource("pods").WithVersion("version"),
|
||||
"",
|
||||
admission.Create,
|
||||
nil,
|
||||
|
Reference in New Issue
Block a user