mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] Features startup logging (#1312)
This commit is contained in:
parent
105b6bf115
commit
fcc86c59c1
4 changed files with 30 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
- (Feature) PersistentVolume Inspector
|
||||
- (Bugfix) Discover Arango image during ID phase
|
||||
- (Feature) PV Unschedulable condition
|
||||
- (Feature) Features startup logging
|
||||
|
||||
## [1.2.27](https://github.com/arangodb/kube-arangodb/tree/1.2.27) (2023-04-27)
|
||||
- (Feature) Add InSync Cache
|
||||
|
|
|
@ -295,6 +295,11 @@ func executeMain(cmd *cobra.Command, args []string) {
|
|||
|
||||
logger.Info("nice to meet you")
|
||||
|
||||
// Print all enabled featured
|
||||
features.Iterate(func(name string, feature features.Feature) {
|
||||
logger.Info("Operator Feature %s (%s) is %s.", name, features.GetFeatureArgName(name), util.BoolSwitch(feature.Enabled(), "enabled", "disabled"))
|
||||
})
|
||||
|
||||
// Check operating mode
|
||||
if !operatorOptions.enableDeployment && !operatorOptions.enableDeploymentReplication && !operatorOptions.enableStorage &&
|
||||
!operatorOptions.enableBackup && !operatorOptions.enableApps && !operatorOptions.enableK2KClusterSync {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -59,6 +59,19 @@ var internalCMD = &cobra.Command{
|
|||
Run: cmdRun,
|
||||
}
|
||||
|
||||
// Iterator defines feature definition iterator
|
||||
type Iterator func(name string, feature Feature)
|
||||
|
||||
// Iterate allows to iterate over all registered functions
|
||||
func Iterate(iterator Iterator) {
|
||||
featuresLock.Lock()
|
||||
defer featuresLock.Unlock()
|
||||
|
||||
for name, feature := range features {
|
||||
iterator(name, feature)
|
||||
}
|
||||
}
|
||||
|
||||
// Init initializes all registered features.
|
||||
// If a feature is not provided via process's argument, then it is taken from environment variable
|
||||
// or from enabled by default setting.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -146,6 +146,15 @@ func UInt16OrDefault(input *uint16, defaultValue ...uint16) uint16 {
|
|||
return *input
|
||||
}
|
||||
|
||||
// BoolSwitch define bool switch for defined types - in case of true t T is returned, in case of false f T
|
||||
func BoolSwitch[T interface{}](s bool, t, f T) T {
|
||||
if s {
|
||||
return t
|
||||
}
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
// NewBool returns a reference to a bool with given value.
|
||||
func NewBool(input bool) *bool {
|
||||
return &input
|
||||
|
|
Loading…
Reference in a new issue