Skip to content

Commit

Permalink
Version 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
STARRY-S committed Jan 7, 2025
1 parent f8220b1 commit a63b29e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ builds:
ldflags:
- -extldflags -static
- -s -w
- -X main.Version={{.Env.TAG}}
- -X github.com/k8snetworkplumbingwg/k8s-net-attach-def-controller/pkg/utils.COMMIT={{.Env.COMMIT}}
- -X github.com/k8snetworkplumbingwg/k8s-net-attach-def-controller/pkg/utils.VERSION={{.Env.TAG}}
main: ./main.go
id: k8s-net-attach-def-controller
binary: k8s-net-attach-def-controller
Expand Down
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
"time"

discoveryclient "k8s.io/client-go/discovery"
Expand All @@ -16,6 +17,7 @@ import (

"github.com/k8snetworkplumbingwg/k8s-net-attach-def-controller/pkg/controller"
"github.com/k8snetworkplumbingwg/k8s-net-attach-def-controller/pkg/signals"
"github.com/k8snetworkplumbingwg/k8s-net-attach-def-controller/pkg/utils"
)

var (
Expand All @@ -27,6 +29,8 @@ var (

// default workers of this controller
defaultWorkers = 3

version bool
)

func main() {
Expand All @@ -35,10 +39,16 @@ func main() {

flag.StringVar(&master, "master", "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Required if out-of-cluster.")
flag.StringVar(&kubeconfig, "kubeconfig", "", "Path to a kubeconfig. Required if out-of-cluster.")
flag.BoolVar(&version, "version", false, "Show version")

// parse custom and klog/v2 flags
flag.Parse()

if version {
fmt.Printf("Version %v - %v\n", utils.VERSION, utils.COMMIT)
return
}

// make sure we flush before exiting
defer klog.Flush()

Expand Down
6 changes: 6 additions & 0 deletions pkg/utils/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package utils

var (
VERSION = "v0.6.0"
COMMIT = "head"
)

0 comments on commit a63b29e

Please sign in to comment.