Skip to content

Commit c6a7989

Browse files
committed
main.go: print version information
1 parent 5b14236 commit c6a7989

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package main
1919
import (
2020
"flag"
2121
"os"
22+
"runtime"
2223
"time"
2324

2425
"github.com/spf13/pflag"
@@ -32,12 +33,21 @@ import (
3233
"github.com/joelanford/helm-operator/pkg/manager"
3334
"github.com/joelanford/helm-operator/pkg/reconciler"
3435
"github.com/joelanford/helm-operator/pkg/watches"
36+
"github.com/joelanford/helm-operator/version"
3537
)
3638

3739
var (
3840
setupLog = ctrl.Log.WithName("setup")
3941
)
4042

43+
func printVersion() {
44+
setupLog.Info("version information",
45+
"go", runtime.Version(),
46+
"GOOS", runtime.GOOS,
47+
"GOARCH", runtime.GOARCH,
48+
"helm-operator", version.Version)
49+
}
50+
4151
func main() {
4252
var (
4353
metricsAddr string
@@ -84,6 +94,8 @@ func main() {
8494
zapl.StacktraceLevel(&sttLvl),
8595
))
8696

97+
printVersion()
98+
8799
// Deprecated: --max-workers flag does not align well with the name of the option it configures on the controller
88100
// (MaxConcurrentReconciles). Flag `--max-concurrent-reconciles` should be used instead.
89101
if pflag.Lookup("max-workers").Changed {

version/version.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2020 The Operator-SDK Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package version
18+
19+
const (
20+
Version = "0.0.0+git"
21+
)

0 commit comments

Comments
 (0)