Unverified Commit 4c8657c0 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #61003 from CaoShuFeng/amdission_controller_glog_v2

Automatic merge from submit-queue (batch tested with PRs 61003, 61031, 60360, 58349, 60922). 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>. log enabled admission controller in order This change log enabled mutating and validating admission controller in order. ref: https://github.com/kubernetes/kubernetes/pull/60838/files#r173295334 **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**: **Release note**: ```release-note NONE ```
parents 7a273aa8 76aaba6d
...@@ -127,6 +127,8 @@ func splitStream(config io.Reader) (io.Reader, io.Reader, error) { ...@@ -127,6 +127,8 @@ func splitStream(config io.Reader) (io.Reader, io.Reader, error) {
// the given plugins. // the given plugins.
func (ps *Plugins) NewFromPlugins(pluginNames []string, configProvider ConfigProvider, pluginInitializer PluginInitializer, decorator Decorator) (Interface, error) { func (ps *Plugins) NewFromPlugins(pluginNames []string, configProvider ConfigProvider, pluginInitializer PluginInitializer, decorator Decorator) (Interface, error) {
handlers := []Interface{} handlers := []Interface{}
mutationPlugins := []string{}
validationPlugins := []string{}
for _, pluginName := range pluginNames { for _, pluginName := range pluginNames {
pluginConfig, err := configProvider.ConfigFor(pluginName) pluginConfig, err := configProvider.ConfigFor(pluginName)
if err != nil { if err != nil {
...@@ -143,10 +145,20 @@ func (ps *Plugins) NewFromPlugins(pluginNames []string, configProvider ConfigPro ...@@ -143,10 +145,20 @@ func (ps *Plugins) NewFromPlugins(pluginNames []string, configProvider ConfigPro
} else { } else {
handlers = append(handlers, plugin) handlers = append(handlers, plugin)
} }
if _, ok := plugin.(MutationInterface); ok {
mutationPlugins = append(mutationPlugins, pluginName)
}
if _, ok := plugin.(ValidationInterface); ok {
validationPlugins = append(validationPlugins, pluginName)
}
} }
} }
if len(pluginNames) != 0 { if len(mutationPlugins) != 0 {
glog.Infof("Loaded %d admission controller(s) successfully in the following order: %s.", len(pluginNames), strings.Join(pluginNames, ",")) glog.Infof("Loaded %d mutating admission controller(s) successfully in the following order: %s.", len(mutationPlugins), strings.Join(mutationPlugins, ","))
}
if len(validationPlugins) != 0 {
glog.Infof("Loaded %d validating admission controller(s) successfully in the following order: %s.", len(validationPlugins), strings.Join(validationPlugins, ","))
} }
return chainAdmissionHandler(handlers), nil return chainAdmissionHandler(handlers), nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment