Make helm-operator check for updates
.. using checkpoint. As with fluxd, it just logs the
result. helm-operator also gains a `--version` flag while we're at it.
@@ -14,6 +14,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
+ "github.com/weaveworks/flux/checkpoint"
"github.com/weaveworks/flux/git"
clientset "github.com/weaveworks/flux/integrations/client/clientset/versioned"
ifinformers "github.com/weaveworks/flux/integrations/client/informers/externalversions"
@@ -31,6 +32,8 @@ var (
logger log.Logger
kubectl string
+ versionFlag *bool
+
kubeconfig *string
master *string
@@ -60,11 +63,14 @@ var (
)
const (
+ product = "weave-flux-helm"
defaultGitChartsPath = "charts"
ErrOperatorFailure = "Operator failure: %q"
)
+var version = "unversioned"
+
func init() {
// Flags processing
fs = pflag.NewFlagSet("default", pflag.ExitOnError)
@@ -76,6 +82,8 @@ func init() {
fs.PrintDefaults()
}
+ versionFlag = fs.Bool("version", false, "Print version and exit")
+
kubeconfig = fs.String("kubeconfig", "", "Path to a kubeconfig. Only required if out-of-cluster.")
master = fs.String("master", "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.")
@@ -104,6 +112,11 @@ func main() {
fs.Parse(os.Args)
+ if *versionFlag {
+ println(version)
+ os.Exit(0)
+ }
+
// LOGGING ------------------------------------------------------------------------------
{
logger = log.NewLogfmtLogger(os.Stderr)
@@ -222,6 +235,8 @@ func main() {
// Starts handling k8s events related to the given resource kind
go ifInformerFactory.Start(shutdown)
+ checkpoint.CheckForUpdates(product, version, nil, log.With(logger, "component", "checkpoint"))
+
if err = opr.Run(*queueWorkerCount, shutdown, shutdownWg); err != nil {
msg := fmt.Sprintf("Failure to run controller: %s", err.Error())
logger.Log("error", msg)
