mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
add client-ca to configmap in kube-public
This commit is contained in:
@@ -22,6 +22,7 @@ package app
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -331,9 +332,26 @@ func Run(s *options.ServerRunOptions) error {
|
||||
return err
|
||||
}
|
||||
|
||||
clientCA, err := readCAorNil(s.Authentication.ClientCert.ClientCA)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
requestHeaderProxyCA, err := readCAorNil(s.Authentication.RequestHeader.ClientCAFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
config := &master.Config{
|
||||
GenericConfig: genericConfig,
|
||||
|
||||
ClientCARegistrationHook: master.ClientCARegistrationHook{
|
||||
ClientCA: clientCA,
|
||||
RequestHeaderUsernameHeaders: s.Authentication.RequestHeader.UsernameHeaders,
|
||||
RequestHeaderGroupHeaders: s.Authentication.RequestHeader.GroupHeaders,
|
||||
RequestHeaderExtraHeaderPrefixes: s.Authentication.RequestHeader.ExtraHeaderPrefixes,
|
||||
RequestHeaderCA: requestHeaderProxyCA,
|
||||
RequestHeaderAllowedNames: s.Authentication.RequestHeader.AllowedNames,
|
||||
},
|
||||
|
||||
APIResourceConfigSource: storageFactory.APIResourceConfigSource,
|
||||
StorageFactory: storageFactory,
|
||||
EnableCoreControllers: true,
|
||||
@@ -372,6 +390,13 @@ func Run(s *options.ServerRunOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func readCAorNil(file string) ([]byte, error) {
|
||||
if len(file) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return ioutil.ReadFile(file)
|
||||
}
|
||||
|
||||
// PostProcessSpec adds removed definitions for backward compatibility
|
||||
func postProcessOpenAPISpecForBackwardCompatibility(s *spec.Swagger) (*spec.Swagger, error) {
|
||||
compatibilityMap := map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user