1
0
Fork 0
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:
Adam Janikowski 2023-05-24 14:23:10 +02:00 committed by GitHub
parent 105b6bf115
commit fcc86c59c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 2 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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.

View file

@ -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