1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[CLI] Hidden arguments (#1082)

This commit is contained in:
Adam Janikowski 2022-08-09 12:38:55 +02:00 committed by GitHub
parent 616b96a792
commit b153b7183a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 28 additions and 5 deletions

View file

@ -186,7 +186,9 @@ func init() {
f.IntVar(&operatorKubernetesOptions.burst, "kubernetes.burst", kclient.DefaultBurst, "Burst for the k8s API")
f.BoolVar(&crdOptions.install, "crd.install", true, "Install missing CRD if access is possible")
f.IntVar(&operatorBackup.concurrentUploads, "backup-concurrent-uploads", globals.DefaultBackupConcurrentUploads, "Number of concurrent uploads per deployment")
features.Init(&cmdMain)
if err := features.Init(&cmdMain); err != nil {
panic(err.Error())
}
}
func Execute() int {

View file

@ -30,6 +30,7 @@ var encryptionRotation = &feature{
version: "3.7.0",
enterpriseRequired: true,
enabledByDefault: false,
hidden: true,
}
func EncryptionRotation() Feature {

View file

@ -33,6 +33,7 @@ type Feature interface {
Enabled() bool
EnabledPointer() *bool
Deprecated() (bool, string)
Hidden() bool
Supported(v driver.Version, enterprise bool) bool
}
@ -42,6 +43,11 @@ type feature struct {
enterpriseRequired, enabledByDefault, enabled bool
deprecated string
constValue *bool
hidden bool
}
func (f feature) Hidden() bool {
return f.hidden
}
func (f feature) Supported(v driver.Version, enterprise bool) bool {

View file

@ -30,6 +30,7 @@ var gracefulShutdown = &feature{
version: "3.6.0",
enterpriseRequired: false,
enabledByDefault: true,
hidden: true,
}
func GracefulShutdown() Feature {

View file

@ -30,6 +30,7 @@ var jwtRotation = &feature{
version: "3.7.0",
enterpriseRequired: true,
enabledByDefault: true,
hidden: true,
}
func JWTRotation() Feature {

View file

@ -54,7 +54,7 @@ var internalCMD = &cobra.Command{
Run: cmdRun,
}
func Init(cmd *cobra.Command) {
func Init(cmd *cobra.Command) error {
featuresLock.Lock()
defer featuresLock.Unlock()
@ -80,12 +80,21 @@ func Init(cmd *cobra.Command) {
}
featureName := fmt.Sprintf("deployment.feature.%s", feature.Name())
f.BoolVar(feature.EnabledPointer(), featureName, feature.EnabledByDefault(), z)
if ok, reason := feature.Deprecated(); ok {
f.MarkDeprecated(featureName, reason)
if err := f.MarkDeprecated(featureName, reason); err != nil {
return err
}
}
f.BoolVar(feature.EnabledPointer(), featureName, feature.EnabledByDefault(), z)
if feature.Hidden() {
if err := f.MarkHidden(featureName); err != nil {
return err
}
}
}
return nil
}
func cmdRun(_ *cobra.Command, _ []string) {

View file

@ -30,6 +30,7 @@ var maintenance = &feature{
version: "3.6.0",
enterpriseRequired: false,
enabledByDefault: true,
hidden: true,
}
func Maintenance() Feature {

View file

@ -36,6 +36,7 @@ var metricsExporter = &feature{
enabledByDefault: true,
deprecated: "It is always set to True",
constValue: util.NewBool(true),
hidden: true,
}
// deprecated

View file

@ -31,6 +31,7 @@ var tlsRotation Feature = &feature{
version: "3.7.0",
enterpriseRequired: true,
enabledByDefault: true,
hidden: true,
}
func TLSRotation() Feature {

View file

@ -34,7 +34,7 @@ type Timezone struct {
}
func (t Timezone) GetData() ([]byte, bool) {
if d, ok := timezonesData[t.Name]; ok {
if d, ok := timezonesData[t.Parent]; ok {
if d, err := base64.StdEncoding.DecodeString(d); err == nil {
return d, true
}