|
|
|
@ -144,6 +144,11 @@ func CreateAggregatorConfig(commandOptions *options.Options, sharedConfig generi |
|
|
|
|
aggregatorConfig.ExtraConfig.ProxyClientKeyFile = commandOptions.KubeAggregatorOptions.ProxyClientKeyFile |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
customExtraConfig := &CustomExtraConfig{ |
|
|
|
|
DiscoveryOnlyProxyClientCertFile: commandOptions.KubeAggregatorOptions.ProxyClientCertFile, |
|
|
|
|
DiscoveryOnlyProxyClientKeyFile: commandOptions.KubeAggregatorOptions.ProxyClientKeyFile, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if err := commandOptions.KubeAggregatorOptions.ApplyTo(aggregatorConfig, commandOptions.RecommendedOptions.Etcd); err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
@ -156,7 +161,7 @@ func CreateAggregatorConfig(commandOptions *options.Options, sharedConfig generi |
|
|
|
|
|
|
|
|
|
// Exit early, if no remote services file is configured
|
|
|
|
|
if commandOptions.KubeAggregatorOptions.RemoteServicesFile == "" { |
|
|
|
|
return NewConfig(aggregatorConfig, sharedInformerFactory, []builder.APIGroupBuilder{serviceAPIBuilder}, nil), nil |
|
|
|
|
return NewConfig(aggregatorConfig, customExtraConfig, sharedInformerFactory, []builder.APIGroupBuilder{serviceAPIBuilder}, nil), nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
remoteServices, err := ReadRemoteServices(commandOptions.KubeAggregatorOptions.RemoteServicesFile) |
|
|
|
@ -176,9 +181,11 @@ func CreateAggregatorConfig(commandOptions *options.Options, sharedConfig generi |
|
|
|
|
serviceClientSet: serviceClient, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return NewConfig(aggregatorConfig, sharedInformerFactory, []builder.APIGroupBuilder{serviceAPIBuilder}, remoteServicesConfig), nil |
|
|
|
|
return NewConfig(aggregatorConfig, customExtraConfig, sharedInformerFactory, []builder.APIGroupBuilder{serviceAPIBuilder}, remoteServicesConfig), nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// CreateAggregatorServer creates an aggregated server to layer into the existing apiserver
|
|
|
|
|
// TODO: passing options temporarily as that allows us to pass in cert/key for client into AvailableController but skip it in the aggregator lib
|
|
|
|
|
func CreateAggregatorServer(config *Config, delegateAPIServer genericapiserver.DelegationTarget, reg prometheus.Registerer) (*aggregatorapiserver.APIAggregator, error) { |
|
|
|
|
aggregatorConfig := config.KubeAggregatorConfig |
|
|
|
|
sharedInformerFactory := config.Informers |
|
|
|
@ -257,8 +264,8 @@ func CreateAggregatorServer(config *Config, delegateAPIServer genericapiserver.D |
|
|
|
|
proxyCurrentCertKeyContentFunc := func() ([]byte, []byte) { |
|
|
|
|
return nil, nil |
|
|
|
|
} |
|
|
|
|
if len(config.KubeAggregatorConfig.ExtraConfig.ProxyClientCertFile) > 0 && len(config.KubeAggregatorConfig.ExtraConfig.ProxyClientKeyFile) > 0 { |
|
|
|
|
aggregatorProxyCerts, err := dynamiccertificates.NewDynamicServingContentFromFiles("aggregator-proxy-cert", config.KubeAggregatorConfig.ExtraConfig.ProxyClientCertFile, config.KubeAggregatorConfig.ExtraConfig.ProxyClientKeyFile) |
|
|
|
|
if len(config.CustomExtraConfig.DiscoveryOnlyProxyClientCertFile) > 0 && len(config.CustomExtraConfig.DiscoveryOnlyProxyClientKeyFile) > 0 { |
|
|
|
|
aggregatorProxyCerts, err := dynamiccertificates.NewDynamicServingContentFromFiles("aggregator-proxy-cert", config.CustomExtraConfig.DiscoveryOnlyProxyClientCertFile, config.CustomExtraConfig.DiscoveryOnlyProxyClientKeyFile) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|