mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #63133 from hzxuzhonghu/remove-always-admit
Automatic merge from submit-queue (batch tested with PRs 63186, 63133). 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>. eliminate alwaysAdmit admission in apiserver test **What this PR does / why we need it**: alwaysAdmit is of no meaning, previously if not specify an admission plugin, it will panic, but now since we add protection `if admit != nil`. So can safely remove it. **Release note**: ```release-note NONE ```
This commit is contained in:
commit
5fa25a9508
@ -71,18 +71,6 @@ import (
|
||||
"k8s.io/apiserver/pkg/server/filters"
|
||||
)
|
||||
|
||||
// alwaysAdmit is an implementation of admission.Interface which always says yes to an admit request.
|
||||
// It is useful in tests and when using kubernetes in an open manner.
|
||||
type alwaysAdmit struct{}
|
||||
|
||||
func (alwaysAdmit) Admit(a admission.Attributes) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (alwaysAdmit) Handles(operation admission.Operation) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type alwaysMutatingDeny struct{}
|
||||
|
||||
func (alwaysMutatingDeny) Admit(a admission.Attributes) (err error) {
|
||||
@ -233,7 +221,6 @@ func init() {
|
||||
|
||||
mapper = nsMapper
|
||||
namespaceMapper = nsMapper
|
||||
admissionControl = alwaysAdmit{}
|
||||
|
||||
scheme.AddFieldLabelConversionFunc(grouplessGroupVersion.String(), "Simple",
|
||||
func(label, value string) (string, string, error) {
|
||||
@ -263,11 +250,6 @@ func handle(storage map[string]rest.Storage) http.Handler {
|
||||
return handleInternal(storage, admissionControl, selfLinker, nil)
|
||||
}
|
||||
|
||||
// tests using the new namespace scope mechanism
|
||||
func handleNamespaced(storage map[string]rest.Storage) http.Handler {
|
||||
return handleInternal(storage, admissionControl, selfLinker, nil)
|
||||
}
|
||||
|
||||
// tests using a custom self linker
|
||||
func handleLinker(storage map[string]rest.Storage, selfLinker runtime.SelfLinker) http.Handler {
|
||||
return handleInternal(storage, admissionControl, selfLinker, nil)
|
||||
|
Loading…
Reference in New Issue
Block a user