@@ -18,6 +18,7 @@ package main
18
18
19
19
import (
20
20
"flag"
21
+ "fmt"
21
22
"net/http"
22
23
"os"
23
24
"time"
@@ -33,6 +34,7 @@ import (
33
34
"github.com/operator-framework/operator-controller/internal/catalogmetadata/cache"
34
35
catalogclient "github.com/operator-framework/operator-controller/internal/catalogmetadata/client"
35
36
"github.com/operator-framework/operator-controller/internal/controllers"
37
+ "github.com/operator-framework/operator-controller/internal/version"
36
38
"github.com/operator-framework/operator-controller/pkg/features"
37
39
"github.com/operator-framework/operator-controller/pkg/scheme"
38
40
)
@@ -43,17 +45,19 @@ var (
43
45
44
46
func main () {
45
47
var (
46
- metricsAddr string
47
- enableLeaderElection bool
48
- probeAddr string
49
- cachePath string
48
+ metricsAddr string
49
+ enableLeaderElection bool
50
+ probeAddr string
51
+ cachePath string
52
+ operatorControllerVersion bool
50
53
)
51
54
flag .StringVar (& metricsAddr , "metrics-bind-address" , ":8080" , "The address the metric endpoint binds to." )
52
55
flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081" , "The address the probe endpoint binds to." )
53
56
flag .BoolVar (& enableLeaderElection , "leader-elect" , false ,
54
57
"Enable leader election for controller manager. " +
55
58
"Enabling this will ensure there is only one active controller manager." )
56
59
flag .StringVar (& cachePath , "cache-path" , "/var/cache" , "The local directory path used for filesystem based caching" )
60
+ flag .BoolVar (& operatorControllerVersion , "version" , false , "Prints operator-controller version information" )
57
61
opts := zap.Options {
58
62
Development : true ,
59
63
}
@@ -63,7 +67,13 @@ func main() {
63
67
features .OperatorControllerFeatureGate .AddFlag (pflag .CommandLine )
64
68
pflag .Parse ()
65
69
70
+ if operatorControllerVersion {
71
+ fmt .Println (version .String ())
72
+ os .Exit (0 )
73
+ }
74
+
66
75
ctrl .SetLogger (zap .New (zap .UseFlagOptions (& opts ), zap .StacktraceLevel (zapcore .DPanicLevel )))
76
+ setupLog .Info ("starting up the controller" , "version info" , version .String ())
67
77
68
78
mgr , err := ctrl .NewManager (ctrl .GetConfigOrDie (), ctrl.Options {
69
79
Scheme : scheme .Scheme ,
0 commit comments