K8s: add a bool setting to select request header auth versus enterprise behavior (#100877)
This commit is contained in:
@@ -57,7 +57,8 @@ import (
|
||||
// making sure we only register metrics once into legacy registry
|
||||
var registerIntoLegacyRegistryOnce sync.Once
|
||||
|
||||
func readCABundlePEM(path string, devMode bool) ([]byte, error) {
|
||||
//nolint:unused
|
||||
func _readCABundlePEM(path string, devMode bool) ([]byte, error) {
|
||||
if devMode {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -128,8 +129,6 @@ func CreateAggregatorConfig(commandOptions *options.Options, sharedConfig generi
|
||||
},
|
||||
ExtraConfig: aggregatorapiserver.ExtraConfig{
|
||||
DisableRemoteAvailableConditionController: true,
|
||||
ProxyClientCertFile: commandOptions.KubeAggregatorOptions.ProxyClientCertFile,
|
||||
ProxyClientKeyFile: commandOptions.KubeAggregatorOptions.ProxyClientKeyFile,
|
||||
// NOTE: while ProxyTransport can be skipped in the configuration, it allows honoring
|
||||
// DISABLE_HTTP2, HTTPS_PROXY and NO_PROXY env vars as needed
|
||||
ProxyTransport: createProxyTransport(),
|
||||
@@ -137,6 +136,13 @@ func CreateAggregatorConfig(commandOptions *options.Options, sharedConfig generi
|
||||
},
|
||||
}
|
||||
|
||||
if commandOptions.KubeAggregatorOptions.LegacyClientCertAuth {
|
||||
// NOTE: the availability controller below is a bit different and uses the cert/key pair regardless
|
||||
// of the legacy bool, this is because we are still using that for discovery requests
|
||||
aggregatorConfig.ExtraConfig.ProxyClientCertFile = commandOptions.KubeAggregatorOptions.ProxyClientCertFile
|
||||
aggregatorConfig.ExtraConfig.ProxyClientKeyFile = commandOptions.KubeAggregatorOptions.ProxyClientKeyFile
|
||||
}
|
||||
|
||||
if err := commandOptions.KubeAggregatorOptions.ApplyTo(aggregatorConfig, commandOptions.RecommendedOptions.Etcd); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -152,10 +158,6 @@ func CreateAggregatorConfig(commandOptions *options.Options, sharedConfig generi
|
||||
return NewConfig(aggregatorConfig, sharedInformerFactory, []builder.APIGroupBuilder{serviceAPIBuilder}, nil), nil
|
||||
}
|
||||
|
||||
_, err = readCABundlePEM(commandOptions.KubeAggregatorOptions.APIServiceCABundleFile, commandOptions.ExtraOptions.DevMode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
remoteServices, err := ReadRemoteServices(commandOptions.KubeAggregatorOptions.RemoteServicesFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -23,6 +23,7 @@ type KubeAggregatorOptions struct {
|
||||
AlternateDNS []string
|
||||
ProxyClientCertFile string
|
||||
ProxyClientKeyFile string
|
||||
LegacyClientCertAuth bool
|
||||
RemoteServicesFile string
|
||||
APIServiceCABundleFile string
|
||||
}
|
||||
@@ -46,6 +47,9 @@ func (o *KubeAggregatorOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
|
||||
fs.StringVar(&o.ProxyClientKeyFile, "proxy-client-key-file", o.ProxyClientKeyFile,
|
||||
"path to proxy client key file")
|
||||
|
||||
fs.BoolVar(&o.LegacyClientCertAuth, "legacy_client_cert_auth", true,
|
||||
"whether to use legacy client cert auth")
|
||||
}
|
||||
|
||||
func (o *KubeAggregatorOptions) Validate() []error {
|
||||
|
||||
Reference in New Issue
Block a user