Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit e6b775c

Browse files
committed
Only error when dynamic auditing flag is set to true
Signed-off-by: JoshVanL <[email protected]>
1 parent de619d8 commit e6b775c

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

cmd/app/options/audit.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
package options
33

44
import (
5-
"github.com/spf13/cobra"
65
"github.com/spf13/pflag"
76
apiserveroptions "k8s.io/apiserver/pkg/server/options"
87
cliflag "k8s.io/component-base/cli/flag"
@@ -24,11 +23,3 @@ func (a *AuditOptions) AddFlags(fs *pflag.FlagSet) *AuditOptions {
2423
a.AuditOptions.AddFlags(fs)
2524
return a
2625
}
27-
28-
func (a *AuditOptions) DynamicConfigurationFlagChanged(cmd *cobra.Command) bool {
29-
if ff := cmd.Flag("audit-dynamic-configuration"); ff != nil && ff.Changed {
30-
return true
31-
}
32-
33-
return false
34-
}

cmd/app/options/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (o *Options) Validate(cmd *cobra.Command) error {
9191
errs = append(errs, errors.New("cannot add extra user headers when impersonation disabled"))
9292
}
9393

94-
if o.Audit.DynamicConfigurationFlagChanged(cmd) {
94+
if o.Audit.DynamicOptions.Enabled {
9595
errs = append(errs, errors.New("The flag --audit-dynamic-configuration may not be set"))
9696
}
9797

0 commit comments

Comments
 (0)