mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-22 06:59:03 +00:00
add feature enablement options to recommendedoptions
This commit is contained in:
@@ -45,6 +45,7 @@ type ServerRunOptions struct {
|
||||
SecureServing *genericoptions.SecureServingOptions
|
||||
InsecureServing *genericoptions.ServingOptions
|
||||
Audit *genericoptions.AuditLogOptions
|
||||
Features *genericoptions.FeatureOptions
|
||||
Authentication *kubeoptions.BuiltInAuthenticationOptions
|
||||
Authorization *kubeoptions.BuiltInAuthorizationOptions
|
||||
CloudProvider *kubeoptions.CloudProviderOptions
|
||||
@@ -70,6 +71,7 @@ func NewServerRunOptions() *ServerRunOptions {
|
||||
SecureServing: genericoptions.NewSecureServingOptions(),
|
||||
InsecureServing: genericoptions.NewInsecureServingOptions(),
|
||||
Audit: genericoptions.NewAuditLogOptions(),
|
||||
Features: genericoptions.NewFeatureOptions(),
|
||||
Authentication: kubeoptions.NewBuiltInAuthenticationOptions().WithAll(),
|
||||
Authorization: kubeoptions.NewBuiltInAuthorizationOptions(),
|
||||
CloudProvider: kubeoptions.NewCloudProviderOptions(),
|
||||
@@ -106,6 +108,7 @@ func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
s.InsecureServing.AddFlags(fs)
|
||||
s.InsecureServing.AddDeprecatedFlags(fs)
|
||||
s.Audit.AddFlags(fs)
|
||||
s.Features.AddFlags(fs)
|
||||
s.Authentication.AddFlags(fs)
|
||||
s.Authorization.AddFlags(fs)
|
||||
s.CloudProvider.AddFlags(fs)
|
||||
|
@@ -28,7 +28,7 @@ func TestAddFlagsFlag(t *testing.T) {
|
||||
f := pflag.NewFlagSet("addflagstest", pflag.ContinueOnError)
|
||||
s := NewServerRunOptions()
|
||||
s.AddFlags(f)
|
||||
if s.GenericServerRunOptions.EnableSwaggerUI {
|
||||
if s.Features.EnableSwaggerUI {
|
||||
t.Errorf("Expected s.EnableSwaggerUI to be false by default")
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ func TestAddFlagsFlag(t *testing.T) {
|
||||
"--enable-swagger-ui=true",
|
||||
}
|
||||
f.Parse(args)
|
||||
if !s.GenericServerRunOptions.EnableSwaggerUI {
|
||||
if !s.Features.EnableSwaggerUI {
|
||||
t.Errorf("Expected s.EnableSwaggerUI to be true")
|
||||
}
|
||||
}
|
||||
|
@@ -123,6 +123,9 @@ func Run(s *options.ServerRunOptions) error {
|
||||
if err := s.Audit.ApplyTo(genericConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Features.ApplyTo(genericConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
capabilities.Initialize(capabilities.Capabilities{
|
||||
AllowPrivileged: s.AllowPrivileged,
|
||||
|
Reference in New Issue
Block a user