mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
call genericapiserver directly instead of going via master in federated-apiserver
This commit is contained in:
parent
de3ce4f465
commit
c3b124d550
@ -42,7 +42,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/client/restclient"
|
"k8s.io/kubernetes/pkg/client/restclient"
|
||||||
"k8s.io/kubernetes/pkg/cloudprovider"
|
"k8s.io/kubernetes/pkg/cloudprovider"
|
||||||
"k8s.io/kubernetes/pkg/genericapiserver"
|
"k8s.io/kubernetes/pkg/genericapiserver"
|
||||||
kubeletclient "k8s.io/kubernetes/pkg/kubelet/client"
|
|
||||||
"k8s.io/kubernetes/pkg/master"
|
"k8s.io/kubernetes/pkg/master"
|
||||||
"k8s.io/kubernetes/pkg/registry/cachesize"
|
"k8s.io/kubernetes/pkg/registry/cachesize"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -118,8 +117,6 @@ func Run(s *options.APIServer) error {
|
|||||||
glog.Fatalf("Cloud provider could not be initialized: %v", err)
|
glog.Fatalf("Cloud provider could not be initialized: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup tunneler if needed
|
|
||||||
var tunneler master.Tunneler
|
|
||||||
var proxyDialerFn apiserver.ProxyDialerFunc
|
var proxyDialerFn apiserver.ProxyDialerFunc
|
||||||
if len(s.SSHUser) > 0 {
|
if len(s.SSHUser) > 0 {
|
||||||
// Get ssh key distribution func, if supported
|
// Get ssh key distribution func, if supported
|
||||||
@ -140,7 +137,7 @@ func Run(s *options.APIServer) error {
|
|||||||
Host: net.JoinHostPort("127.0.0.1", strconv.FormatUint(uint64(s.KubeletConfig.Port), 10)),
|
Host: net.JoinHostPort("127.0.0.1", strconv.FormatUint(uint64(s.KubeletConfig.Port), 10)),
|
||||||
Path: "healthz",
|
Path: "healthz",
|
||||||
}
|
}
|
||||||
tunneler = master.NewSSHTunneler(s.SSHUser, s.SSHKeyfile, healthCheckPath, installSSH)
|
tunneler := master.NewSSHTunneler(s.SSHUser, s.SSHKeyfile, healthCheckPath, installSSH)
|
||||||
|
|
||||||
// Use the tunneler's dialer to connect to the kubelet
|
// Use the tunneler's dialer to connect to the kubelet
|
||||||
s.KubeletConfig.Dial = tunneler.Dial
|
s.KubeletConfig.Dial = tunneler.Dial
|
||||||
@ -151,11 +148,6 @@ func Run(s *options.APIServer) error {
|
|||||||
// Proxying to pods and services is IP-based... don't expect to be able to verify the hostname
|
// Proxying to pods and services is IP-based... don't expect to be able to verify the hostname
|
||||||
proxyTLSClientConfig := &tls.Config{InsecureSkipVerify: true}
|
proxyTLSClientConfig := &tls.Config{InsecureSkipVerify: true}
|
||||||
|
|
||||||
kubeletClient, err := kubeletclient.NewStaticKubeletClient(&s.KubeletConfig)
|
|
||||||
if err != nil {
|
|
||||||
glog.Fatalf("Failure to start kubelet client: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
apiResourceConfigSource, err := parseRuntimeConfig(s)
|
apiResourceConfigSource, err := parseRuntimeConfig(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("error in parsing runtime-config: %s", err)
|
glog.Fatalf("error in parsing runtime-config: %s", err)
|
||||||
@ -264,50 +256,42 @@ func Run(s *options.APIServer) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config := &master.Config{
|
config := &genericapiserver.Config{
|
||||||
Config: &genericapiserver.Config{
|
StorageFactory: storageFactory,
|
||||||
StorageFactory: storageFactory,
|
ServiceClusterIPRange: &n,
|
||||||
ServiceClusterIPRange: &n,
|
EnableLogsSupport: s.EnableLogsSupport,
|
||||||
EnableLogsSupport: s.EnableLogsSupport,
|
EnableUISupport: true,
|
||||||
EnableUISupport: true,
|
EnableSwaggerSupport: true,
|
||||||
EnableSwaggerSupport: true,
|
EnableSwaggerUI: s.EnableSwaggerUI,
|
||||||
EnableSwaggerUI: s.EnableSwaggerUI,
|
EnableProfiling: s.EnableProfiling,
|
||||||
EnableProfiling: s.EnableProfiling,
|
EnableWatchCache: s.EnableWatchCache,
|
||||||
EnableWatchCache: s.EnableWatchCache,
|
EnableIndex: true,
|
||||||
EnableIndex: true,
|
APIPrefix: s.APIPrefix,
|
||||||
APIPrefix: s.APIPrefix,
|
APIGroupPrefix: s.APIGroupPrefix,
|
||||||
APIGroupPrefix: s.APIGroupPrefix,
|
CorsAllowedOriginList: s.CorsAllowedOriginList,
|
||||||
CorsAllowedOriginList: s.CorsAllowedOriginList,
|
ReadWritePort: s.SecurePort,
|
||||||
ReadWritePort: s.SecurePort,
|
PublicAddress: s.AdvertiseAddress,
|
||||||
PublicAddress: s.AdvertiseAddress,
|
Authenticator: authenticator,
|
||||||
Authenticator: authenticator,
|
SupportsBasicAuth: len(s.BasicAuthFile) > 0,
|
||||||
SupportsBasicAuth: len(s.BasicAuthFile) > 0,
|
Authorizer: authorizer,
|
||||||
Authorizer: authorizer,
|
AdmissionControl: admissionController,
|
||||||
AdmissionControl: admissionController,
|
APIResourceConfigSource: apiResourceConfigSource,
|
||||||
APIResourceConfigSource: apiResourceConfigSource,
|
MasterServiceNamespace: s.MasterServiceNamespace,
|
||||||
MasterServiceNamespace: s.MasterServiceNamespace,
|
MasterCount: s.MasterCount,
|
||||||
MasterCount: s.MasterCount,
|
ExternalHost: s.ExternalHost,
|
||||||
ExternalHost: s.ExternalHost,
|
MinRequestTimeout: s.MinRequestTimeout,
|
||||||
MinRequestTimeout: s.MinRequestTimeout,
|
ProxyDialer: proxyDialerFn,
|
||||||
ProxyDialer: proxyDialerFn,
|
ProxyTLSClientConfig: proxyTLSClientConfig,
|
||||||
ProxyTLSClientConfig: proxyTLSClientConfig,
|
ServiceNodePortRange: s.ServiceNodePortRange,
|
||||||
ServiceNodePortRange: s.ServiceNodePortRange,
|
KubernetesServiceNodePort: s.KubernetesServiceNodePort,
|
||||||
KubernetesServiceNodePort: s.KubernetesServiceNodePort,
|
Serializer: api.Codecs,
|
||||||
Serializer: api.Codecs,
|
|
||||||
},
|
|
||||||
EnableCoreControllers: true,
|
|
||||||
DeleteCollectionWorkers: s.DeleteCollectionWorkers,
|
|
||||||
EventTTL: s.EventTTL,
|
|
||||||
KubeletClient: kubeletClient,
|
|
||||||
|
|
||||||
Tunneler: tunneler,
|
|
||||||
}
|
}
|
||||||
|
// TODO: Move this to generic api server (Need to move the command line flag).
|
||||||
if s.EnableWatchCache {
|
if s.EnableWatchCache {
|
||||||
cachesize.SetWatchCacheSizes(s.WatchCacheSizes)
|
cachesize.SetWatchCacheSizes(s.WatchCacheSizes)
|
||||||
}
|
}
|
||||||
|
|
||||||
m, err := master.New(config)
|
m, err := genericapiserver.New(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user