Skip to content

Commit 7008409

Browse files
committed
batteries: show possible batteries in --help
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
1 parent dad4d67 commit 7008409

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

server/batteries/options.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ package batteries
1818

1919
import (
2020
"fmt"
21+
"strings"
2122

2223
"github.com/spf13/pflag"
2324

2425
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
26+
"k8s.io/apimachinery/pkg/util/sets"
2527
genericfeatures "k8s.io/apiserver/pkg/features"
2628
utilfeature "k8s.io/apiserver/pkg/util/feature"
2729
)
@@ -48,7 +50,11 @@ func (s *Options) AddFlags(fs *pflag.FlagSet) {
4850
return
4951
}
5052

51-
fs.StringSliceVar(&s.Enabled, "batteries", []string{}, "The batteries to enable in the generic control-plane server.")
53+
bats := sets.NewString()
54+
for b := range defaultBatteries {
55+
bats = bats.Insert(string(b))
56+
}
57+
fs.StringSliceVar(&s.Enabled, "batteries", []string{}, "The batteries to enable in the generic control-plane server. Possible values: "+strings.Join(bats.List(), ", "))
5258
}
5359

5460
// Complete defaults fields that have not set by the consumer of this package.

server/cmd/server.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ APIs.`,
164164

165165
setPartialUsageAndHelpFunc(cmdStart, namedFlagSets, cols, []string{
166166
"etcd-servers",
167+
"batteries",
167168
})
168169

169170
help.FitTerminal(cmdStart.OutOrStdout())
@@ -295,13 +296,3 @@ func createServerChain(config options.CompletedConfig) (*aggregatorapiserver.API
295296

296297
return aggregatorServer, nil
297298
}
298-
299-
type ControlPlaneBattery string
300-
301-
const (
302-
ControlPlaneBatteryCore ControlPlaneBattery = "core"
303-
ControlPlaneBatteryFlowControl ControlPlaneBattery = "flowcontrol"
304-
ControlPlaneBatteryRBAC ControlPlaneBattery = "rbac"
305-
ControlPlaneBatteryAdmission ControlPlaneBattery = "admission"
306-
ControlPlaneBatteryLease ControlPlaneBattery = "lease"
307-
)

0 commit comments

Comments
 (0)