mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	fix static check failures
This commit is contained in:
		@@ -4,7 +4,6 @@ cmd/kube-controller-manager/app
 | 
				
			|||||||
cmd/kube-proxy/app
 | 
					cmd/kube-proxy/app
 | 
				
			||||||
cmd/linkcheck
 | 
					cmd/linkcheck
 | 
				
			||||||
cmd/preferredimports
 | 
					cmd/preferredimports
 | 
				
			||||||
hack/make-rules/helpers/go2make/testdata/dir-with-gofiles
 | 
					 | 
				
			||||||
pkg/client/tests
 | 
					pkg/client/tests
 | 
				
			||||||
pkg/controller/daemon
 | 
					pkg/controller/daemon
 | 
				
			||||||
pkg/controller/deployment
 | 
					pkg/controller/deployment
 | 
				
			||||||
@@ -75,8 +74,6 @@ pkg/volume/util/fsquota/common
 | 
				
			|||||||
pkg/volume/util/operationexecutor
 | 
					pkg/volume/util/operationexecutor
 | 
				
			||||||
pkg/volume/util/subpath
 | 
					pkg/volume/util/subpath
 | 
				
			||||||
pkg/volume/vsphere_volume
 | 
					pkg/volume/vsphere_volume
 | 
				
			||||||
plugin/pkg/admission/imagepolicy
 | 
					 | 
				
			||||||
plugin/pkg/admission/podnodeselector
 | 
					 | 
				
			||||||
test/e2e/apimachinery
 | 
					test/e2e/apimachinery
 | 
				
			||||||
test/e2e/apps
 | 
					test/e2e/apps
 | 
				
			||||||
test/e2e/auth
 | 
					test/e2e/auth
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,5 +16,5 @@ limitations under the License.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package gofiles
 | 
					package gofiles
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func bar() {
 | 
					func Bar() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,5 +16,5 @@ limitations under the License.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package gofiles
 | 
					package gofiles
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func foo() {
 | 
					func Foo() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,10 +19,15 @@ package v1alpha1
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	apiv1 "k8s.io/api/core/v1"
 | 
						apiv1 "k8s.io/api/core/v1"
 | 
				
			||||||
	"k8s.io/api/scheduling/v1alpha1"
 | 
						"k8s.io/api/scheduling/v1alpha1"
 | 
				
			||||||
 | 
						runtime "k8s.io/apimachinery/pkg/runtime"
 | 
				
			||||||
	utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
						utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/features"
 | 
						"k8s.io/kubernetes/pkg/features"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func addDefaultingFuncs(scheme *runtime.Scheme) error {
 | 
				
			||||||
 | 
						return RegisterDefaults(scheme)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SetDefaults_PriorityClass sets additional defaults compared to its counterpart
 | 
					// SetDefaults_PriorityClass sets additional defaults compared to its counterpart
 | 
				
			||||||
// in extensions.
 | 
					// in extensions.
 | 
				
			||||||
func SetDefaults_PriorityClass(obj *v1alpha1.PriorityClass) {
 | 
					func SetDefaults_PriorityClass(obj *v1alpha1.PriorityClass) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,5 +42,5 @@ func init() {
 | 
				
			|||||||
	// We only register manually written functions here. The registration of the
 | 
						// We only register manually written functions here. The registration of the
 | 
				
			||||||
	// generated functions takes place in the generated files. The separation
 | 
						// generated functions takes place in the generated files. The separation
 | 
				
			||||||
	// makes the code compile even when the generated files are missing.
 | 
						// makes the code compile even when the generated files are missing.
 | 
				
			||||||
	localSchemeBuilder.Register(RegisterDefaults)
 | 
						localSchemeBuilder.Register(addDefaultingFuncs)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,10 +19,15 @@ package v1beta1
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	apiv1 "k8s.io/api/core/v1"
 | 
						apiv1 "k8s.io/api/core/v1"
 | 
				
			||||||
	"k8s.io/api/scheduling/v1beta1"
 | 
						"k8s.io/api/scheduling/v1beta1"
 | 
				
			||||||
 | 
						runtime "k8s.io/apimachinery/pkg/runtime"
 | 
				
			||||||
	utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
						utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/features"
 | 
						"k8s.io/kubernetes/pkg/features"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func addDefaultingFuncs(scheme *runtime.Scheme) error {
 | 
				
			||||||
 | 
						return RegisterDefaults(scheme)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SetDefaults_PriorityClass sets additional defaults compared to its counterpart
 | 
					// SetDefaults_PriorityClass sets additional defaults compared to its counterpart
 | 
				
			||||||
// in extensions.
 | 
					// in extensions.
 | 
				
			||||||
func SetDefaults_PriorityClass(obj *v1beta1.PriorityClass) {
 | 
					func SetDefaults_PriorityClass(obj *v1beta1.PriorityClass) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,5 +42,5 @@ func init() {
 | 
				
			|||||||
	// We only register manually written functions here. The registration of the
 | 
						// We only register manually written functions here. The registration of the
 | 
				
			||||||
	// generated functions takes place in the generated files. The separation
 | 
						// generated functions takes place in the generated files. The separation
 | 
				
			||||||
	// makes the code compile even when the generated files are missing.
 | 
						// makes the code compile even when the generated files are missing.
 | 
				
			||||||
	localSchemeBuilder.Register(RegisterDefaults)
 | 
						localSchemeBuilder.Register(addDefaultingFuncs)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,7 +84,6 @@ type Plugin struct {
 | 
				
			|||||||
	responseCache *cache.LRUExpireCache
 | 
						responseCache *cache.LRUExpireCache
 | 
				
			||||||
	allowTTL      time.Duration
 | 
						allowTTL      time.Duration
 | 
				
			||||||
	denyTTL       time.Duration
 | 
						denyTTL       time.Duration
 | 
				
			||||||
	retryBackoff  time.Duration
 | 
					 | 
				
			||||||
	defaultAllow  bool
 | 
						defaultAllow  bool
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -984,6 +984,7 @@ func TestReturnedAnnotationAdd(t *testing.T) {
 | 
				
			|||||||
		pod                 *api.Pod
 | 
							pod                 *api.Pod
 | 
				
			||||||
		verifierAnnotations map[string]string
 | 
							verifierAnnotations map[string]string
 | 
				
			||||||
		expectedAnnotations map[string]string
 | 
							expectedAnnotations map[string]string
 | 
				
			||||||
 | 
							wantErr             bool
 | 
				
			||||||
	}{
 | 
						}{
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			test: "Add valid response annotations",
 | 
								test: "Add valid response annotations",
 | 
				
			||||||
@@ -1029,6 +1030,7 @@ func TestReturnedAnnotationAdd(t *testing.T) {
 | 
				
			|||||||
			expectedAnnotations: map[string]string{
 | 
								expectedAnnotations: map[string]string{
 | 
				
			||||||
				"imagepolicywebhook.image-policy.k8s.io/foo-test": "false",
 | 
									"imagepolicywebhook.image-policy.k8s.io/foo-test": "false",
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
 | 
								wantErr: true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, tt := range tests {
 | 
						for _, tt := range tests {
 | 
				
			||||||
@@ -1058,6 +1060,14 @@ func TestReturnedAnnotationAdd(t *testing.T) {
 | 
				
			|||||||
			attr = &fakeAttributes{attr, annotations}
 | 
								attr = &fakeAttributes{attr, annotations}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			err = wh.Validate(context.TODO(), attr, nil)
 | 
								err = wh.Validate(context.TODO(), attr, nil)
 | 
				
			||||||
 | 
								if tt.wantErr {
 | 
				
			||||||
 | 
									if err == nil {
 | 
				
			||||||
 | 
										t.Errorf("%s: expected error making admission request: %v", tt.test, err)
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								} else if err != nil {
 | 
				
			||||||
 | 
									t.Errorf("%s: failed to admit: %v", tt.test, err)
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if !reflect.DeepEqual(annotations, tt.expectedAnnotations) {
 | 
								if !reflect.DeepEqual(annotations, tt.expectedAnnotations) {
 | 
				
			||||||
				t.Errorf("got audit annotations: %v; want: %v", annotations, tt.expectedAnnotations)
 | 
									t.Errorf("got audit annotations: %v; want: %v", annotations, tt.expectedAnnotations)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,8 @@ limitations under the License.
 | 
				
			|||||||
// This file was generated using openssl by the gencerts.sh script
 | 
					// This file was generated using openssl by the gencerts.sh script
 | 
				
			||||||
// and holds raw certificates for the imagepolicy webhook tests.
 | 
					// and holds raw certificates for the imagepolicy webhook tests.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//lint:file-ignore U1000 Ignore all unused code, it's generated
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package imagepolicy
 | 
					package imagepolicy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var caKey = []byte(`-----BEGIN RSA PRIVATE KEY-----
 | 
					var caKey = []byte(`-----BEGIN RSA PRIVATE KEY-----
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,6 +86,8 @@ limitations under the License.
 | 
				
			|||||||
// This file was generated using openssl by the gencerts.sh script
 | 
					// This file was generated using openssl by the gencerts.sh script
 | 
				
			||||||
// and holds raw certificates for the imagepolicy webhook tests.
 | 
					// and holds raw certificates for the imagepolicy webhook tests.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//lint:file-ignore U1000 Ignore all unused code, it's generated
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package imagepolicy
 | 
					package imagepolicy
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -232,13 +232,12 @@ func (p *Plugin) defaultGetNamespace(name string) (*corev1.Namespace, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (p *Plugin) getNodeSelectorMap(namespace *corev1.Namespace) (labels.Set, error) {
 | 
					func (p *Plugin) getNodeSelectorMap(namespace *corev1.Namespace) (labels.Set, error) {
 | 
				
			||||||
	selector := labels.Set{}
 | 
						selector := labels.Set{}
 | 
				
			||||||
	labelsMap := labels.Set{}
 | 
					 | 
				
			||||||
	var err error
 | 
						var err error
 | 
				
			||||||
	found := false
 | 
						found := false
 | 
				
			||||||
	if len(namespace.ObjectMeta.Annotations) > 0 {
 | 
						if len(namespace.ObjectMeta.Annotations) > 0 {
 | 
				
			||||||
		for _, annotation := range NamespaceNodeSelectors {
 | 
							for _, annotation := range NamespaceNodeSelectors {
 | 
				
			||||||
			if ns, ok := namespace.ObjectMeta.Annotations[annotation]; ok {
 | 
								if ns, ok := namespace.ObjectMeta.Annotations[annotation]; ok {
 | 
				
			||||||
				labelsMap, err = labels.ConvertSelectorToLabelsMap(ns)
 | 
									labelsMap, err := labels.ConvertSelectorToLabelsMap(ns)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					return labels.Set{}, err
 | 
										return labels.Set{}, err
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user