mirror of https://github.com/k3s-io/k3s
Merge pull request #55379 from lichuqiang/admission_fix
Automatic merge from submit-queue (batch tested with PRs 54556, 55379, 55881, 55891, 55705). 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>. Ensure config file exists before loading configuration in imagePolicyWebhook **What this PR does / why we need it**: ensure config file exists before loading configuration in imagePolicyWebhook **Which issue(s) this PR fixes** Fixes #55378 **Release note**: ```release-note NONE ```pull/6/head
commit
5033548574
|
@ -219,6 +219,10 @@ func (a *Plugin) admitPod(pod *api.Pod, attributes admission.Attributes, review
|
|||
// For additional HTTP configuration, refer to the kubeconfig documentation
|
||||
// http://kubernetes.io/v1.1/docs/user-guide/kubeconfig-file.html.
|
||||
func NewImagePolicyWebhook(configFile io.Reader) (*Plugin, error) {
|
||||
if configFile == nil {
|
||||
return nil, fmt.Errorf("no config specified")
|
||||
}
|
||||
|
||||
// TODO: move this to a versioned configuration file format
|
||||
var config AdmissionConfig
|
||||
d := yaml.NewYAMLOrJSONDecoder(configFile, 4096)
|
||||
|
|
Loading…
Reference in New Issue