mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	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:
		@@ -23,11 +23,11 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"k8s.io/api/core/v1"
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
			
		||||
	"k8s.io/client-go/rest/fake"
 | 
			
		||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
			
		||||
	cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -226,7 +226,7 @@ func TestUpdateAnnotations(t *testing.T) {
 | 
			
		||||
		expectErr   bool
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
@@ -235,41 +235,41 @@ func TestUpdateAnnotations(t *testing.T) {
 | 
			
		||||
			expectErr:   true,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			annotations: map[string]string{"a": "c"},
 | 
			
		||||
			overwrite:   true,
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "c"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			annotations: map[string]string{"c": "d"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b", "c": "d"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			annotations: map[string]string{"c": "d"},
 | 
			
		||||
			version:     "2",
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations:     map[string]string{"a": "b", "c": "d"},
 | 
			
		||||
					ResourceVersion: "2",
 | 
			
		||||
@@ -277,28 +277,28 @@ func TestUpdateAnnotations(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			annotations: map[string]string{},
 | 
			
		||||
			remove:      []string{"a"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b", "c": "d"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			annotations: map[string]string{"e": "f"},
 | 
			
		||||
			remove:      []string{"a"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{
 | 
			
		||||
						"c": "d",
 | 
			
		||||
@@ -308,14 +308,14 @@ func TestUpdateAnnotations(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b", "c": "d"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			annotations: map[string]string{"e": "f"},
 | 
			
		||||
			remove:      []string{"g"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{
 | 
			
		||||
						"a": "b",
 | 
			
		||||
@@ -326,13 +326,13 @@ func TestUpdateAnnotations(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b", "c": "d"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			remove: []string{"e"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{
 | 
			
		||||
						"a": "b",
 | 
			
		||||
@@ -342,11 +342,11 @@ func TestUpdateAnnotations(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{},
 | 
			
		||||
			},
 | 
			
		||||
			annotations: map[string]string{"a": "b"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Annotations: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
 
 | 
			
		||||
@@ -23,10 +23,10 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"k8s.io/api/core/v1"
 | 
			
		||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime"
 | 
			
		||||
	"k8s.io/client-go/rest/fake"
 | 
			
		||||
	api "k8s.io/kubernetes/pkg/apis/core"
 | 
			
		||||
	cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/kubectl/resource"
 | 
			
		||||
)
 | 
			
		||||
@@ -164,7 +164,7 @@ func TestLabelFunc(t *testing.T) {
 | 
			
		||||
		expectErr bool
 | 
			
		||||
	}{
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
@@ -173,41 +173,41 @@ func TestLabelFunc(t *testing.T) {
 | 
			
		||||
			expectErr: true,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			labels:    map[string]string{"a": "c"},
 | 
			
		||||
			overwrite: true,
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "c"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			labels: map[string]string{"c": "d"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "b", "c": "d"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			labels:  map[string]string{"c": "d"},
 | 
			
		||||
			version: "2",
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels:          map[string]string{"a": "b", "c": "d"},
 | 
			
		||||
					ResourceVersion: "2",
 | 
			
		||||
@@ -215,28 +215,28 @@ func TestLabelFunc(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			labels: map[string]string{},
 | 
			
		||||
			remove: []string{"a"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "b", "c": "d"},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
			labels: map[string]string{"e": "f"},
 | 
			
		||||
			remove: []string{"a"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{
 | 
			
		||||
						"c": "d",
 | 
			
		||||
@@ -246,11 +246,11 @@ func TestLabelFunc(t *testing.T) {
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			obj: &api.Pod{
 | 
			
		||||
			obj: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{},
 | 
			
		||||
			},
 | 
			
		||||
			labels: map[string]string{"a": "b"},
 | 
			
		||||
			expected: &api.Pod{
 | 
			
		||||
			expected: &v1.Pod{
 | 
			
		||||
				ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
					Labels: map[string]string{"a": "b"},
 | 
			
		||||
				},
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user