add method to disable features internally
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
This commit is contained in:
parent
90ec1e230c
commit
7501e8622c
|
@ -65,3 +65,11 @@ func FeatureGates() map[string]bool {
|
|||
func Enabled(feature string) (bool, error) {
|
||||
return feathelper.Enabled(feature)
|
||||
}
|
||||
|
||||
// Disable disables the specified feature. If the feature is not
|
||||
// present, it's a no-op
|
||||
func Disable(feature string) {
|
||||
if _, ok := features[feature]; ok {
|
||||
features[feature] = false
|
||||
}
|
||||
}
|
||||
|
|
7
main.go
7
main.go
|
@ -314,11 +314,10 @@ func main() {
|
|||
managed.InitManagedTransport(ctrl.Log.WithName("managed-transport"))
|
||||
} else {
|
||||
if optimize, _ := feathelper.Enabled(features.OptimizedGitClones); optimize {
|
||||
setupLog.Error(
|
||||
fmt.Errorf("OptimizedGitClones=true but GitManagedTransport=false"),
|
||||
"git clones can only be optimized when using managed transort",
|
||||
features.Disable(features.OptimizedGitClones)
|
||||
setupLog.Info(
|
||||
"disabling optimzied git clones; git clones can only be optimized when using managed transort",
|
||||
)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue