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