mirror of https://github.com/k3s-io/k3s
ensure config file exists before loading configuration in imagePolicyWebhook
parent
ab44ec9d77
commit
f77e154dbb
|
@ -219,6 +219,10 @@ func (a *Plugin) admitPod(pod *api.Pod, attributes admission.Attributes, review
|
||||||
// For additional HTTP configuration, refer to the kubeconfig documentation
|
// For additional HTTP configuration, refer to the kubeconfig documentation
|
||||||
// http://kubernetes.io/v1.1/docs/user-guide/kubeconfig-file.html.
|
// http://kubernetes.io/v1.1/docs/user-guide/kubeconfig-file.html.
|
||||||
func NewImagePolicyWebhook(configFile io.Reader) (*Plugin, error) {
|
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
|
// TODO: move this to a versioned configuration file format
|
||||||
var config AdmissionConfig
|
var config AdmissionConfig
|
||||||
d := yaml.NewYAMLOrJSONDecoder(configFile, 4096)
|
d := yaml.NewYAMLOrJSONDecoder(configFile, 4096)
|
||||||
|
|
Loading…
Reference in New Issue