Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 26 additions & 10 deletions cmd/update-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"flag"
"fmt"
"os"
"strconv"

"github.com/coreos/pkg/flagutil"
"github.com/golang/glog"

"github.com/coreos/container-linux-update-operator/pkg/analytics"
"github.com/coreos/container-linux-update-operator/pkg/k8sutil"
"github.com/coreos/container-linux-update-operator/pkg/operator"
"github.com/coreos/container-linux-update-operator/pkg/version"
Expand All @@ -18,17 +18,18 @@ var (
beforeRebootAnnotations flagutil.StringSliceFlag
afterRebootAnnotations flagutil.StringSliceFlag
kubeconfig = flag.String("kubeconfig", "", "Path to a kubeconfig file. Default to the in-cluster config if not provided.")
analyticsEnabled = flag.Bool("analytics", true, "Send analytics to Google Analytics")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note, this will break people with -analytics=false set; it might be worth leaving the flag and printing a warning if it's set for a few releases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking a release note mentioning its removal in v0.4.0, but not opposed to leaving it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to call it out as a breaking change. I'm okay either way if it's called out correctly.

Since we don't currently have a process for that though, it might be better to err on the side of giving longer notice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

autoLabelContainerLinux = flag.Bool("auto-label-container-linux", false, "Auto-label Container Linux nodes with agent=true (convenience)")
printVersion = flag.Bool("version", false, "Print version and exit")
// deprecated
manageAgent = flag.Bool("manage-agent", false, "Manage the associated update-agent")
agentImageRepo = flag.String("agent-image-repo", "quay.io/coreos/container-linux-update-operator", "The image to use for the managed agent, without version tag")
analyticsEnabled optValue
manageAgent = flag.Bool("manage-agent", false, "Manage the associated update-agent")
agentImageRepo = flag.String("agent-image-repo", "quay.io/coreos/container-linux-update-operator", "The image to use for the managed agent, without version tag")
)

func main() {
flag.Var(&beforeRebootAnnotations, "before-reboot-annotations", "List of comma-separated Kubernetes node annotations that must be set to 'true' before a reboot is allowed")
flag.Var(&afterRebootAnnotations, "after-reboot-annotations", "List of comma-separated Kubernetes node annotations that must be set to 'true' before a node is marked schedulable and the operator lock is released")
flag.Var(&analyticsEnabled, "analytics", "Send analytics to Google Analytics")

flag.Set("logtostderr", "true")
flag.Parse()
Expand All @@ -37,6 +38,10 @@ func main() {
glog.Fatalf("Failed to parse environment variables: %v", err)
}

if analyticsEnabled.present {
glog.Warning("Use of -analytics is deprecated and will be removed. Google Analytics will not be enabled.")
}

// respect KUBECONFIG without the prefix as well
if *kubeconfig == "" {
*kubeconfig = os.Getenv("KUBECONFIG")
Expand All @@ -47,10 +52,6 @@ func main() {
os.Exit(0)
}

if *analyticsEnabled {
analytics.Enable()
}

if *manageAgent {
glog.Warning("Use of -manage-agent=true is deprecated and will be removed in the future")
}
Expand All @@ -76,8 +77,6 @@ func main() {

glog.Infof("%s running", os.Args[0])

analytics.ControllerStarted()

// Run operator until the stop channel is closed
stop := make(chan struct{})
defer close(stop)
Expand All @@ -86,3 +85,20 @@ func main() {
glog.Fatalf("Error while running %s: %v", os.Args[0], err)
}
}

// optValue is a flag.Value that detects whether a user passed a flag directly.
type optValue struct {
value bool
present bool
}

func (o *optValue) Set(s string) error {
v, err := strconv.ParseBool(s)
o.value = v
o.present = true
return err
}

func (o *optValue) String() string {
return strconv.FormatBool(o.value)
}
6 changes: 2 additions & 4 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ import:
version: bf9dde6d0d2c004a008c27aaee91170c786f6db8
- package: github.com/imdario/mergo
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
- package: github.com/jpillora/go-ogle-analytics
version: 14b04e0594ef6a9fd943363b135656f0ec8c9d0e
- package: github.com/juju/ratelimit
version: 5b9ff866471762aa2ab2dced63c9fb6f53921342
- package: github.com/mailru/easyjson
Expand Down
53 changes: 0 additions & 53 deletions pkg/analytics/client.go

This file was deleted.

22 changes: 0 additions & 22 deletions vendor/github.com/jpillora/go-ogle-analytics/LICENSE

This file was deleted.

76 changes: 0 additions & 76 deletions vendor/github.com/jpillora/go-ogle-analytics/client.go

This file was deleted.

19 changes: 0 additions & 19 deletions vendor/github.com/jpillora/go-ogle-analytics/conv.go

This file was deleted.

Loading