Merge pull request #55604 from zjj2wry/kubectl_api_dep

Automatic merge from submit-queue (batch tested with PRs 55557, 55504, 56269, 55604, 56202). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove internal version api from kubectl

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
/cc @liggitt  
**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-12-14 13:54:46 -08:00 committed by GitHub
commit 126aafb287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 32 deletions

View File

@ -23,11 +23,11 @@ import (
"strings" "strings"
"testing" "testing"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest/fake" "k8s.io/client-go/rest/fake"
api "k8s.io/kubernetes/pkg/apis/core"
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
) )
@ -226,7 +226,7 @@ func TestUpdateAnnotations(t *testing.T) {
expectErr bool expectErr bool
}{ }{
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b"}, Annotations: map[string]string{"a": "b"},
}, },
@ -235,41 +235,41 @@ func TestUpdateAnnotations(t *testing.T) {
expectErr: true, expectErr: true,
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b"}, Annotations: map[string]string{"a": "b"},
}, },
}, },
annotations: map[string]string{"a": "c"}, annotations: map[string]string{"a": "c"},
overwrite: true, overwrite: true,
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "c"}, Annotations: map[string]string{"a": "c"},
}, },
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b"}, Annotations: map[string]string{"a": "b"},
}, },
}, },
annotations: map[string]string{"c": "d"}, annotations: map[string]string{"c": "d"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b", "c": "d"}, Annotations: map[string]string{"a": "b", "c": "d"},
}, },
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b"}, Annotations: map[string]string{"a": "b"},
}, },
}, },
annotations: map[string]string{"c": "d"}, annotations: map[string]string{"c": "d"},
version: "2", version: "2",
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b", "c": "d"}, Annotations: map[string]string{"a": "b", "c": "d"},
ResourceVersion: "2", ResourceVersion: "2",
@ -277,28 +277,28 @@ func TestUpdateAnnotations(t *testing.T) {
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b"}, Annotations: map[string]string{"a": "b"},
}, },
}, },
annotations: map[string]string{}, annotations: map[string]string{},
remove: []string{"a"}, remove: []string{"a"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{}, Annotations: map[string]string{},
}, },
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b", "c": "d"}, Annotations: map[string]string{"a": "b", "c": "d"},
}, },
}, },
annotations: map[string]string{"e": "f"}, annotations: map[string]string{"e": "f"},
remove: []string{"a"}, remove: []string{"a"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
"c": "d", "c": "d",
@ -308,14 +308,14 @@ func TestUpdateAnnotations(t *testing.T) {
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b", "c": "d"}, Annotations: map[string]string{"a": "b", "c": "d"},
}, },
}, },
annotations: map[string]string{"e": "f"}, annotations: map[string]string{"e": "f"},
remove: []string{"g"}, remove: []string{"g"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
"a": "b", "a": "b",
@ -326,13 +326,13 @@ func TestUpdateAnnotations(t *testing.T) {
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b", "c": "d"}, Annotations: map[string]string{"a": "b", "c": "d"},
}, },
}, },
remove: []string{"e"}, remove: []string{"e"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
"a": "b", "a": "b",
@ -342,11 +342,11 @@ func TestUpdateAnnotations(t *testing.T) {
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{}, ObjectMeta: metav1.ObjectMeta{},
}, },
annotations: map[string]string{"a": "b"}, annotations: map[string]string{"a": "b"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{"a": "b"}, Annotations: map[string]string{"a": "b"},
}, },

View File

@ -23,10 +23,10 @@ import (
"strings" "strings"
"testing" "testing"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest/fake" "k8s.io/client-go/rest/fake"
api "k8s.io/kubernetes/pkg/apis/core"
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
"k8s.io/kubernetes/pkg/kubectl/resource" "k8s.io/kubernetes/pkg/kubectl/resource"
) )
@ -164,7 +164,7 @@ func TestLabelFunc(t *testing.T) {
expectErr bool expectErr bool
}{ }{
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"}, Labels: map[string]string{"a": "b"},
}, },
@ -173,41 +173,41 @@ func TestLabelFunc(t *testing.T) {
expectErr: true, expectErr: true,
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"}, Labels: map[string]string{"a": "b"},
}, },
}, },
labels: map[string]string{"a": "c"}, labels: map[string]string{"a": "c"},
overwrite: true, overwrite: true,
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "c"}, Labels: map[string]string{"a": "c"},
}, },
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"}, Labels: map[string]string{"a": "b"},
}, },
}, },
labels: map[string]string{"c": "d"}, labels: map[string]string{"c": "d"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b", "c": "d"}, Labels: map[string]string{"a": "b", "c": "d"},
}, },
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"}, Labels: map[string]string{"a": "b"},
}, },
}, },
labels: map[string]string{"c": "d"}, labels: map[string]string{"c": "d"},
version: "2", version: "2",
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b", "c": "d"}, Labels: map[string]string{"a": "b", "c": "d"},
ResourceVersion: "2", ResourceVersion: "2",
@ -215,28 +215,28 @@ func TestLabelFunc(t *testing.T) {
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"}, Labels: map[string]string{"a": "b"},
}, },
}, },
labels: map[string]string{}, labels: map[string]string{},
remove: []string{"a"}, remove: []string{"a"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{}, Labels: map[string]string{},
}, },
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b", "c": "d"}, Labels: map[string]string{"a": "b", "c": "d"},
}, },
}, },
labels: map[string]string{"e": "f"}, labels: map[string]string{"e": "f"},
remove: []string{"a"}, remove: []string{"a"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"c": "d", "c": "d",
@ -246,11 +246,11 @@ func TestLabelFunc(t *testing.T) {
}, },
}, },
{ {
obj: &api.Pod{ obj: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{}, ObjectMeta: metav1.ObjectMeta{},
}, },
labels: map[string]string{"a": "b"}, labels: map[string]string{"a": "b"},
expected: &api.Pod{ expected: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"a": "b"}, Labels: map[string]string{"a": "b"},
}, },