diff --git a/cmd/manager/main.go b/cmd/manager/main.go index e8d6621e..901914b6 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -19,18 +19,13 @@ package main import ( "context" - "math/rand" "os" - "time" "github.com/citrusframework/yaks/pkg/cmd" - _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" ) func main() { - rand.Seed(time.Now().UTC().UnixNano()) - ctx, cancel := context.WithCancel(context.Background()) // Cancel ctx as soon as main returns diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go index 7a84b405..05dd02e3 100644 --- a/pkg/cmd/operator/operator.go +++ b/pkg/cmd/operator/operator.go @@ -21,7 +21,6 @@ import ( "context" "flag" "fmt" - "math/rand" "os" "runtime" "strconv" @@ -78,8 +77,6 @@ func printVersion() { // Run starts the YAKS operator. func Run(leaderElection bool, leaderElectionID string) { - rand.Seed(time.Now().UTC().UnixNano()) - flag.Parse() // The logger instantiated here can be changed to any logger @@ -154,16 +151,6 @@ func Run(leaderElection bool, leaderElectionID string) { } } - if ok, err := kubernetes.CheckPermission(context.TODO(), c, corev1.GroupName, "events", watchNamespace, "", "create"); err != nil || !ok { - // Do not sink Events to the server as they'll be rejected - broadcaster = event.NewSinkLessBroadcaster(broadcaster) - if err != nil { - log.Error(err, "cannot check permissions for configuring event broadcaster") - } else if !ok { - log.Info("Event broadcasting to Kubernetes is disabled because of missing permissions to create events") - } - } - if ok, err := kubernetes.CheckPermission(context.TODO(), c, coordination.GroupName, "leases", operatorNamespace, "", "create"); err != nil || !ok { leaderElection = false exitOnError(err, "cannot check permissions for creating Leases") diff --git a/pkg/cmd/report/util.go b/pkg/cmd/report/util.go index 24c14489..d0101908 100644 --- a/pkg/cmd/report/util.go +++ b/pkg/cmd/report/util.go @@ -34,7 +34,7 @@ func writeReport(report string, fileName string, outputDir string) error { return err } - if _, err := reportFile.Write([]byte(report)); err != nil { + if _, err := reportFile.WriteString(report); err != nil { return err }