File tree Expand file tree Collapse file tree 2 files changed +6
-64
lines changed Expand file tree Collapse file tree 2 files changed +6
-64
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,13 @@ package internal
19
19
import (
20
20
"context"
21
21
"errors"
22
+ "fmt"
22
23
"os"
23
24
"path/filepath"
24
25
"time"
25
26
26
27
"github.com/fsnotify/fsnotify"
28
+ "github.com/prometheus/common/version"
27
29
"github.com/spf13/viper"
28
30
"gopkg.in/yaml.v3"
29
31
"k8s.io/klog/v2"
@@ -34,6 +36,10 @@ import (
34
36
35
37
// RunKubeStateMetricsWrapper is a wrapper around KSM, delegated to the root command.
36
38
func RunKubeStateMetricsWrapper (opts * options.Options ) {
39
+ if opts .Version {
40
+ fmt .Printf ("%s\n " , version .Print ("kube-state-metrics" ))
41
+ klog .FlushAndExit (klog .ExitFlushTimeout , 0 )
42
+ }
37
43
38
44
KSMRunOrDie := func (ctx context.Context ) {
39
45
if err := app .RunKubeStateMetricsWrapper (ctx , opts ); err != nil {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments