mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 18:28:13 +00:00 
			
		
		
		
	Merge pull request #42085 from cblecker/gofmt-fix
Automatic merge from submit-queue (batch tested with PRs 40055, 42085, 44509, 44568, 43956)
Fix gofmt errors
**What this PR does / why we need it**:
There were some gofmt errors on master. Ran the following to fix:
```
hack/verify-gofmt.sh | grep ^diff | awk '{ print $2 }' | xargs gofmt -w -s
```
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: none
**Special notes for your reviewer**:
**Release note**:
```release-note
NONE
```
			
			
This commit is contained in:
		| @@ -174,7 +174,7 @@ func main() { | |||||||
| 		arguments.CustomArgs = clientgenargs.Args{ | 		arguments.CustomArgs = clientgenargs.Args{ | ||||||
| 			Groups: []types.GroupVersions{{Group: "testgroup", Versions: []types.Version{""}}}, | 			Groups: []types.GroupVersions{{Group: "testgroup", Versions: []types.Version{""}}}, | ||||||
| 			GroupVersionToInputPath: map[types.GroupVersion]string{ | 			GroupVersionToInputPath: map[types.GroupVersion]string{ | ||||||
| 				types.GroupVersion{Group: "testgroup", Version: ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/test_apis/testgroup", | 				{Group: "testgroup", Version: ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/test_apis/testgroup", | ||||||
| 			}, | 			}, | ||||||
| 			ClientsetName:       "test_internalclientset", | 			ClientsetName:       "test_internalclientset", | ||||||
| 			ClientsetOutputPath: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/", | 			ClientsetOutputPath: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/", | ||||||
|   | |||||||
| @@ -51,9 +51,9 @@ func TestNewGarbageCollector(t *testing.T) { | |||||||
| 	config.ContentConfig.NegotiatedSerializer = nil | 	config.ContentConfig.NegotiatedSerializer = nil | ||||||
| 	clientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc) | 	clientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc) | ||||||
| 	podResource := map[schema.GroupVersionResource]struct{}{ | 	podResource := map[schema.GroupVersionResource]struct{}{ | ||||||
| 		schema.GroupVersionResource{Version: "v1", Resource: "pods"}: {}, | 		{Version: "v1", Resource: "pods"}: {}, | ||||||
| 		// no monitor will be constructed for non-core resource, the GC construction will not fail. | 		// no monitor will be constructed for non-core resource, the GC construction will not fail. | ||||||
| 		schema.GroupVersionResource{Group: "tpr.io", Version: "v1", Resource: "unknown"}: {}, | 		{Group: "tpr.io", Version: "v1", Resource: "unknown"}: {}, | ||||||
| 	} | 	} | ||||||
| 	gc, err := NewGarbageCollector(metaOnlyClientPool, clientPool, api.Registry.RESTMapper(), podResource) | 	gc, err := NewGarbageCollector(metaOnlyClientPool, clientPool, api.Registry.RESTMapper(), podResource) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @@ -118,7 +118,7 @@ func setupGC(t *testing.T, config *restclient.Config) *GarbageCollector { | |||||||
| 	metaOnlyClientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc) | 	metaOnlyClientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc) | ||||||
| 	config.ContentConfig.NegotiatedSerializer = nil | 	config.ContentConfig.NegotiatedSerializer = nil | ||||||
| 	clientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc) | 	clientPool := dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc) | ||||||
| 	podResource := map[schema.GroupVersionResource]struct{}{schema.GroupVersionResource{Version: "v1", Resource: "pods"}: {}} | 	podResource := map[schema.GroupVersionResource]struct{}{{Version: "v1", Resource: "pods"}: {}} | ||||||
| 	gc, err := NewGarbageCollector(metaOnlyClientPool, clientPool, api.Registry.RESTMapper(), podResource) | 	gc, err := NewGarbageCollector(metaOnlyClientPool, clientPool, api.Registry.RESTMapper(), podResource) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		t.Fatal(err) | 		t.Fatal(err) | ||||||
|   | |||||||
| @@ -208,15 +208,15 @@ func (gb *GraphBuilder) Run(stopCh <-chan struct{}) { | |||||||
| } | } | ||||||
|  |  | ||||||
| var ignoredResources = map[schema.GroupVersionResource]struct{}{ | var ignoredResources = map[schema.GroupVersionResource]struct{}{ | ||||||
| 	schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "replicationcontrollers"}:              {}, | 	{Group: "extensions", Version: "v1beta1", Resource: "replicationcontrollers"}:              {}, | ||||||
| 	schema.GroupVersionResource{Group: "", Version: "v1", Resource: "bindings"}:                                           {}, | 	{Group: "", Version: "v1", Resource: "bindings"}:                                           {}, | ||||||
| 	schema.GroupVersionResource{Group: "", Version: "v1", Resource: "componentstatuses"}:                                  {}, | 	{Group: "", Version: "v1", Resource: "componentstatuses"}:                                  {}, | ||||||
| 	schema.GroupVersionResource{Group: "", Version: "v1", Resource: "events"}:                                             {}, | 	{Group: "", Version: "v1", Resource: "events"}:                                             {}, | ||||||
| 	schema.GroupVersionResource{Group: "authentication.k8s.io", Version: "v1beta1", Resource: "tokenreviews"}:             {}, | 	{Group: "authentication.k8s.io", Version: "v1beta1", Resource: "tokenreviews"}:             {}, | ||||||
| 	schema.GroupVersionResource{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "subjectaccessreviews"}:      {}, | 	{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "subjectaccessreviews"}:      {}, | ||||||
| 	schema.GroupVersionResource{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "selfsubjectaccessreviews"}:  {}, | 	{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "selfsubjectaccessreviews"}:  {}, | ||||||
| 	schema.GroupVersionResource{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "localsubjectaccessreviews"}: {}, | 	{Group: "authorization.k8s.io", Version: "v1beta1", Resource: "localsubjectaccessreviews"}: {}, | ||||||
| 	schema.GroupVersionResource{Group: "apiregistration.k8s.io", Version: "v1alpha1", Resource: "apiservices"}:            {}, | 	{Group: "apiregistration.k8s.io", Version: "v1alpha1", Resource: "apiservices"}:            {}, | ||||||
| } | } | ||||||
|  |  | ||||||
| func (gb *GraphBuilder) enqueueChanges(e *event) { | func (gb *GraphBuilder) enqueueChanges(e *event) { | ||||||
|   | |||||||
| @@ -206,9 +206,9 @@ func TestOpenPodHostports(t *testing.T) { | |||||||
|  |  | ||||||
| 	// Socket | 	// Socket | ||||||
| 	hostPortMap := map[hostport]closeable{ | 	hostPortMap := map[hostport]closeable{ | ||||||
| 		hostport{123, "tcp"}:  &fakeSocket{123, "tcp", false}, | 		{123, "tcp"}:  &fakeSocket{123, "tcp", false}, | ||||||
| 		hostport{4567, "tcp"}: &fakeSocket{4567, "tcp", false}, | 		{4567, "tcp"}: &fakeSocket{4567, "tcp", false}, | ||||||
| 		hostport{5678, "udp"}: &fakeSocket{5678, "udp", false}, | 		{5678, "udp"}: &fakeSocket{5678, "udp", false}, | ||||||
| 	} | 	} | ||||||
| 	if !reflect.DeepEqual(hostPortMap, h.hostPortMap) { | 	if !reflect.DeepEqual(hostPortMap, h.hostPortMap) { | ||||||
| 		t.Fatalf("Mismatch in expected hostPortMap. Expected '%v', got '%v'", hostPortMap, h.hostPortMap) | 		t.Fatalf("Mismatch in expected hostPortMap. Expected '%v', got '%v'", hostPortMap, h.hostPortMap) | ||||||
|   | |||||||
| @@ -249,11 +249,11 @@ func TestUpdatePodStatus(t *testing.T) { | |||||||
|  |  | ||||||
| 	// Setup probe "workers" and cached results. | 	// Setup probe "workers" and cached results. | ||||||
| 	m.workers = map[probeKey]*worker{ | 	m.workers = map[probeKey]*worker{ | ||||||
| 		probeKey{testPodUID, unprobed.Name, liveness}:       {}, | 		{testPodUID, unprobed.Name, liveness}:       {}, | ||||||
| 		probeKey{testPodUID, probedReady.Name, readiness}:   {}, | 		{testPodUID, probedReady.Name, readiness}:   {}, | ||||||
| 		probeKey{testPodUID, probedPending.Name, readiness}: {}, | 		{testPodUID, probedPending.Name, readiness}: {}, | ||||||
| 		probeKey{testPodUID, probedUnready.Name, readiness}: {}, | 		{testPodUID, probedUnready.Name, readiness}: {}, | ||||||
| 		probeKey{testPodUID, terminated.Name, readiness}:    {}, | 		{testPodUID, terminated.Name, readiness}:    {}, | ||||||
| 	} | 	} | ||||||
| 	m.readinessManager.Set(kubecontainer.ParseContainerID(probedReady.ContainerID), results.Success, &v1.Pod{}) | 	m.readinessManager.Set(kubecontainer.ParseContainerID(probedReady.ContainerID), results.Success, &v1.Pod{}) | ||||||
| 	m.readinessManager.Set(kubecontainer.ParseContainerID(probedUnready.ContainerID), results.Failure, &v1.Pod{}) | 	m.readinessManager.Set(kubecontainer.ParseContainerID(probedUnready.ContainerID), results.Failure, &v1.Pod{}) | ||||||
| @@ -262,11 +262,11 @@ func TestUpdatePodStatus(t *testing.T) { | |||||||
| 	m.UpdatePodStatus(testPodUID, &podStatus) | 	m.UpdatePodStatus(testPodUID, &podStatus) | ||||||
|  |  | ||||||
| 	expectedReadiness := map[probeKey]bool{ | 	expectedReadiness := map[probeKey]bool{ | ||||||
| 		probeKey{testPodUID, unprobed.Name, readiness}:      true, | 		{testPodUID, unprobed.Name, readiness}:      true, | ||||||
| 		probeKey{testPodUID, probedReady.Name, readiness}:   true, | 		{testPodUID, probedReady.Name, readiness}:   true, | ||||||
| 		probeKey{testPodUID, probedPending.Name, readiness}: false, | 		{testPodUID, probedPending.Name, readiness}: false, | ||||||
| 		probeKey{testPodUID, probedUnready.Name, readiness}: false, | 		{testPodUID, probedUnready.Name, readiness}: false, | ||||||
| 		probeKey{testPodUID, terminated.Name, readiness}:    false, | 		{testPodUID, terminated.Name, readiness}:    false, | ||||||
| 	} | 	} | ||||||
| 	for _, c := range podStatus.ContainerStatuses { | 	for _, c := range podStatus.ContainerStatuses { | ||||||
| 		expected, ok := expectedReadiness[probeKey{testPodUID, c.Name, readiness}] | 		expected, ok := expectedReadiness[probeKey{testPodUID, c.Name, readiness}] | ||||||
|   | |||||||
| @@ -56,10 +56,10 @@ func TestDeepHashObject(t *testing.T) { | |||||||
| 		func() interface{} { | 		func() interface{} { | ||||||
| 			return B{[]int{8, 6, 7}, map[string]bool{"5": true, "3": true, "0": true, "9": true}} | 			return B{[]int{8, 6, 7}, map[string]bool{"5": true, "3": true, "0": true, "9": true}} | ||||||
| 		}, | 		}, | ||||||
| 		func() interface{} { return map[A]bool{A{8675309, "Jenny"}: true, A{9765683, "!Jenny"}: false} }, | 		func() interface{} { return map[A]bool{{8675309, "Jenny"}: true, {9765683, "!Jenny"}: false} }, | ||||||
| 		func() interface{} { return map[C]bool{C{8675309, "Jenny"}: true, C{9765683, "!Jenny"}: false} }, | 		func() interface{} { return map[C]bool{{8675309, "Jenny"}: true, {9765683, "!Jenny"}: false} }, | ||||||
| 		func() interface{} { return map[*A]bool{&A{8675309, "Jenny"}: true, &A{9765683, "!Jenny"}: false} }, | 		func() interface{} { return map[*A]bool{{8675309, "Jenny"}: true, {9765683, "!Jenny"}: false} }, | ||||||
| 		func() interface{} { return map[*C]bool{&C{8675309, "Jenny"}: true, &C{9765683, "!Jenny"}: false} }, | 		func() interface{} { return map[*C]bool{{8675309, "Jenny"}: true, {9765683, "!Jenny"}: false} }, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	for _, tc := range successCases { | 	for _, tc := range successCases { | ||||||
|   | |||||||
| @@ -182,14 +182,14 @@ func TestCanSupport(t *testing.T) { | |||||||
| 	assert.NoError(err) | 	assert.NoError(err) | ||||||
|  |  | ||||||
| 	specs := map[*volume.Spec]bool{ | 	specs := map[*volume.Spec]bool{ | ||||||
| 		&volume.Spec{ | 		{ | ||||||
| 			Volume: &v1.Volume{ | 			Volume: &v1.Volume{ | ||||||
| 				VolumeSource: v1.VolumeSource{ | 				VolumeSource: v1.VolumeSource{ | ||||||
| 					Flocker: &v1.FlockerVolumeSource{}, | 					Flocker: &v1.FlockerVolumeSource{}, | ||||||
| 				}, | 				}, | ||||||
| 			}, | 			}, | ||||||
| 		}: true, | 		}: true, | ||||||
| 		&volume.Spec{ | 		{ | ||||||
| 			PersistentVolume: &v1.PersistentVolume{ | 			PersistentVolume: &v1.PersistentVolume{ | ||||||
| 				Spec: v1.PersistentVolumeSpec{ | 				Spec: v1.PersistentVolumeSpec{ | ||||||
| 					PersistentVolumeSource: v1.PersistentVolumeSource{ | 					PersistentVolumeSource: v1.PersistentVolumeSource{ | ||||||
| @@ -198,7 +198,7 @@ func TestCanSupport(t *testing.T) { | |||||||
| 				}, | 				}, | ||||||
| 			}, | 			}, | ||||||
| 		}: true, | 		}: true, | ||||||
| 		&volume.Spec{ | 		{ | ||||||
| 			Volume: &v1.Volume{ | 			Volume: &v1.Volume{ | ||||||
| 				VolumeSource: v1.VolumeSource{}, | 				VolumeSource: v1.VolumeSource{}, | ||||||
| 			}, | 			}, | ||||||
|   | |||||||
| @@ -216,7 +216,7 @@ func (l *lifecycle) Validate() error { | |||||||
| // accessReviewResources are resources which give a view into permissions in a namespace.  Users must be allowed to create these | // accessReviewResources are resources which give a view into permissions in a namespace.  Users must be allowed to create these | ||||||
| // resources because returning "not found" errors allows someone to search for the "people I'm going to fire in 2017" namespace. | // resources because returning "not found" errors allows someone to search for the "people I'm going to fire in 2017" namespace. | ||||||
| var accessReviewResources = map[schema.GroupResource]bool{ | var accessReviewResources = map[schema.GroupResource]bool{ | ||||||
| 	schema.GroupResource{Group: "authorization.k8s.io", Resource: "localsubjectaccessreviews"}: true, | 	{Group: "authorization.k8s.io", Resource: "localsubjectaccessreviews"}: true, | ||||||
| } | } | ||||||
|  |  | ||||||
| func isAccessReview(a admission.Attributes) bool { | func isAccessReview(a admission.Attributes) bool { | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ const totalAnnotationSizeLimitB int = 256 * (1 << 10) // 256 kB | |||||||
|  |  | ||||||
| // BannedOwners is a black list of object that are not allowed to be owners. | // BannedOwners is a black list of object that are not allowed to be owners. | ||||||
| var BannedOwners = map[schema.GroupVersionKind]struct{}{ | var BannedOwners = map[schema.GroupVersionKind]struct{}{ | ||||||
| 	schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Event"}: {}, | 	{Group: "", Version: "v1", Kind: "Event"}: {}, | ||||||
| } | } | ||||||
|  |  | ||||||
| // ValidateClusterName can be used to check whether the given cluster name is valid. | // ValidateClusterName can be used to check whether the given cluster name is valid. | ||||||
|   | |||||||
| @@ -129,13 +129,13 @@ const AllResources = "*" | |||||||
| // specialDefaultResourcePrefixes are prefixes compiled into Kubernetes. | // specialDefaultResourcePrefixes are prefixes compiled into Kubernetes. | ||||||
| // TODO: move out of this package, it is not generic | // TODO: move out of this package, it is not generic | ||||||
| var specialDefaultResourcePrefixes = map[schema.GroupResource]string{ | var specialDefaultResourcePrefixes = map[schema.GroupResource]string{ | ||||||
| 	schema.GroupResource{Group: "", Resource: "replicationControllers"}:        "controllers", | 	{Group: "", Resource: "replicationControllers"}:        "controllers", | ||||||
| 	schema.GroupResource{Group: "", Resource: "replicationcontrollers"}:        "controllers", | 	{Group: "", Resource: "replicationcontrollers"}:        "controllers", | ||||||
| 	schema.GroupResource{Group: "", Resource: "endpoints"}:                     "services/endpoints", | 	{Group: "", Resource: "endpoints"}:                     "services/endpoints", | ||||||
| 	schema.GroupResource{Group: "", Resource: "nodes"}:                         "minions", | 	{Group: "", Resource: "nodes"}:                         "minions", | ||||||
| 	schema.GroupResource{Group: "", Resource: "services"}:                      "services/specs", | 	{Group: "", Resource: "services"}:                      "services/specs", | ||||||
| 	schema.GroupResource{Group: "extensions", Resource: "ingresses"}:           "ingress", | 	{Group: "extensions", Resource: "ingresses"}:           "ingress", | ||||||
| 	schema.GroupResource{Group: "extensions", Resource: "podsecuritypolicies"}: "podsecuritypolicy", | 	{Group: "extensions", Resource: "podsecuritypolicies"}: "podsecuritypolicy", | ||||||
| } | } | ||||||
|  |  | ||||||
| func NewDefaultStorageFactory(config storagebackend.Config, defaultMediaType string, defaultSerializer runtime.StorageSerializer, resourceEncodingConfig ResourceEncodingConfig, resourceConfig APIResourceConfigSource) *DefaultStorageFactory { | func NewDefaultStorageFactory(config storagebackend.Config, defaultMediaType string, defaultSerializer runtime.StorageSerializer, resourceEncodingConfig ResourceEncodingConfig, resourceConfig APIResourceConfigSource) *DefaultStorageFactory { | ||||||
|   | |||||||
| @@ -617,8 +617,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) { | |||||||
| 				w.Write(output) | 				w.Write(output) | ||||||
| 			}, | 			}, | ||||||
| 			expected: map[schema.GroupVersionResource]struct{}{ | 			expected: map[schema.GroupVersionResource]struct{}{ | ||||||
| 				schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}:     {}, | 				{Group: "", Version: "v1", Resource: "pods"}:     {}, | ||||||
| 				schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}: {}, | 				{Group: "", Version: "v1", Resource: "services"}: {}, | ||||||
| 			}, | 			}, | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| @@ -660,8 +660,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) { | |||||||
| 				w.Write(output) | 				w.Write(output) | ||||||
| 			}, | 			}, | ||||||
| 			expected: map[schema.GroupVersionResource]struct{}{ | 			expected: map[schema.GroupVersionResource]struct{}{ | ||||||
| 				schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"}:           {}, | 				{Group: "batch", Version: "v1", Resource: "jobs"}:           {}, | ||||||
| 				schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {}, | 				{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {}, | ||||||
| 			}, | 			}, | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| @@ -703,8 +703,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) { | |||||||
| 				w.Write(output) | 				w.Write(output) | ||||||
| 			}, | 			}, | ||||||
| 			expected: map[schema.GroupVersionResource]struct{}{ | 			expected: map[schema.GroupVersionResource]struct{}{ | ||||||
| 				schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "jobs"}:     {}, | 				{Group: "batch", Version: "v2alpha1", Resource: "jobs"}:     {}, | ||||||
| 				schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {}, | 				{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {}, | ||||||
| 			}, | 			}, | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -307,13 +307,13 @@ func TestUpdate(t *testing.T) { | |||||||
| 	// asynchronous, there are a lot of valid possibilities. | 	// asynchronous, there are a lot of valid possibilities. | ||||||
| 	type pair struct{ from, to string } | 	type pair struct{ from, to string } | ||||||
| 	allowedTransitions := map[pair]bool{ | 	allowedTransitions := map[pair]bool{ | ||||||
| 		pair{FROM, TO}: true, | 		{FROM, TO}: true, | ||||||
|  |  | ||||||
| 		// Because a resync can happen when we've already observed one | 		// Because a resync can happen when we've already observed one | ||||||
| 		// of the above but before the item is deleted. | 		// of the above but before the item is deleted. | ||||||
| 		pair{TO, TO}: true, | 		{TO, TO}: true, | ||||||
| 		// Because a resync could happen before we observe an update. | 		// Because a resync could happen before we observe an update. | ||||||
| 		pair{FROM, FROM}: true, | 		{FROM, FROM}: true, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	pod := func(name, check string, final bool) *v1.Pod { | 	pod := func(name, check string, final bool) *v1.Pod { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Submit Queue
					Kubernetes Submit Queue