Commit 04e793e6 authored by Dr. Stefan Schimanski's avatar Dr. Stefan Schimanski

apiserver: make InClusterConfig errs for delegated authn/z non-fatal

parent 059fce63
...@@ -364,9 +364,12 @@ func (s *DelegatingAuthenticationOptions) getClient() (kubernetes.Interface, err ...@@ -364,9 +364,12 @@ func (s *DelegatingAuthenticationOptions) getClient() (kubernetes.Interface, err
clientConfig, err = loader.ClientConfig() clientConfig, err = loader.ClientConfig()
} else { } else {
// without the remote kubeconfig file, try to use the in-cluster config. Most addon API servers will // without the remote kubeconfig file, try to use the in-cluster config. Most addon API servers will
// use this path // use this path. If it is optional, ignore errors.
clientConfig, err = rest.InClusterConfig() clientConfig, err = rest.InClusterConfig()
if err == rest.ErrNotInCluster && s.RemoteKubeConfigFileOptional { if err != nil && s.RemoteKubeConfigFileOptional {
if err != rest.ErrNotInCluster {
glog.Warningf("failed to read in-cluster kubeconfig for delegated authentication: %v", err)
}
return nil, nil return nil, nil
} }
} }
......
...@@ -151,9 +151,12 @@ func (s *DelegatingAuthorizationOptions) getClient() (kubernetes.Interface, erro ...@@ -151,9 +151,12 @@ func (s *DelegatingAuthorizationOptions) getClient() (kubernetes.Interface, erro
clientConfig, err = loader.ClientConfig() clientConfig, err = loader.ClientConfig()
} else { } else {
// without the remote kubeconfig file, try to use the in-cluster config. Most addon API servers will // without the remote kubeconfig file, try to use the in-cluster config. Most addon API servers will
// use this path // use this path. If it is optional, ignore errors.
clientConfig, err = rest.InClusterConfig() clientConfig, err = rest.InClusterConfig()
if err == rest.ErrNotInCluster && s.RemoteKubeConfigFileOptional { if err != nil && s.RemoteKubeConfigFileOptional {
if err != rest.ErrNotInCluster {
glog.Warningf("failed to read in-cluster kubeconfig for delegated authorization: %v", err)
}
return nil, nil return nil, 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