diff --git a/changelog/fragments/ansible-helm-cobra.yaml b/changelog/fragments/ansible-helm-cobra.yaml new file mode 100644 index 0000000000..5a3cb94f8c --- /dev/null +++ b/changelog/fragments/ansible-helm-cobra.yaml @@ -0,0 +1,38 @@ +entries: + - description: > + The Ansible and Helm operators now use controller-runtime's zap package + to define logging flags. + kind: change + breaking: true + migration: + header: Use new logging flags when running the Ansible and Helm operators + body: | + The Ansible and Helm operators now use controller-runtime's zap package + to define logging flags. + + The `--zap-sample` and `--zap-time-encoding` flag have been removed since + they are not present in controller-runtime's flagset. These flags are no + longer supported. + + The `--zap-level` flag is called `--zap-log-level` now. Rename any usage of + `--zap-level` to `--zap-log-level` + + - description: > + The Ansible and Helm operators have a `version` subcommand that prints the + version information for the `ansible-operator` and `helm-operator` binaries. + kind: addition + + - description: > + The Ansible and Helm operators now use a `run` subcommand to run the operator + kind: change + breaking: true + migration: + header: Core Ansible and Helm operator logic moved to `run` subcommand + body: | + If you are using the `ansible-operator` and `helm-operator` binaries + directly, update your usage to call `ansible-operator run` and + `helm-operator run` (e.g. in your Makefile's `make run` target). + + If you are using the base image and you are not overriding the operator + entrypoint, no change is necessary because the base image has been updated + to call the `run` subcommand by default. diff --git a/cmd/ansible-operator/main.go b/cmd/ansible-operator/main.go index b1010ee65c..78db568b61 100644 --- a/cmd/ansible-operator/main.go +++ b/cmd/ansible-operator/main.go @@ -15,236 +15,23 @@ package main import ( - "fmt" - "os" - "runtime" - "strconv" - "strings" + "log" - "github.com/spf13/pflag" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/cache" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/config" - "sigs.k8s.io/controller-runtime/pkg/healthz" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/manager" - "sigs.k8s.io/controller-runtime/pkg/manager/signals" + "github.com/spf13/cobra" - "github.com/operator-framework/operator-sdk/internal/ansible/controller" - "github.com/operator-framework/operator-sdk/internal/ansible/flags" - "github.com/operator-framework/operator-sdk/internal/ansible/proxy" - "github.com/operator-framework/operator-sdk/internal/ansible/proxy/controllermap" - "github.com/operator-framework/operator-sdk/internal/ansible/runner" - "github.com/operator-framework/operator-sdk/internal/ansible/watches" - "github.com/operator-framework/operator-sdk/internal/log/zap" - "github.com/operator-framework/operator-sdk/internal/util/k8sutil" - sdkVersion "github.com/operator-framework/operator-sdk/version" + "github.com/operator-framework/operator-sdk/internal/cmd/ansible-operator/run" + "github.com/operator-framework/operator-sdk/internal/cmd/ansible-operator/version" ) -var ( - metricsHost = "0.0.0.0" - log = logf.Log.WithName("cmd") - healthProbePort int32 = 6789 -) - -func printVersion() { - log.Info("Version", - "Go Version", runtime.Version(), - "GOOS", runtime.GOOS, - "GOARCH", runtime.GOARCH, - "ansible-operator", sdkVersion.Version) -} - func main() { - f := &flags.Flags{} - f.AddTo(pflag.CommandLine) - pflag.Parse() - logf.SetLogger(zap.Logger()) - - printVersion() - - cfg, err := config.GetConfig() - if err != nil { - log.Error(err, "Failed to get config.") - os.Exit(1) - } - - // Deprecated: OPERATOR_NAME environment variable is an artifact of the - // legacy operator-sdk project scaffolding. Flag `--leader-election-id` - // should be used instead. - if operatorName, found := os.LookupEnv("OPERATOR_NAME"); found { - log.Info("Environment variable OPERATOR_NAME has been deprecated, use --leader-election-id instead.") - if pflag.CommandLine.Lookup("leader-election-id").Changed { - log.Info("Ignoring OPERATOR_NAME environment variable since --leader-election-id is set") - } else { - f.LeaderElectionID = operatorName - } - } - - // Set default manager options - // TODO: probably should expose the host & port as an environment variables - options := manager.Options{ - HealthProbeBindAddress: fmt.Sprintf("%s:%d", metricsHost, healthProbePort), - MetricsBindAddress: f.MetricsAddress, - LeaderElection: f.EnableLeaderElection, - LeaderElectionID: f.LeaderElectionID, - LeaderElectionNamespace: f.LeaderElectionNamespace, - NewClient: func(cache cache.Cache, config *rest.Config, options client.Options) (client.Client, error) { - c, err := client.New(config, options) - if err != nil { - return nil, err - } - return &client.DelegatingClient{ - Reader: cache, - Writer: c, - StatusClient: c, - }, nil - }, - } - - namespace, found := os.LookupEnv(k8sutil.WatchNamespaceEnvVar) - log = log.WithValues("Namespace", namespace) - if found { - if namespace == metav1.NamespaceAll { - log.Info("Watching all namespaces.") - options.Namespace = metav1.NamespaceAll - } else { - if strings.Contains(namespace, ",") { - log.Info("Watching multiple namespaces.") - options.NewCache = cache.MultiNamespacedCacheBuilder(strings.Split(namespace, ",")) - } else { - log.Info("Watching single namespace.") - options.Namespace = namespace - } - } - } else { - log.Info(fmt.Sprintf("%v environment variable not set. Watching all namespaces.", - k8sutil.WatchNamespaceEnvVar)) - options.Namespace = metav1.NamespaceAll - } - - err = setAnsibleEnvVars(f) - if err != nil { - log.Error(err, "Failed to set environment variable.") - os.Exit(1) - } - - // Create a new manager to provide shared dependencies and start components - mgr, err := manager.New(cfg, options) - if err != nil { - log.Error(err, "Failed to create a new manager.") - os.Exit(1) - } - - cMap := controllermap.NewControllerMap() - watches, err := watches.Load(f.WatchesFile, f.MaxConcurrentReconciles, f.AnsibleVerbosity) - if err != nil { - log.Error(err, "Failed to load watches.") - os.Exit(1) - } - for _, w := range watches { - runner, err := runner.New(w) - if err != nil { - log.Error(err, "Failed to create runner") - os.Exit(1) - } - - ctr := controller.Add(mgr, controller.Options{ - GVK: w.GroupVersionKind, - Runner: runner, - ManageStatus: w.ManageStatus, - AnsibleDebugLogs: getAnsibleDebugLog(), - MaxConcurrentReconciles: w.MaxConcurrentReconciles, - ReconcilePeriod: w.ReconcilePeriod, - Selector: w.Selector, - }) - if ctr == nil { - log.Error(fmt.Errorf("failed to add controller for GVK %v", w.GroupVersionKind.String()), "") - os.Exit(1) - } - - cMap.Store(w.GroupVersionKind, &controllermap.Contents{Controller: *ctr, - WatchDependentResources: w.WatchDependentResources, - WatchClusterScopedResources: w.WatchClusterScopedResources, - OwnerWatchMap: controllermap.NewWatchMap(), - AnnotationWatchMap: controllermap.NewWatchMap(), - }, w.Blacklist) - } - - err = mgr.AddHealthzCheck("ping", healthz.Ping) - if err != nil { - log.Error(err, "Failed to add Healthz check.") - } - - done := make(chan error) - - // start the proxy - err = proxy.Run(done, proxy.Options{ - Address: "localhost", - Port: 8888, - KubeConfig: mgr.GetConfig(), - Cache: mgr.GetCache(), - RESTMapper: mgr.GetRESTMapper(), - ControllerMap: cMap, - OwnerInjection: f.InjectOwnerRef, - WatchedNamespaces: []string{namespace}, - }) - if err != nil { - log.Error(err, "Error starting proxy.") - os.Exit(1) + root := cobra.Command{ + Use: "ansible-operator", } - // start the operator - go func() { - done <- mgr.Start(signals.SetupSignalHandler()) - }() - - // wait for either to finish - err = <-done - if err != nil { - log.Error(err, "Proxy or operator exited with error.") - os.Exit(1) - } - log.Info("Exiting.") -} - -// getAnsibleDebugLog return the value from the ANSIBLE_DEBUG_LOGS it order to -// print the full Ansible logs -func getAnsibleDebugLog() bool { - const envVar = "ANSIBLE_DEBUG_LOGS" - val := false - if envVal, ok := os.LookupEnv(envVar); ok { - if i, err := strconv.ParseBool(envVal); err != nil { - log.Info("Could not parse environment variable as an boolean; using default value", - "envVar", envVar, "default", val) - } else { - val = i - } - } else if !ok { - log.Info("Environment variable not set; using default value", "envVar", envVar, - envVar, val) - } - return val -} - -// setAnsibleEnvVars will set environment variables based on CLI flags -func setAnsibleEnvVars(f *flags.Flags) error { - if len(f.AnsibleRolesPath) > 0 { - if err := os.Setenv(flags.AnsibleRolesPathEnvVar, f.AnsibleRolesPath); err != nil { - return fmt.Errorf("failed to set environment variable %s: %v", flags.AnsibleRolesPathEnvVar, err) - } - log.Info("Set the environment variable", "envVar", flags.AnsibleRolesPathEnvVar, - "value", f.AnsibleRolesPath) - } + root.AddCommand(run.NewCmd()) + root.AddCommand(version.NewCmd()) - if len(f.AnsibleCollectionsPath) > 0 { - if err := os.Setenv(flags.AnsibleCollectionsPathEnvVar, f.AnsibleCollectionsPath); err != nil { - return fmt.Errorf("failed to set environment variable %s: %v", flags.AnsibleCollectionsPathEnvVar, err) - } - log.Info("Set the environment variable", "envVar", flags.AnsibleCollectionsPathEnvVar, - "value", f.AnsibleCollectionsPath) + if err := root.Execute(); err != nil { + log.Fatal(err) } - return nil } diff --git a/cmd/helm-operator/main.go b/cmd/helm-operator/main.go index 4c0ae34364..7332e9564e 100644 --- a/cmd/helm-operator/main.go +++ b/cmd/helm-operator/main.go @@ -15,136 +15,23 @@ package main import ( - "fmt" - "os" - "runtime" - "strings" + "log" - "github.com/spf13/pflag" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/rest" - "sigs.k8s.io/controller-runtime/pkg/cache" - crclient "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/client/config" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "sigs.k8s.io/controller-runtime/pkg/manager" - "sigs.k8s.io/controller-runtime/pkg/manager/signals" + "github.com/spf13/cobra" - "github.com/operator-framework/operator-sdk/internal/helm/controller" - "github.com/operator-framework/operator-sdk/internal/helm/flags" - "github.com/operator-framework/operator-sdk/internal/helm/release" - "github.com/operator-framework/operator-sdk/internal/helm/watches" - "github.com/operator-framework/operator-sdk/internal/log/zap" - "github.com/operator-framework/operator-sdk/internal/util/k8sutil" - sdkVersion "github.com/operator-framework/operator-sdk/version" + "github.com/operator-framework/operator-sdk/internal/cmd/helm-operator/run" + "github.com/operator-framework/operator-sdk/internal/cmd/helm-operator/version" ) -var log = logf.Log.WithName("cmd") - -func printVersion() { - log.Info("Version", - "Go Version", runtime.Version(), - "GOOS", runtime.GOOS, - "GOARCH", runtime.GOARCH, - "helm-operator", sdkVersion.Version) -} - func main() { - f := flags.Flags{} - f.AddTo(pflag.CommandLine) - pflag.Parse() - logf.SetLogger(zap.Logger()) - - printVersion() - - cfg, err := config.GetConfig() - if err != nil { - log.Error(err, "Failed to get config.") - os.Exit(1) - } - - // Deprecated: OPERATOR_NAME environment variable is an artifact of the legacy operator-sdk project scaffolding. - // Flag `--leader-election-id` should be used instead. - if operatorName, found := os.LookupEnv("OPERATOR_NAME"); found { - log.Info("Environment variable OPERATOR_NAME has been deprecated, use --leader-election-id instead.") - if pflag.CommandLine.Lookup("leader-election-id").Changed { - log.Info("Ignoring OPERATOR_NAME environment variable since --leader-election-id is set") - } else { - f.LeaderElectionID = operatorName - } + root := cobra.Command{ + Use: "helm-operator", } - // Set default manager options - options := manager.Options{ - MetricsBindAddress: f.MetricsAddress, - LeaderElection: f.EnableLeaderElection, - LeaderElectionID: f.LeaderElectionID, - LeaderElectionNamespace: f.LeaderElectionNamespace, - NewClient: func(cache cache.Cache, config *rest.Config, options crclient.Options) (crclient.Client, error) { - c, err := crclient.New(config, options) - if err != nil { - return nil, err - } - return &crclient.DelegatingClient{ - Reader: cache, - Writer: c, - StatusClient: c, - }, nil - }, - } - - namespace, found := os.LookupEnv(k8sutil.WatchNamespaceEnvVar) - log = log.WithValues("Namespace", namespace) - if found { - if namespace == metav1.NamespaceAll { - log.Info("Watching all namespaces.") - options.Namespace = metav1.NamespaceAll - } else { - if strings.Contains(namespace, ",") { - log.Info("Watching multiple namespaces.") - options.NewCache = cache.MultiNamespacedCacheBuilder(strings.Split(namespace, ",")) - } else { - log.Info("Watching single namespace.") - options.Namespace = namespace - } - } - } else { - log.Info(fmt.Sprintf("%v environment variable not set. Watching all namespaces.", - k8sutil.WatchNamespaceEnvVar)) - options.Namespace = metav1.NamespaceAll - } - - mgr, err := manager.New(cfg, options) - if err != nil { - log.Error(err, "Failed to create a new manager.") - os.Exit(1) - } - - ws, err := watches.Load(f.WatchesFile) - if err != nil { - log.Error(err, "Failed to create new manager factories.") - os.Exit(1) - } - for _, w := range ws { - // Register the controller with the factory. - err := controller.Add(mgr, controller.WatchOptions{ - Namespace: namespace, - GVK: w.GroupVersionKind, - ManagerFactory: release.NewManagerFactory(mgr, w.ChartDir), - ReconcilePeriod: f.ReconcilePeriod, - WatchDependentResources: *w.WatchDependentResources, - OverrideValues: w.OverrideValues, - MaxConcurrentReconciles: f.MaxConcurrentReconciles, - }) - if err != nil { - log.Error(err, "Failed to add manager factory to controller.") - os.Exit(1) - } - } + root.AddCommand(run.NewCmd()) + root.AddCommand(version.NewCmd()) - // Start the Cmd - if err = mgr.Start(signals.SetupSignalHandler()); err != nil { - log.Error(err, "Manager exited non-zero.") - os.Exit(1) + if err := root.Execute(); err != nil { + log.Fatal(err) } } diff --git a/go.mod b/go.mod index f1d02dedc2..2f9301dd67 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/blang/semver v3.5.1+incompatible github.com/fatih/structtag v1.1.0 github.com/go-logr/logr v0.1.0 - github.com/go-logr/zapr v0.1.1 github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 github.com/kr/text v0.1.0 github.com/markbates/inflect v1.0.4 @@ -24,7 +23,6 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.5.1 - go.uber.org/zap v1.14.1 golang.org/x/tools v0.0.0-20200403190813-44a64ad78b9b gomodules.xyz/jsonpatch/v3 v3.0.1 helm.sh/helm/v3 v3.2.4 @@ -33,7 +31,6 @@ require ( k8s.io/apimachinery v0.18.4 k8s.io/cli-runtime v0.18.2 k8s.io/client-go v0.18.4 - k8s.io/klog v1.0.0 k8s.io/kubectl v0.18.2 rsc.io/letsencrypt v0.0.3 // indirect sigs.k8s.io/controller-runtime v0.6.1 diff --git a/go.sum b/go.sum index da4a954b60..1eed00b3b1 100644 --- a/go.sum +++ b/go.sum @@ -40,7 +40,6 @@ github.com/Masterminds/vcs v1.13.1/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHS github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5 h1:ygIc8M6trr62pF5DucadTWGdEB4mEyvzi0e2nbcmcyA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= -github.com/Microsoft/hcsshim v0.8.7 h1:ptnOoufxGSzauVTsdE+wMYnCWA301PdoN4xg5oRdZpg= github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= github.com/Microsoft/hcsshim v0.8.9 h1:VrfodqvztU8YSOvygU+DN1BGaSGxmrNfqOv5oOuX2Bk= github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= @@ -60,7 +59,6 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -92,13 +90,10 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bshuster-repo/logrus-logstash-hook v0.4.1 h1:pgAtgj+A31JBVtEHu2uHuEx0n+2ukqUJnS2vVe5pQNA= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= -github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd h1:rFt+Y/IK1aEZkEHchZRSq9OQbsSzIT/OrI8YFFmRIng= github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= github.com/bugsnag/bugsnag-go v1.5.3 h1:yeRUT3mUE13jL1tGwvoQsKdVbAsQx9AJ+fqahKveP04= github.com/bugsnag/bugsnag-go v1.5.3/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= -github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b h1:otBG+dV+YK+Soembjv71DPz3uX/V/6MMlSyD9JBQ6kQ= github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= -github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXer/kZD8Ri1aaunCxIEsOst1BVJswV0o= github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/bugsnag/panicwrap v1.2.0 h1:OzrKrRvXis8qEvOkfcxNcYbOd2O7xXS2nnKMEMABFQA= github.com/bugsnag/panicwrap v1.2.0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= @@ -121,13 +116,11 @@ github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go. github.com/containerd/containerd v1.3.2 h1:ForxmXkA6tPIvffbrDAcPUIB32QgXkt2XFj+F0UxetA= github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200107194136-26c1120b8d41 h1:kIFnQBO7rQ0XkMe6xEwbybYHBEaWmh/f++laI6Emt7M= github.com/containerd/continuity v0.0.0-20200107194136-26c1120b8d41/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= github.com/containerd/continuity v0.0.0-20200413184840-d3ef23f19fbb h1:nXPkFq8X1a9ycY3GYQpFNxHh3j2JgY7zDZfq2EXMIzk= github.com/containerd/continuity v0.0.0-20200413184840-d3ef23f19fbb/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= -github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de h1:dlfGmNcE3jDAecLqwKPMNX6nk2qh1c1Vg1/YTzpOOF4= github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= github.com/containerd/ttrpc v1.0.1 h1:IfVOxKbjyBn9maoye2JN95pgGYOmPkQVqxtOu7rtNIc= github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= @@ -193,14 +186,12 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c h1:+pKlWGMw7gf6bQ+oDZB4KHQFypsfjYlq/C4rfL7D3g8= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916 h1:yWHOI+vFjEsAakUTSrtqc/SAHrhSkmn48pqjidZX3QA= github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8= github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arXfYcAtECDFgAgHklGI8CxgjHnXKJ4= github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4= github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= @@ -232,12 +223,10 @@ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/structtag v1.1.0 h1:6j4mUV/ES2duvnAzKMFkN6/A5mCaNYPD3xfbAkLLOF8= github.com/fatih/structtag v1.1.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsouza/fake-gcs-server v1.7.0/go.mod h1:5XIRs4YvwNbNoz+1JF8j6KLAyDh7RHGAyAK3EP2EsNk= -github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7 h1:LofdAjjjqCSXMwLGgOgnE+rdPuvX9DxCqaHwKy7i/ko= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/garyburd/redigo v1.6.0 h1:0VruCpn7yAIIu7pWVClQC8wxCJEcG3nyzpMSHKi1PQc= github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= @@ -254,9 +243,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/zapr v0.1.0 h1:h+WVe9j6HAA01niTJPA/kKH0i7e0rLZBCwauQFcRE54= github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= -github.com/go-logr/zapr v0.1.1 h1:qXBXPDdNncunGs7XeEpsJt8wCjYBygluzfdLO0G5baE= -github.com/go-logr/zapr v0.1.1/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -319,7 +307,6 @@ github.com/gobuffalo/envy v1.6.5/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9k github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= github.com/gobuffalo/envy v1.7.1 h1:OQl5ys5MBea7OGCdvPbBJWRgnhC/fGona6QKfvFeau8= github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= -github.com/gobuffalo/flect v0.2.0 h1:EWCvMGGxOjsgwlWaP+f4+Hh6yrrte7JeFL2S6b+0hdM= github.com/gobuffalo/flect v0.2.0/go.mod h1:W3K3X9ksuZfir8f/LrfVtWmCDQFfayuylOJ7sz/Fj80= github.com/gobuffalo/flect v0.2.1 h1:GPoRjEN0QObosV4XwuoWvSd5uSiL0N3e91/xqyY4crQ= github.com/gobuffalo/flect v0.2.1/go.mod h1:vmkQwuZYhN5Pc4ljYQZzP+1sq+NEkK+lh20jmEmX3jc= @@ -344,7 +331,6 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/golang-migrate/migrate/v4 v4.6.2 h1:LDDOHo/q1W5UDj6PbkxdCv7lv9yunyZHXvxuwDkGo3k= github.com/golang-migrate/migrate/v4 v4.6.2/go.mod h1:JYi6reN3+Z734VZ0akNuyOJNcrg45ZL7LDBMW3WGJL0= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk= @@ -356,7 +342,6 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -379,7 +364,6 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -388,9 +372,9 @@ github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -403,7 +387,6 @@ github.com/gophercloud/gophercloud v0.1.0 h1:P/nh25+rzXouhytV2pUHBb65fnds26Ghl8/ github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33 h1:893HsJqtxp9z1SF76gg6hY70hRY1wVlTSnC/h1yUDCo= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -429,20 +412,17 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 h1:VHgatEHNcBFEB7inlalqfNqw65aNkM1lGX2yt3NmbS8= github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -462,7 +442,6 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -524,20 +503,17 @@ github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK86 github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2 h1:g+4J5sZg6osfvEfkRZxJ1em0VT95/UOZgi/l7zi1/oE= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= github.com/mikefarah/yaml/v2 v2.4.0/go.mod h1:ahVqZF4n1W4NqwvVnZzC4es67xsW9uR/RRf2RRxieJU= github.com/mikefarah/yq/v2 v2.4.1/go.mod h1:i8SYf1XdgUvY2OFwSqGAtWOOgimD2McJ6iutoxRm4k0= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f h1:2+myh5ml7lgEU/51gbeLHfKGNfgEQQIWrlbdaOsidbQ= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -569,7 +545,6 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -579,7 +554,6 @@ github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= @@ -588,7 +562,6 @@ github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1 github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6 h1:yN8BPXVwMBAm3Cuvh1L5XE8XpvYRMdsVLd82ILprhUU= github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -599,7 +572,6 @@ github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700 h1:e github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/operator-framework/api v0.3.7-0.20200602203552-431198de9fc2 h1:2KtDe3jI6ftXGj5M875WVvv6pBIk4K9DyrwPuE+XfOc= github.com/operator-framework/api v0.3.7-0.20200602203552-431198de9fc2/go.mod h1:Xbje9x0SHmh0nihE21kpesB38vk3cyxnE6JdDS8Jo1Q= github.com/operator-framework/api v0.3.8 h1:tJykTCmwGKZBsPVTCfxbwz6nTF6dzmKydWJtC40erc8= github.com/operator-framework/api v0.3.8/go.mod h1:Xbje9x0SHmh0nihE21kpesB38vk3cyxnE6JdDS8Jo1Q= @@ -609,15 +581,12 @@ github.com/operator-framework/operator-registry v1.13.4 h1:GH7essHnVRP4kYgAWYV9o github.com/operator-framework/operator-registry v1.13.4/go.mod h1:YhnIzOVjRU2ZwZtzt+fjcjW8ujJaSFynBEu7QVKaSdU= github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95 h1:+OLn68pqasWca0z5ryit9KGfp3sUsW4Lqg32iRMJyzs= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= -github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -666,7 +635,6 @@ github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7z github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI= github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= @@ -758,15 +726,12 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43 h1:+lm10QQTNSBd8DVTNGHx7o/IKu9HYDvLMffDhbyLccI= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= github.com/yvasiyarov/go-metrics v0.0.0-20150112132944-c25f46c4b940 h1:p7OofyZ509h8DmPLh8Hn+EIIZm/xYhdZHJ9GnXHdr6U= github.com/yvasiyarov/go-metrics v0.0.0-20150112132944-c25f46c4b940/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= -github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50 h1:hlE8//ciYMztlGpl/VA+Zm1AcTPHYkHJPbHqE6WJUXE= github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/gorelic v0.0.7 h1:4DTF1WOM2ZZS/xMOkTFBOcb6XiHu/PKn3rVo6dbewQE= github.com/yvasiyarov/gorelic v0.0.7/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= -github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f h1:ERexzlUfuTvpE74urLSbIQW0Z/6hF9t8U4NsJLaioAY= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20160601141957-9c099fbc30e9 h1:AsFN8kXcCVkUFHyuzp1FtYbzp1nCO/H6+1uPSGEyPzM= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20160601141957-9c099fbc30e9/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= @@ -788,17 +753,12 @@ go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo= -go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -807,14 +767,12 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200414173820-0848c9571904 h1:bXoxMPcSLOq08zI3/c5dEBT6lE4eh+jOh886GHrn6V8= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -823,10 +781,7 @@ golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -856,9 +811,7 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -909,11 +862,8 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -939,12 +889,9 @@ golang.org/x/tools v0.0.0-20190425222832-ad9eeb80039a/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191004055002-72853e10c5a3/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191030203535-5e247c9ad0a0/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -979,7 +926,6 @@ google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24 h1:wDju+RU97qa0FZT0QnZDg9Uc2dH0Ql513kFvHocz+WM= google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200701001935-0939c5918c31 h1:Of4QP8bfRqzDROen6+s2j/p0jCPgzvQRd9nHiactfn4= @@ -994,7 +940,6 @@ google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.30.0 h1:M5a8xTlYTxwMn5ZFkwhRabsygDY5G8TYLyQDBxJNAxE= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= @@ -1005,14 +950,12 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1021,7 +964,6 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogR gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/gorp.v1 v1.7.2 h1:j3DWlAyGVv8whO7AcIWznQ2Yj7yJkn34B8s63GViAAw= @@ -1040,11 +982,9 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966 h1:B0J02caTR6tpSJozBJyiAzT6CtBzjclw4pgm9gg8Ys0= gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= @@ -1054,25 +994,19 @@ honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= k8s.io/api v0.18.0/go.mod h1:q2HRQkfDzHMBZL9l/y9rH63PkQl4vae0xRT+8prbrK8= -k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8= k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/api v0.18.4 h1:8x49nBRxuXGUlDlwlWd3RMY1SayZrzFfxea3UZSkFw4= k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4= k8s.io/apiextensions-apiserver v0.18.0/go.mod h1:18Cwn1Xws4xnWQNC00FLq1E350b9lUF+aOdIWDOZxgo= -k8s.io/apiextensions-apiserver v0.18.2 h1:I4v3/jAuQC+89L3Z7dDgAiN4EOjN6sbm6iBqQwHTah8= k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY= k8s.io/apiextensions-apiserver v0.18.4 h1:Y3HGERmS8t9u12YNUFoOISqefaoGRuTc43AYCLzWmWE= k8s.io/apiextensions-apiserver v0.18.4/go.mod h1:NYeyeYq4SIpFlPxSAB6jHPIdvu3hL0pc36wuRChybio= k8s.io/apimachinery v0.18.0/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= -k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA= k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.4 h1:ST2beySjhqwJoIFk6p7Hp5v5O0hYY6Gngq/gUYXTPIA= k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko= k8s.io/apiserver v0.18.0/go.mod h1:3S2O6FeBBd6XTo0njUrLxiqk8GNy6wWOftjhJcXYnjw= -k8s.io/apiserver v0.18.2 h1:fwKxdTWwwYhxvtjo0UUfX+/fsitsNtfErPNegH2x9ic= k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw= k8s.io/apiserver v0.18.4 h1:pn1jSQkfboPSirZopkVpEdLW4FcQLnYMaIY8LFxxj30= k8s.io/apiserver v0.18.4/go.mod h1:q+zoFct5ABNnYkGIaGQ3bcbUNdmPyOCoEBcg51LChY8= @@ -1080,21 +1014,17 @@ k8s.io/cli-runtime v0.18.0/go.mod h1:1eXfmBsIJosjn9LjEBUd2WVPoPAY9XGTqTFcPMIBsUQ k8s.io/cli-runtime v0.18.2 h1:JiTN5RgkFNTiMxHBRyrl6n26yKWAuNRlei1ZJALUmC8= k8s.io/cli-runtime v0.18.2/go.mod h1:yfFR2sQQzDsV0VEKGZtrJwEy4hLZ2oj4ZIfodgxAHWQ= k8s.io/client-go v0.18.0/go.mod h1:uQSYDYs4WhVZ9i6AIoEZuwUggLVEF64HOD37boKAtF8= -k8s.io/client-go v0.18.2 h1:aLB0iaD4nmwh7arT2wIn+lMnAq7OswjaejkQ8p9bBYE= k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= k8s.io/client-go v0.18.4 h1:un55V1Q/B3JO3A76eS0kUSywgGK/WR3BQ8fHQjNa6Zc= k8s.io/client-go v0.18.4/go.mod h1:f5sXwL4yAZRkAtzOxRWUhA/N8XzGCb+nPZI8PfobZ9g= k8s.io/code-generator v0.18.0/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= -k8s.io/code-generator v0.18.2 h1:C1Nn2JiMf244CvBDKVPX0W2mZFJkVBg54T8OV7/Imso= k8s.io/code-generator v0.18.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/code-generator v0.18.4/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c= k8s.io/component-base v0.18.0/go.mod h1:u3BCg0z1uskkzrnAKFzulmYaEpZF7XC9Pf/uFyb1v2c= -k8s.io/component-base v0.18.2 h1:SJweNZAGcUvsypLGNPNGeJ9UgPZQ6+bW+gEHe8uyh/Y= k8s.io/component-base v0.18.2/go.mod h1:kqLlMuhJNHQ9lz8Z7V5bxUUtjFZnrypArGl58gmDfUM= k8s.io/component-base v0.18.4 h1:Kr53Fp1iCGNsl9Uv4VcRvLy7YyIqi9oaJOQ7SXtKI98= k8s.io/component-base v0.18.4/go.mod h1:7jr/Ef5PGmKwQhyAz/pjByxJbC58mhKAhiaDu0vXfPk= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= -k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= @@ -1102,7 +1032,6 @@ k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0 h1:Foj74zO6RbjjP4hBEKjnYtjjAhGg4jNynUdYF6fJrok= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c h1:/KUFqjjqAcY4Us6luF5RDNZ16KJtb49HfR3ZHB9qYXM= k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= @@ -1112,7 +1041,6 @@ k8s.io/kubectl v0.18.2/go.mod h1:OdgFa3AlsPKRpFFYE7ICTwulXOcMGXHTc+UKhHKvrb4= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/metrics v0.18.0/go.mod h1:8aYTW18koXqjLVKL7Ds05RPMX9ipJZI3mywYvBOxXd4= k8s.io/metrics v0.18.2/go.mod h1:qga8E7QfYNR9Q89cSCAjinC9pTZ7yv1XSVGUB0vJypg= -k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 h1:d4vVOjXm687F1iLSP2q3lyPPuyvTUt3aVoBpi2DqRsU= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 h1:v8ud2Up6QK1lNOKFgiIVrZdMg7MpmSnvtrOieolJKoE= k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= diff --git a/hack/image/ansible/Dockerfile b/hack/image/ansible/Dockerfile index cf18694a46..180fc50c25 100644 --- a/hack/image/ansible/Dockerfile +++ b/hack/image/ansible/Dockerfile @@ -40,4 +40,4 @@ RUN TINIARCH=$(case $(arch) in x86_64) echo -n amd64 ;; ppc64le) echo -n ppc64el WORKDIR ${HOME} USER ${USER_UID} -ENTRYPOINT ["/tini", "--", "/usr/local/bin/ansible-operator", "--watches-file=./watches.yaml"] +ENTRYPOINT ["/tini", "--", "/usr/local/bin/ansible-operator", "run", "--watches-file=./watches.yaml"] diff --git a/hack/image/helm/Dockerfile b/hack/image/helm/Dockerfile index dda3523ae5..edecb33351 100644 --- a/hack/image/helm/Dockerfile +++ b/hack/image/helm/Dockerfile @@ -9,4 +9,4 @@ COPY helm-operator-dev-linux-gnu /usr/local/bin/helm-operator WORKDIR ${HOME} USER ${USER_UID} -ENTRYPOINT ["/usr/local/bin/helm-operator", "--watches-file=./watches.yaml"] +ENTRYPOINT ["/usr/local/bin/helm-operator", "run", "--watches-file=./watches.yaml"] diff --git a/internal/ansible/flags/flag.go b/internal/ansible/flags/flag.go index 3bbb990b74..350bf31efd 100644 --- a/internal/ansible/flags/flag.go +++ b/internal/ansible/flags/flag.go @@ -19,8 +19,6 @@ import ( "time" "github.com/spf13/pflag" - - "github.com/operator-framework/operator-sdk/internal/log/zap" ) // Flags - Options to be used by an ansible operator @@ -43,7 +41,6 @@ const AnsibleCollectionsPathEnvVar = "ANSIBLE_COLLECTIONS_PATH" // AddTo - Add the ansible operator flags to the the flagset func (f *Flags) AddTo(flagSet *pflag.FlagSet) { - flagSet.AddFlagSet(zap.FlagSet()) flagSet.DurationVar(&f.ReconcilePeriod, "reconcile-period", time.Minute, diff --git a/internal/cmd/ansible-operator/run/cmd.go b/internal/cmd/ansible-operator/run/cmd.go new file mode 100644 index 0000000000..c3828aec44 --- /dev/null +++ b/internal/cmd/ansible-operator/run/cmd.go @@ -0,0 +1,266 @@ +// Copyright 2020 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package run + +import ( + "flag" + "fmt" + "os" + "runtime" + "strconv" + "strings" + + "github.com/spf13/cobra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/config" + "sigs.k8s.io/controller-runtime/pkg/healthz" + logf "sigs.k8s.io/controller-runtime/pkg/log" + zapf "sigs.k8s.io/controller-runtime/pkg/log/zap" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/manager/signals" + + "github.com/operator-framework/operator-sdk/internal/ansible/controller" + "github.com/operator-framework/operator-sdk/internal/ansible/flags" + "github.com/operator-framework/operator-sdk/internal/ansible/proxy" + "github.com/operator-framework/operator-sdk/internal/ansible/proxy/controllermap" + "github.com/operator-framework/operator-sdk/internal/ansible/runner" + "github.com/operator-framework/operator-sdk/internal/ansible/watches" + "github.com/operator-framework/operator-sdk/internal/util/k8sutil" + sdkVersion "github.com/operator-framework/operator-sdk/version" +) + +var ( + metricsHost = "0.0.0.0" + log = logf.Log.WithName("cmd") + healthProbePort int32 = 6789 +) + +func printVersion() { + log.Info("Version", + "Go Version", runtime.Version(), + "GOOS", runtime.GOOS, + "GOARCH", runtime.GOARCH, + "ansible-operator", sdkVersion.Version) +} + +func NewCmd() *cobra.Command { + f := &flags.Flags{} + zapfs := flag.NewFlagSet("zap", flag.ExitOnError) + opts := &zapf.Options{} + opts.BindFlags(zapfs) + + cmd := &cobra.Command{ + Use: "run", + Short: "Run the operator", + Run: func(cmd *cobra.Command, _ []string) { + logf.SetLogger(zapf.New(zapf.UseFlagOptions(opts))) + run(cmd, f) + }, + } + + f.AddTo(cmd.Flags()) + cmd.Flags().AddGoFlagSet(zapfs) + return cmd +} + +func run(cmd *cobra.Command, f *flags.Flags) { + printVersion() + + cfg, err := config.GetConfig() + if err != nil { + log.Error(err, "Failed to get config.") + os.Exit(1) + } + + // Deprecated: OPERATOR_NAME environment variable is an artifact of the + // legacy operator-sdk project scaffolding. Flag `--leader-election-id` + // should be used instead. + if operatorName, found := os.LookupEnv("OPERATOR_NAME"); found { + log.Info("Environment variable OPERATOR_NAME has been deprecated, use --leader-election-id instead.") + if cmd.Flags().Lookup("leader-election-id").Changed { + log.Info("Ignoring OPERATOR_NAME environment variable since --leader-election-id is set") + } else { + f.LeaderElectionID = operatorName + } + } + + // Set default manager options + // TODO: probably should expose the host & port as an environment variables + options := manager.Options{ + HealthProbeBindAddress: fmt.Sprintf("%s:%d", metricsHost, healthProbePort), + MetricsBindAddress: f.MetricsAddress, + LeaderElection: f.EnableLeaderElection, + LeaderElectionID: f.LeaderElectionID, + LeaderElectionNamespace: f.LeaderElectionNamespace, + NewClient: func(cache cache.Cache, config *rest.Config, options client.Options) (client.Client, error) { + c, err := client.New(config, options) + if err != nil { + return nil, err + } + return &client.DelegatingClient{ + Reader: cache, + Writer: c, + StatusClient: c, + }, nil + }, + } + + namespace, found := os.LookupEnv(k8sutil.WatchNamespaceEnvVar) + log = log.WithValues("Namespace", namespace) + if found { + if namespace == metav1.NamespaceAll { + log.Info("Watching all namespaces.") + options.Namespace = metav1.NamespaceAll + } else { + if strings.Contains(namespace, ",") { + log.Info("Watching multiple namespaces.") + options.NewCache = cache.MultiNamespacedCacheBuilder(strings.Split(namespace, ",")) + } else { + log.Info("Watching single namespace.") + options.Namespace = namespace + } + } + } else { + log.Info(fmt.Sprintf("%v environment variable not set. Watching all namespaces.", + k8sutil.WatchNamespaceEnvVar)) + options.Namespace = metav1.NamespaceAll + } + + err = setAnsibleEnvVars(f) + if err != nil { + log.Error(err, "Failed to set environment variable.") + os.Exit(1) + } + + // Create a new manager to provide shared dependencies and start components + mgr, err := manager.New(cfg, options) + if err != nil { + log.Error(err, "Failed to create a new manager.") + os.Exit(1) + } + + cMap := controllermap.NewControllerMap() + watches, err := watches.Load(f.WatchesFile, f.MaxConcurrentReconciles, f.AnsibleVerbosity) + if err != nil { + log.Error(err, "Failed to load watches.") + os.Exit(1) + } + for _, w := range watches { + runner, err := runner.New(w) + if err != nil { + log.Error(err, "Failed to create runner") + os.Exit(1) + } + + ctr := controller.Add(mgr, controller.Options{ + GVK: w.GroupVersionKind, + Runner: runner, + ManageStatus: w.ManageStatus, + AnsibleDebugLogs: getAnsibleDebugLog(), + MaxConcurrentReconciles: w.MaxConcurrentReconciles, + ReconcilePeriod: w.ReconcilePeriod, + Selector: w.Selector, + }) + if ctr == nil { + log.Error(fmt.Errorf("failed to add controller for GVK %v", w.GroupVersionKind.String()), "") + os.Exit(1) + } + + cMap.Store(w.GroupVersionKind, &controllermap.Contents{Controller: *ctr, + WatchDependentResources: w.WatchDependentResources, + WatchClusterScopedResources: w.WatchClusterScopedResources, + OwnerWatchMap: controllermap.NewWatchMap(), + AnnotationWatchMap: controllermap.NewWatchMap(), + }, w.Blacklist) + } + + err = mgr.AddHealthzCheck("ping", healthz.Ping) + if err != nil { + log.Error(err, "Failed to add Healthz check.") + } + + done := make(chan error) + + // start the proxy + err = proxy.Run(done, proxy.Options{ + Address: "localhost", + Port: 8888, + KubeConfig: mgr.GetConfig(), + Cache: mgr.GetCache(), + RESTMapper: mgr.GetRESTMapper(), + ControllerMap: cMap, + OwnerInjection: f.InjectOwnerRef, + WatchedNamespaces: []string{namespace}, + }) + if err != nil { + log.Error(err, "Error starting proxy.") + os.Exit(1) + } + + // start the operator + go func() { + done <- mgr.Start(signals.SetupSignalHandler()) + }() + + // wait for either to finish + err = <-done + if err != nil { + log.Error(err, "Proxy or operator exited with error.") + os.Exit(1) + } + log.Info("Exiting.") +} + +// getAnsibleDebugLog return the value from the ANSIBLE_DEBUG_LOGS it order to +// print the full Ansible logs +func getAnsibleDebugLog() bool { + const envVar = "ANSIBLE_DEBUG_LOGS" + val := false + if envVal, ok := os.LookupEnv(envVar); ok { + if i, err := strconv.ParseBool(envVal); err != nil { + log.Info("Could not parse environment variable as an boolean; using default value", + "envVar", envVar, "default", val) + } else { + val = i + } + } else if !ok { + log.Info("Environment variable not set; using default value", "envVar", envVar, + envVar, val) + } + return val +} + +// setAnsibleEnvVars will set environment variables based on CLI flags +func setAnsibleEnvVars(f *flags.Flags) error { + if len(f.AnsibleRolesPath) > 0 { + if err := os.Setenv(flags.AnsibleRolesPathEnvVar, f.AnsibleRolesPath); err != nil { + return fmt.Errorf("failed to set environment variable %s: %v", flags.AnsibleRolesPathEnvVar, err) + } + log.Info("Set the environment variable", "envVar", flags.AnsibleRolesPathEnvVar, + "value", f.AnsibleRolesPath) + } + + if len(f.AnsibleCollectionsPath) > 0 { + if err := os.Setenv(flags.AnsibleCollectionsPathEnvVar, f.AnsibleCollectionsPath); err != nil { + return fmt.Errorf("failed to set environment variable %s: %v", flags.AnsibleCollectionsPathEnvVar, err) + } + log.Info("Set the environment variable", "envVar", flags.AnsibleCollectionsPathEnvVar, + "value", f.AnsibleCollectionsPath) + } + return nil +} diff --git a/internal/cmd/ansible-operator/version/cmd.go b/internal/cmd/ansible-operator/version/cmd.go new file mode 100644 index 0000000000..0d12bb9d16 --- /dev/null +++ b/internal/cmd/ansible-operator/version/cmd.go @@ -0,0 +1,44 @@ +// Copyright 2019 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import ( + "fmt" + "runtime" + + "github.com/spf13/cobra" + + ver "github.com/operator-framework/operator-sdk/version" +) + +func NewCmd() *cobra.Command { + versionCmd := &cobra.Command{ + Use: "version", + Short: "Prints the version of operator-sdk", + Run: func(cmd *cobra.Command, args []string) { + run() + }, + } + return versionCmd +} + +func run() { + version := ver.GitVersion + if version == "unknown" { + version = ver.Version + } + fmt.Printf("ansible-operator version: %q, commit: %q, kubernetes version: %q, go version: %q, GOOS: %q, GOARCH: %q\n", + version, ver.GitCommit, ver.KubernetesVersion, ver.GoVersion, runtime.GOOS, runtime.GOARCH) +} diff --git a/internal/cmd/ansible-operator/version/cmd_test.go b/internal/cmd/ansible-operator/version/cmd_test.go new file mode 100644 index 0000000000..7028b323fb --- /dev/null +++ b/internal/cmd/ansible-operator/version/cmd_test.go @@ -0,0 +1,65 @@ +// Copyright 2020 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import ( + "fmt" + "io/ioutil" + "os" + "runtime" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + ver "github.com/operator-framework/operator-sdk/version" +) + +var _ = Describe("Running a version command", func() { + Describe("NewCmd", func() { + It("builds a cobra command", func() { + cmd := NewCmd() + Expect(cmd).NotTo(BeNil()) + Expect(cmd.Use).NotTo(Equal("")) + Expect(cmd.Short).NotTo(Equal("")) + }) + }) + Describe("run", func() { + It("prints the correct version info", func() { + r, w, _ := os.Pipe() + tmp := os.Stdout + defer func() { + os.Stdout = tmp + }() + os.Stdout = w + go func() { + run() + w.Close() + }() + stdout, err := ioutil.ReadAll(r) + Expect(err).To(BeNil()) + stdoutString := string(stdout) + version := ver.GitVersion + if version == "unknown" { + version = ver.Version + } + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("version: %q", version))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("commit: %q", ver.GitCommit))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("kubernetes version: %q", ver.KubernetesVersion))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("go version: %q", ver.GoVersion))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("GOOS: %q", runtime.GOOS))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("GOARCH: %q", runtime.GOARCH))) + }) + }) +}) diff --git a/internal/cmd/ansible-operator/version/version_suite_test.go b/internal/cmd/ansible-operator/version/version_suite_test.go new file mode 100644 index 0000000000..67474ae807 --- /dev/null +++ b/internal/cmd/ansible-operator/version/version_suite_test.go @@ -0,0 +1,27 @@ +// Copyright 2020 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +func TestVersion(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Version Cmd Suite") +} diff --git a/internal/cmd/helm-operator/run/cmd.go b/internal/cmd/helm-operator/run/cmd.go new file mode 100644 index 0000000000..be7330850a --- /dev/null +++ b/internal/cmd/helm-operator/run/cmd.go @@ -0,0 +1,166 @@ +// Copyright 2020 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package run + +import ( + "flag" + "fmt" + "os" + "runtime" + "strings" + + "github.com/spf13/cobra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/cache" + crclient "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/config" + logf "sigs.k8s.io/controller-runtime/pkg/log" + zapf "sigs.k8s.io/controller-runtime/pkg/log/zap" + "sigs.k8s.io/controller-runtime/pkg/manager" + "sigs.k8s.io/controller-runtime/pkg/manager/signals" + + "github.com/operator-framework/operator-sdk/internal/helm/controller" + "github.com/operator-framework/operator-sdk/internal/helm/flags" + "github.com/operator-framework/operator-sdk/internal/helm/release" + "github.com/operator-framework/operator-sdk/internal/helm/watches" + "github.com/operator-framework/operator-sdk/internal/util/k8sutil" + sdkVersion "github.com/operator-framework/operator-sdk/version" +) + +var log = logf.Log.WithName("cmd") + +func printVersion() { + log.Info("Version", + "Go Version", runtime.Version(), + "GOOS", runtime.GOOS, + "GOARCH", runtime.GOARCH, + "helm-operator", sdkVersion.Version) +} + +func NewCmd() *cobra.Command { + f := &flags.Flags{} + zapfs := flag.NewFlagSet("zap", flag.ExitOnError) + opts := &zapf.Options{} + opts.BindFlags(zapfs) + + cmd := &cobra.Command{ + Use: "run", + Short: "Run the operator", + Run: func(cmd *cobra.Command, _ []string) { + logf.SetLogger(zapf.New(zapf.UseFlagOptions(opts))) + run(cmd, f) + }, + } + + f.AddTo(cmd.Flags()) + cmd.Flags().AddGoFlagSet(zapfs) + return cmd +} + +func run(cmd *cobra.Command, f *flags.Flags) { + printVersion() + + cfg, err := config.GetConfig() + if err != nil { + log.Error(err, "Failed to get config.") + os.Exit(1) + } + + // Deprecated: OPERATOR_NAME environment variable is an artifact of the legacy operator-sdk project scaffolding. + // Flag `--leader-election-id` should be used instead. + if operatorName, found := os.LookupEnv("OPERATOR_NAME"); found { + log.Info("Environment variable OPERATOR_NAME has been deprecated, use --leader-election-id instead.") + if cmd.Flags().Lookup("leader-election-id").Changed { + log.Info("Ignoring OPERATOR_NAME environment variable since --leader-election-id is set") + } else { + f.LeaderElectionID = operatorName + } + } + + // Set default manager options + options := manager.Options{ + MetricsBindAddress: f.MetricsAddress, + LeaderElection: f.EnableLeaderElection, + LeaderElectionID: f.LeaderElectionID, + LeaderElectionNamespace: f.LeaderElectionNamespace, + NewClient: func(cache cache.Cache, config *rest.Config, options crclient.Options) (crclient.Client, error) { + c, err := crclient.New(config, options) + if err != nil { + return nil, err + } + return &crclient.DelegatingClient{ + Reader: cache, + Writer: c, + StatusClient: c, + }, nil + }, + } + + namespace, found := os.LookupEnv(k8sutil.WatchNamespaceEnvVar) + log = log.WithValues("Namespace", namespace) + if found { + if namespace == metav1.NamespaceAll { + log.Info("Watching all namespaces.") + options.Namespace = metav1.NamespaceAll + } else { + if strings.Contains(namespace, ",") { + log.Info("Watching multiple namespaces.") + options.NewCache = cache.MultiNamespacedCacheBuilder(strings.Split(namespace, ",")) + } else { + log.Info("Watching single namespace.") + options.Namespace = namespace + } + } + } else { + log.Info(fmt.Sprintf("%v environment variable not set. Watching all namespaces.", + k8sutil.WatchNamespaceEnvVar)) + options.Namespace = metav1.NamespaceAll + } + + mgr, err := manager.New(cfg, options) + if err != nil { + log.Error(err, "Failed to create a new manager.") + os.Exit(1) + } + + ws, err := watches.Load(f.WatchesFile) + if err != nil { + log.Error(err, "Failed to create new manager factories.") + os.Exit(1) + } + for _, w := range ws { + // Register the controller with the factory. + err := controller.Add(mgr, controller.WatchOptions{ + Namespace: namespace, + GVK: w.GroupVersionKind, + ManagerFactory: release.NewManagerFactory(mgr, w.ChartDir), + ReconcilePeriod: f.ReconcilePeriod, + WatchDependentResources: *w.WatchDependentResources, + OverrideValues: w.OverrideValues, + MaxConcurrentReconciles: f.MaxConcurrentReconciles, + }) + if err != nil { + log.Error(err, "Failed to add manager factory to controller.") + os.Exit(1) + } + } + + // Start the Cmd + if err = mgr.Start(signals.SetupSignalHandler()); err != nil { + log.Error(err, "Manager exited non-zero.") + os.Exit(1) + } +} diff --git a/internal/cmd/helm-operator/version/cmd.go b/internal/cmd/helm-operator/version/cmd.go new file mode 100644 index 0000000000..495b4d5429 --- /dev/null +++ b/internal/cmd/helm-operator/version/cmd.go @@ -0,0 +1,44 @@ +// Copyright 2019 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import ( + "fmt" + "runtime" + + "github.com/spf13/cobra" + + ver "github.com/operator-framework/operator-sdk/version" +) + +func NewCmd() *cobra.Command { + versionCmd := &cobra.Command{ + Use: "version", + Short: "Prints the version of operator-sdk", + Run: func(cmd *cobra.Command, args []string) { + run() + }, + } + return versionCmd +} + +func run() { + version := ver.GitVersion + if version == "unknown" { + version = ver.Version + } + fmt.Printf("helm-operator version: %q, commit: %q, kubernetes version: %q, go version: %q, GOOS: %q, GOARCH: %q\n", + version, ver.GitCommit, ver.KubernetesVersion, ver.GoVersion, runtime.GOOS, runtime.GOARCH) +} diff --git a/internal/cmd/helm-operator/version/cmd_test.go b/internal/cmd/helm-operator/version/cmd_test.go new file mode 100644 index 0000000000..7028b323fb --- /dev/null +++ b/internal/cmd/helm-operator/version/cmd_test.go @@ -0,0 +1,65 @@ +// Copyright 2020 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version + +import ( + "fmt" + "io/ioutil" + "os" + "runtime" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + ver "github.com/operator-framework/operator-sdk/version" +) + +var _ = Describe("Running a version command", func() { + Describe("NewCmd", func() { + It("builds a cobra command", func() { + cmd := NewCmd() + Expect(cmd).NotTo(BeNil()) + Expect(cmd.Use).NotTo(Equal("")) + Expect(cmd.Short).NotTo(Equal("")) + }) + }) + Describe("run", func() { + It("prints the correct version info", func() { + r, w, _ := os.Pipe() + tmp := os.Stdout + defer func() { + os.Stdout = tmp + }() + os.Stdout = w + go func() { + run() + w.Close() + }() + stdout, err := ioutil.ReadAll(r) + Expect(err).To(BeNil()) + stdoutString := string(stdout) + version := ver.GitVersion + if version == "unknown" { + version = ver.Version + } + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("version: %q", version))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("commit: %q", ver.GitCommit))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("kubernetes version: %q", ver.KubernetesVersion))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("go version: %q", ver.GoVersion))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("GOOS: %q", runtime.GOOS))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("GOARCH: %q", runtime.GOARCH))) + }) + }) +}) diff --git a/internal/cmd/helm-operator/version/version_suite_test.go b/internal/cmd/helm-operator/version/version_suite_test.go new file mode 100644 index 0000000000..67474ae807 --- /dev/null +++ b/internal/cmd/helm-operator/version/version_suite_test.go @@ -0,0 +1,27 @@ +// Copyright 2020 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package version_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +func TestVersion(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Version Cmd Suite") +} diff --git a/internal/cmd/operator-sdk/version/cmd.go b/internal/cmd/operator-sdk/version/cmd.go index 560314e9c1..c3b1c77989 100644 --- a/internal/cmd/operator-sdk/version/cmd.go +++ b/internal/cmd/operator-sdk/version/cmd.go @@ -16,10 +16,11 @@ package version import ( "fmt" - - ver "github.com/operator-framework/operator-sdk/version" + "runtime" "github.com/spf13/cobra" + + ver "github.com/operator-framework/operator-sdk/version" ) func NewCmd() *cobra.Command { @@ -38,6 +39,6 @@ func run() { if version == "unknown" { version = ver.Version } - fmt.Printf("operator-sdk version: %q, commit: %q, kubernetes version: %q, go version: %q\n", - version, ver.GitCommit, ver.KubernetesVersion, ver.GoVersion) + fmt.Printf("operator-sdk version: %q, commit: %q, kubernetes version: %q, go version: %q, GOOS: %q, GOARCH: %q\n", + version, ver.GitCommit, ver.KubernetesVersion, ver.GoVersion, runtime.GOOS, runtime.GOARCH) } diff --git a/internal/cmd/operator-sdk/version/cmd_test.go b/internal/cmd/operator-sdk/version/cmd_test.go index fdefa263cf..7028b323fb 100644 --- a/internal/cmd/operator-sdk/version/cmd_test.go +++ b/internal/cmd/operator-sdk/version/cmd_test.go @@ -18,9 +18,11 @@ import ( "fmt" "io/ioutil" "os" + "runtime" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + ver "github.com/operator-framework/operator-sdk/version" ) @@ -56,6 +58,8 @@ var _ = Describe("Running a version command", func() { Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("commit: %q", ver.GitCommit))) Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("kubernetes version: %q", ver.KubernetesVersion))) Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("go version: %q", ver.GoVersion))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("GOOS: %q", runtime.GOOS))) + Expect(stdoutString).To(ContainSubstring(fmt.Sprintf("GOARCH: %q", runtime.GOARCH))) }) }) }) diff --git a/internal/helm/flags/flag.go b/internal/helm/flags/flag.go index ec68de5d39..e272a8b4bf 100644 --- a/internal/helm/flags/flag.go +++ b/internal/helm/flags/flag.go @@ -19,8 +19,6 @@ import ( "time" "github.com/spf13/pflag" - - "github.com/operator-framework/operator-sdk/internal/log/zap" ) // Flags - Options to be used by a helm operator @@ -36,7 +34,6 @@ type Flags struct { // AddTo - Add the helm operator flags to the the flagset func (f *Flags) AddTo(flagSet *pflag.FlagSet) { - flagSet.AddFlagSet(zap.FlagSet()) flagSet.DurationVar(&f.ReconcilePeriod, "reconcile-period", time.Minute, diff --git a/internal/log/zap/flags.go b/internal/log/zap/flags.go deleted file mode 100644 index ac987cec5f..0000000000 --- a/internal/log/zap/flags.go +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright 2019 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package zap - -import ( - "flag" - "fmt" - "strconv" - "strings" - - "github.com/spf13/pflag" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "k8s.io/klog" -) - -const ( - logLevelDebug string = "debug" - logLevelInfo string = "info" - logLevelError string = "error" - logLevelPanic string = "panic" -) - -var ( - zapFlagSet *pflag.FlagSet - - development bool - encoderVal encoderValue - levelVal levelValue - sampleVal sampleValue - timeEncodingVal timeEncodingValue - stacktraceLevel stackLevelValue -) - -func init() { - zapFlagSet = pflag.NewFlagSet("zap", pflag.ExitOnError) - zapFlagSet.BoolVar(&development, "zap-devel", false, "Enable zap development mode"+ - " (changes defaults to console encoder, debug log level, disables sampling and stacktrace from 'warning' level)") - zapFlagSet.Var(&encoderVal, "zap-encoder", "Zap log encoding ('json' or 'console')") - zapFlagSet.Var(&levelVal, "zap-level", "Zap log level (one of 'debug', 'info', 'error' or any integer value > 0)") - zapFlagSet.Var(&sampleVal, "zap-sample", - "Enable zap log sampling. Sampling will be disabled for integer log levels > 1") - zapFlagSet.Var(&timeEncodingVal, "zap-time-encoding", - "Sets the zap time format ('epoch', 'millis', 'nano', or 'iso8601')") - zapFlagSet.Var(&stacktraceLevel, "zap-stacktrace-level", - "Set the minimum log level that triggers stacktrace generation") -} - -// FlagSet - The zap logging flagset. -func FlagSet() *pflag.FlagSet { - return zapFlagSet -} - -type encoderConfigFunc func(*zapcore.EncoderConfig) - -type encoderValue struct { - set bool - newEncoder func(...encoderConfigFunc) zapcore.Encoder - str string -} - -func (v *encoderValue) Set(e string) error { - v.set = true - switch e { - case "json": - v.newEncoder = newJSONEncoder - case "console": - v.newEncoder = newConsoleEncoder - default: - return fmt.Errorf("unknown encoder \"%s\"", e) - } - v.str = e - return nil -} - -func (v encoderValue) String() string { - return v.str -} - -func (v encoderValue) Type() string { - return "encoder" -} - -func newJSONEncoder(ecfs ...encoderConfigFunc) zapcore.Encoder { - encoderConfig := zap.NewProductionEncoderConfig() - for _, f := range ecfs { - f(&encoderConfig) - } - return zapcore.NewJSONEncoder(encoderConfig) -} - -func newConsoleEncoder(ecfs ...encoderConfigFunc) zapcore.Encoder { - encoderConfig := zap.NewDevelopmentEncoderConfig() - for _, f := range ecfs { - f(&encoderConfig) - } - return zapcore.NewConsoleEncoder(encoderConfig) -} - -type levelValue struct { - set bool - level zapcore.Level -} - -func (v *levelValue) Set(l string) error { - v.set = true - lower := strings.ToLower(l) - var lvl int - var err error - switch lower { - case logLevelDebug: - lvl = -1 - case logLevelInfo: - lvl = 0 - case logLevelError: - lvl = 2 - default: - if lvl, err = parseIntLogLevel(lower); err != nil { - return err - } - } - - v.level = zapcore.Level(int8(lvl)) - // If log level is greater than debug, set glog/klog level to that level. - if lvl < -3 { - fs := flag.NewFlagSet("", flag.ContinueOnError) - klog.InitFlags(fs) - err := fs.Set("v", fmt.Sprintf("%v", -1*lvl)) - if err != nil { - return err - } - } - return nil -} - -func (v levelValue) String() string { - return v.level.String() -} - -func (v levelValue) Type() string { - return "level" -} - -type stackLevelValue struct { - set bool - level zapcore.Level -} - -func (v *stackLevelValue) Set(l string) error { - v.set = true - lower := strings.ToLower(l) - var lvl int - var err error - switch lower { - case logLevelDebug: - lvl = -1 - case logLevelInfo: - lvl = 0 - case logLevelError: - lvl = 2 - case logLevelPanic: - lvl = 4 - default: - if lvl, err = parseIntLogLevel(lower); err != nil { - return err - } - } - - v.level = zapcore.Level(int8(lvl)) - return nil -} - -func (v stackLevelValue) String() string { - if v.set { - return v.level.String() - } - - return logLevelError -} - -func (v stackLevelValue) Type() string { - return "level" -} - -func parseIntLogLevel(l string) (int, error) { - var lvl int - i, err := strconv.Atoi(l) - if err != nil { - return lvl, fmt.Errorf("invalid log level \"%s\"", l) - } - - if i > 0 { - lvl = -1 * i - } else { - return lvl, fmt.Errorf("invalid log level \"%s\"", l) - } - return lvl, nil -} - -type sampleValue struct { - set bool - sample bool -} - -func (v *sampleValue) Set(s string) error { - var err error - v.set = true - v.sample, err = strconv.ParseBool(s) - return err -} - -func (v sampleValue) String() string { - return strconv.FormatBool(v.sample) -} - -func (v sampleValue) IsBoolFlag() bool { - return true -} - -func (v sampleValue) Type() string { - return "sample" -} - -type timeEncodingValue struct { - set bool - timeEncoder zapcore.TimeEncoder - str string -} - -func (v *timeEncodingValue) Set(s string) error { - v.set = true - - // As of zap v1.9.1, UnmarshalText does not return an error. Instead, it - // uses the epoch time encoding when unknown strings are unmarshalled. - // - // Set s to "epoch" if it doesn't match one of the known formats, so that - // it aligns with the default time encoder function. - // - // TODO: remove this entire switch statement if UnmarshalText is ever - // refactored to return an error. - switch s { - case "iso8601", "ISO8601", "millis", "nanos": - default: - s = "epoch" - } - - v.str = s - return v.timeEncoder.UnmarshalText([]byte(s)) -} - -func (v timeEncodingValue) String() string { - return v.str -} - -func (v timeEncodingValue) IsBoolFlag() bool { - return false -} - -func (v timeEncodingValue) Type() string { - return "timeEncoding" -} - -func withTimeEncoding(te zapcore.TimeEncoder) encoderConfigFunc { - return func(ec *zapcore.EncoderConfig) { - ec.EncodeTime = te - } -} diff --git a/internal/log/zap/flags_test.go b/internal/log/zap/flags_test.go deleted file mode 100644 index 6f7d64e039..0000000000 --- a/internal/log/zap/flags_test.go +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright 2019 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package zap - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.uber.org/zap/zapcore" -) - -func TestLevel(t *testing.T) { - testCases := []struct { - name string - input string - expStr string - expSet bool - expLevel zapcore.Level - shouldErr bool - }{ - { - name: "debug level set", - input: "debug", - expStr: "debug", - expSet: true, - expLevel: zapcore.DebugLevel, - }, - { - name: "info level set", - input: "info", - expStr: "info", - expSet: true, - expLevel: zapcore.InfoLevel, - }, - { - name: "error level set", - input: "error", - expStr: "error", - expSet: true, - expLevel: zapcore.ErrorLevel, - }, - { - name: "negative number should error", - input: "-10", - shouldErr: true, - expSet: false, - }, - { - name: "positive number level results in negative level set", - input: "8", - expStr: "Level(-8)", - expSet: true, - expLevel: zapcore.Level(int8(-8)), - }, - { - name: "non-integer should cause error", - input: "invalid", - shouldErr: true, - expSet: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - lvl := levelValue{} - err := lvl.Set(tc.input) - if err != nil && !tc.shouldErr { - t.Fatalf("Unknown error - %v", err) - } - if err != nil && tc.shouldErr { - return - } - assert.Equal(t, tc.expSet, lvl.set) - assert.Equal(t, tc.expLevel, lvl.level) - assert.Equal(t, "level", lvl.Type()) - assert.Equal(t, tc.expStr, lvl.String()) - }) - } -} - -func TestStackTraceLevel(t *testing.T) { - testCases := []struct { - name string - input string - expStr string - expSet bool - expLevel zapcore.Level - shouldErr bool - }{ - { - name: "debug level set", - input: "debug", - expStr: "debug", - expSet: true, - expLevel: zapcore.DebugLevel, - }, - { - name: "info level set", - input: "info", - expStr: "info", - expSet: true, - expLevel: zapcore.InfoLevel, - }, - { - name: "error level set", - input: "error", - expStr: "error", - expSet: true, - expLevel: zapcore.ErrorLevel, - }, - { - name: "panic level set", - input: "panic", - expStr: "panic", - expSet: true, - expLevel: zapcore.PanicLevel, - }, - { - name: "negative number should error", - input: "-10", - shouldErr: true, - expSet: false, - }, - { - name: "positive number level results in negative level set", - input: "8", - expStr: "Level(-8)", - expSet: true, - expLevel: zapcore.Level(int8(-8)), - }, - { - name: "non-integer should cause error", - input: "invalid", - shouldErr: true, - expSet: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - stackLvl := stackLevelValue{} - err := stackLvl.Set(tc.input) - if err != nil && !tc.shouldErr { - t.Fatalf("Unknown error - %v", err) - } - if err != nil && tc.shouldErr { - return - } - assert.Equal(t, tc.expSet, stackLvl.set) - assert.Equal(t, tc.expLevel, stackLvl.level) - assert.Equal(t, "level", stackLvl.Type()) - assert.Equal(t, tc.expStr, stackLvl.String()) - }) - } -} - -func TestSample(t *testing.T) { - testCases := []struct { - name string - input string - expStr string - expSet bool - expValue bool - shouldErr bool - }{ - { - name: "enable sampling", - input: "true", - expStr: "true", - expSet: true, - expValue: true, - }, - { - name: "disable sampling", - input: "false", - expStr: "false", - expSet: true, - expValue: false, - }, - { - name: "invalid input", - input: "notaboolean", - shouldErr: true, - expSet: false, - }, - { - name: "UPPERCASE true input", - input: "true", - expStr: "true", - expSet: true, - expValue: true, - }, - { - name: "MiXeDCase true input", - input: "tRuE", - shouldErr: true, - expSet: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - sample := sampleValue{} - err := sample.Set(tc.input) - if err != nil && !tc.shouldErr { - t.Fatalf("Unknown error - %v", err) - } - if err != nil && tc.shouldErr { - return - } - assert.Equal(t, tc.expSet, sample.set) - assert.Equal(t, tc.expValue, sample.sample) - assert.Equal(t, "sample", sample.Type()) - assert.Equal(t, tc.expStr, sample.String()) - assert.True(t, sample.IsBoolFlag()) - }) - } -} -func TestEncoder(t *testing.T) { - testCases := []struct { - name string - input string - expEncoder zapcore.Encoder - expStr string - expSet bool - shouldErr bool - }{ - { - name: "json encoder", - input: "json", - expStr: "json", - expSet: true, - expEncoder: newJSONEncoder(), - }, - { - name: "console encoder", - input: "console", - expStr: "console", - expSet: true, - expEncoder: newConsoleEncoder(), - }, - { - name: "unknown encoder", - input: "unknown", - shouldErr: true, - expEncoder: nil, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - encoder := encoderValue{} - err := encoder.Set(tc.input) - if err != nil && !tc.shouldErr { - t.Fatalf("Unknown error - %v", err) - } - if err != nil && tc.shouldErr { - return - } - assert.Equal(t, tc.expSet, encoder.set) - assert.Equal(t, "encoder", encoder.Type()) - assert.Equal(t, tc.expStr, encoder.String()) - assert.ObjectsAreEqual(tc.expEncoder, encoder.newEncoder) - }) - } -} -func TestTimeEncoder(t *testing.T) { - testCases := []struct { - name string - input string - expStr string - expSet bool - shouldErr bool - }{ - { - name: "iso8601 time encoding", - input: "iso8601", - expStr: "iso8601", - expSet: true, - }, - { - name: "millis time encoding", - input: "millis", - expStr: "millis", - expSet: true, - }, - { - name: "nanos time encoding", - input: "nanos", - expStr: "nanos", - expSet: true, - }, - { - name: "epoch time encoding", - input: "epoch", - expStr: "epoch", - expSet: true, - }, - { - name: "invalid time encoding", - input: "invalid", - expStr: "epoch", - expSet: true, - shouldErr: false, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - te := timeEncodingValue{} - err := te.Set(tc.input) - if err != nil && !tc.shouldErr { - t.Fatalf("Unknown error - %v", err) - } - if tc.shouldErr { - assert.Error(t, err) - } - assert.Equal(t, tc.expSet, te.set) - assert.Equal(t, "timeEncoding", te.Type()) - assert.Equal(t, tc.expStr, te.String()) - }) - } -} diff --git a/internal/log/zap/logger.go b/internal/log/zap/logger.go deleted file mode 100644 index f8de2450b9..0000000000 --- a/internal/log/zap/logger.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2019 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package zap - -import ( - "io" - "os" - "time" - - "github.com/go-logr/logr" - "github.com/go-logr/zapr" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - zapf "sigs.k8s.io/controller-runtime/pkg/log/zap" -) - -func Logger() logr.Logger { - return LoggerTo(os.Stderr) -} - -func LoggerTo(destWriter io.Writer) logr.Logger { - conf := getConfig() - return createLogger(conf, destWriter) -} - -func createLogger(conf config, destWriter io.Writer) logr.Logger { - syncer := zapcore.AddSync(destWriter) - - conf.encoder = &zapf.KubeAwareEncoder{Encoder: conf.encoder, Verbose: conf.level.Level() < 0} - if conf.sample { - conf.opts = append(conf.opts, zap.WrapCore(func(core zapcore.Core) zapcore.Core { - return zapcore.NewSampler(core, time.Second, 100, 100) - })) - } - conf.opts = append(conf.opts, zap.AddCallerSkip(1), zap.ErrorOutput(syncer)) - log := zap.New(zapcore.NewCore(conf.encoder, syncer, conf.level)) - log = log.WithOptions(conf.opts...) - return zapr.NewLogger(log) -} - -type config struct { - encoder zapcore.Encoder - level zap.AtomicLevel - opts []zap.Option - stackTraceLevel zapcore.Level - sample bool -} - -func getConfig() config { - var c config - - var newEncoder func(...encoderConfigFunc) zapcore.Encoder - - // Set the defaults depending on the log mode (development vs. production) - if development { - newEncoder = newConsoleEncoder - c.level = zap.NewAtomicLevelAt(zap.DebugLevel) - c.opts = append(c.opts, zap.Development()) - c.sample = false - c.stackTraceLevel = zap.WarnLevel - } else { - newEncoder = newJSONEncoder - c.level = zap.NewAtomicLevelAt(zap.InfoLevel) - c.sample = true - c.stackTraceLevel = zap.ErrorLevel - } - - // Override the defaults if the flags were set explicitly on the command line - if stacktraceLevel.set { - c.stackTraceLevel = stacktraceLevel.level - } - c.opts = append(c.opts, zap.AddStacktrace(c.stackTraceLevel)) - - var ecfs []encoderConfigFunc - if encoderVal.set { - newEncoder = encoderVal.newEncoder - } - if timeEncodingVal.set { - ecfs = append(ecfs, withTimeEncoding(timeEncodingVal.timeEncoder)) - } - - c.encoder = newEncoder(ecfs...) - - if levelVal.set { - c.level = zap.NewAtomicLevelAt(levelVal.level) - } - if sampleVal.set { - c.sample = sampleVal.sample - } - - // Disable sampling when we are in debug mode. Otherwise, this will - // cause index out of bounds errors in the sampling code. - if c.level.Level() < -1 { - c.sample = false - } - return c -} diff --git a/internal/log/zap/logger_test.go b/internal/log/zap/logger_test.go deleted file mode 100644 index 68b98b77b7..0000000000 --- a/internal/log/zap/logger_test.go +++ /dev/null @@ -1,336 +0,0 @@ -// Copyright 2019 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package zap - -import ( - "bytes" - "testing" - "time" - - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - - "github.com/stretchr/testify/assert" -) - -func TestGetConfig(t *testing.T) { - var opts []zap.Option - type fields struct { - name string - inEncoder *encoderValue - inLevel *levelValue - inSample *sampleValue - inTimeEncoding *timeEncodingValue - expected *config - inDevel bool - inStackTraceLevel *stackLevelValue - } - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - name: "development on", - fields: fields{inDevel: true, - inEncoder: &encoderValue{ - set: false, - }, - inLevel: &levelValue{ - set: false, - }, - inSample: &sampleValue{ - set: false, - }, - inTimeEncoding: &timeEncodingValue{ - set: false, - }, - inStackTraceLevel: &stackLevelValue{ - set: false, - }, - expected: &config{ - encoder: newConsoleEncoder(), - level: zap.NewAtomicLevelAt(zap.DebugLevel), - opts: append(opts, zap.Development(), zap.AddStacktrace(zap.ErrorLevel)), - sample: false, - }}, - }, - { - name: "development off", - fields: fields{inDevel: false, - inEncoder: &encoderValue{ - set: false, - }, - inLevel: &levelValue{ - set: false, - }, - inSample: &sampleValue{ - set: false, - }, - inTimeEncoding: &timeEncodingValue{ - set: false, - }, - inStackTraceLevel: &stackLevelValue{ - set: false, - }, - expected: &config{ - encoder: newJSONEncoder(), - level: zap.NewAtomicLevelAt(zap.InfoLevel), - opts: append(opts, zap.AddStacktrace(zap.WarnLevel)), - sample: true, - }}, - }, - { - name: "set encoder", - fields: fields{inDevel: false, - inEncoder: &encoderValue{ - set: true, - newEncoder: newConsoleEncoder, - }, - inLevel: &levelValue{ - set: false, - }, - inSample: &sampleValue{ - set: false, - }, - inTimeEncoding: &timeEncodingValue{ - set: false, - }, - inStackTraceLevel: &stackLevelValue{ - set: false, - }, - expected: &config{ - encoder: newConsoleEncoder(), - level: zap.NewAtomicLevelAt(zap.InfoLevel), - opts: append(opts, zap.AddStacktrace(zap.WarnLevel)), - sample: true, - }}, - }, - { - fields: fields{name: "set level using level constant", - inDevel: false, - inEncoder: &encoderValue{ - set: false, - }, - inLevel: &levelValue{ - set: true, - level: zapcore.ErrorLevel, - }, - inSample: &sampleValue{ - set: false, - }, - inTimeEncoding: &timeEncodingValue{ - set: false, - }, - inStackTraceLevel: &stackLevelValue{ - set: false, - }, - expected: &config{ - encoder: newJSONEncoder(), - level: zap.NewAtomicLevelAt(zap.ErrorLevel), - opts: append(opts, zap.AddStacktrace(zap.WarnLevel)), - sample: true, - }}, - }, - { - name: "set level using custom level", - fields: fields{inDevel: false, - inEncoder: &encoderValue{ - set: false, - }, - inLevel: &levelValue{ - set: true, - level: zapcore.Level(-10), - }, - inSample: &sampleValue{ - set: false, - }, - inTimeEncoding: &timeEncodingValue{ - set: false, - }, - inStackTraceLevel: &stackLevelValue{ - set: false, - }, - expected: &config{ - encoder: newJSONEncoder(), - level: zap.NewAtomicLevelAt(zapcore.Level(-10)), - opts: append(opts, zap.AddStacktrace(zap.WarnLevel)), - sample: false, - }}, - }, - { - name: "set sampling", - fields: fields{inDevel: false, - inEncoder: &encoderValue{ - set: false, - }, - inLevel: &levelValue{ - set: false, - }, - inSample: &sampleValue{ - set: true, - sample: false, - }, - inTimeEncoding: &timeEncodingValue{ - set: false, - }, - inStackTraceLevel: &stackLevelValue{ - set: false, - }, - expected: &config{ - encoder: newJSONEncoder(), - level: zap.NewAtomicLevelAt(zap.InfoLevel), - opts: append(opts, zap.AddStacktrace(zap.WarnLevel)), - sample: false, - }}, - }, - { - name: "set level using custom level, sample override not possible", - fields: fields{inDevel: false, - inEncoder: &encoderValue{ - set: false, - }, - inLevel: &levelValue{ - set: true, - level: zapcore.Level(-10), - }, - inSample: &sampleValue{ - set: true, - sample: true, - }, - inTimeEncoding: &timeEncodingValue{ - set: false, - }, - inStackTraceLevel: &stackLevelValue{ - set: false, - }, - expected: &config{ - encoder: newJSONEncoder(), - level: zap.NewAtomicLevelAt(zapcore.Level(-10)), - opts: append(opts, zap.AddStacktrace(zap.WarnLevel)), - sample: false, - }}, - }, - { - fields: fields{name: "set time encoding", - inDevel: false, - inEncoder: &encoderValue{ - set: false, - }, - inLevel: &levelValue{ - set: false, - }, - inSample: &sampleValue{ - set: false, - }, - inTimeEncoding: &timeEncodingValue{ - set: true, - timeEncoder: zapcore.EpochMillisTimeEncoder, - }, - inStackTraceLevel: &stackLevelValue{ - set: false, - }, - expected: &config{ - encoder: newJSONEncoder(withTimeEncoding(zapcore.EpochMillisTimeEncoder)), - level: zap.NewAtomicLevelAt(zap.InfoLevel), - opts: append(opts, zap.AddStacktrace(zap.WarnLevel)), - sample: true, - }}, - }, - { - name: "set stacktrace generation on 'panic' level only", - fields: fields{ - inDevel: false, - inEncoder: &encoderValue{ - set: false, - }, - inLevel: &levelValue{ - set: true, - level: zapcore.Level(-10), - }, - inSample: &sampleValue{ - set: true, - sample: true, - }, - inTimeEncoding: &timeEncodingValue{ - set: false, - }, - inStackTraceLevel: &stackLevelValue{ - set: true, - level: zapcore.Level(zapcore.PanicLevel), - }, - expected: &config{ - encoder: newJSONEncoder(), - level: zap.NewAtomicLevelAt(zapcore.Level(-10)), - opts: append(opts, zap.AddStacktrace(zap.PanicLevel)), - sample: false, - }}, - }, - } - - entry := zapcore.Entry{ - Level: levelVal.level, - Time: time.Now(), - LoggerName: "TestLogger", - Message: "Test message", - Caller: zapcore.EntryCaller{ - Defined: true, - File: "dummy_file.go", - Line: 10, - }, - Stack: "Sample stack", - } - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - development = tc.fields.inDevel - encoderVal = *tc.fields.inEncoder - levelVal = *tc.fields.inLevel - sampleVal = *tc.fields.inSample - timeEncodingVal = *tc.fields.inTimeEncoding - stacktraceLevel = *tc.fields.inStackTraceLevel - - cfg := getConfig() - assert.Equal(t, tc.fields.expected.level, cfg.level) - assert.Equal(t, len(tc.fields.expected.opts), len(cfg.opts)) - assert.Equal(t, tc.fields.expected.sample, cfg.sample) - - // Test that the encoder returned by getConfig encodes an entry - // the same way that the expected encoder does. In addition to - // testing that the correct entry encoding (json vs. console) is - // used, this also tests that the correct time encoding is used. - expectedEncoderOut, err := tc.fields.expected.encoder.EncodeEntry(entry, []zapcore.Field{{Key: "fieldKey", - Type: zapcore.StringType, String: "fieldValue"}}) - if err != nil { - t.Fatalf("Unexpected error encoding entry with expected encoder: %s", err) - } - actualEncoderOut, err := cfg.encoder.EncodeEntry(entry, []zapcore.Field{{Key: "fieldKey", - Type: zapcore.StringType, String: "fieldValue"}}) - if err != nil { - t.Fatalf("Unexpected error encoding entry with actual encoder: %s", err) - } - assert.Equal(t, expectedEncoderOut.String(), actualEncoderOut.String()) - - // This test helps ensure that we disable sampling for verbose log - // levels. Logging at V(10) should never panic, which would happen - // if sampling is enabled at this level. - assert.NotPanics(t, func() { - out := &bytes.Buffer{} - dalog := createLogger(cfg, out) - dalog.V(10).Info("This should not panic") - }) - }) - } -} diff --git a/internal/plugins/ansible/v1/scaffolds/internal/templates/makefile.go b/internal/plugins/ansible/v1/scaffolds/internal/templates/makefile.go index f27abc67fd..20a7d3587a 100644 --- a/internal/plugins/ansible/v1/scaffolds/internal/templates/makefile.go +++ b/internal/plugins/ansible/v1/scaffolds/internal/templates/makefile.go @@ -74,7 +74,7 @@ all: docker-build # Run against the configured Kubernetes cluster in ~/.kube/config run: ansible-operator - $(ANSIBLE_OPERATOR) + $(ANSIBLE_OPERATOR) run # Install CRDs into a cluster install: kustomize diff --git a/internal/plugins/helm/v1/scaffolds/internal/templates/makefile.go b/internal/plugins/helm/v1/scaffolds/internal/templates/makefile.go index 66656c139c..befd35f4d7 100644 --- a/internal/plugins/helm/v1/scaffolds/internal/templates/makefile.go +++ b/internal/plugins/helm/v1/scaffolds/internal/templates/makefile.go @@ -74,7 +74,7 @@ all: docker-build # Run against the configured Kubernetes cluster in ~/.kube/config run: helm-operator - $(HELM_OPERATOR) + $(HELM_OPERATOR) run # Install CRDs into a cluster install: kustomize