mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
Surface error loading admission plugin config
This commit is contained in:
parent
b7100f1ee7
commit
ed53e8a25c
@ -95,6 +95,18 @@ func ReadAdmissionConfiguration(pluginNames []string, configFilePath string, con
|
|||||||
if !(runtime.IsMissingVersion(err) || runtime.IsMissingKind(err) || runtime.IsNotRegisteredError(err)) {
|
if !(runtime.IsMissingVersion(err) || runtime.IsMissingKind(err) || runtime.IsNotRegisteredError(err)) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only tolerate load errors if the file appears to be one of the two legacy plugin configs
|
||||||
|
unstructuredData := map[string]interface{}{}
|
||||||
|
if err2 := yaml.Unmarshal(data, &unstructuredData); err2 != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, isLegacyImagePolicy := unstructuredData["imagePolicy"]
|
||||||
|
_, isLegacyPodNodeSelector := unstructuredData["podNodeSelectorPluginConfig"]
|
||||||
|
if !isLegacyImagePolicy && !isLegacyPodNodeSelector {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// convert the legacy format to the new admission control format
|
// convert the legacy format to the new admission control format
|
||||||
// in order to preserve backwards compatibility, we set plugins that
|
// in order to preserve backwards compatibility, we set plugins that
|
||||||
// previously read input from a non-versioned file configuration to the
|
// previously read input from a non-versioned file configuration to the
|
||||||
|
Loading…
Reference in New Issue
Block a user