diff --git a/commands/monitoring.go b/commands/monitoring.go deleted file mode 100644 index 8e9c6a26..00000000 --- a/commands/monitoring.go +++ /dev/null @@ -1,34 +0,0 @@ -// percona-everest-cli -// Copyright (C) 2023 Percona LLC -// -// 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 commands ... -package commands - -import ( - "github.com/spf13/cobra" - "go.uber.org/zap" - - "github.com/percona/percona-everest-cli/commands/monitoring" -) - -func newMonitoringCmd(l *zap.SugaredLogger) *cobra.Command { - cmd := &cobra.Command{ - Use: "monitoring", - } - - cmd.AddCommand(monitoring.NewMonitoringCmd(l)) - - return cmd -} diff --git a/commands/monitoring/enable.go b/commands/monitoring/enable.go deleted file mode 100644 index e2641836..00000000 --- a/commands/monitoring/enable.go +++ /dev/null @@ -1,98 +0,0 @@ -// percona-everest-cli -// Copyright (C) 2023 Percona LLC -// -// 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 monitoring holds commands for monitoring command. -package monitoring - -import ( - "os" - - "github.com/spf13/cobra" - "github.com/spf13/viper" - "go.uber.org/zap" - - "github.com/percona/percona-everest-cli/pkg/monitoring" - "github.com/percona/percona-everest-cli/pkg/output" -) - -// NewMonitoringCmd returns a new enable monitoring command. -func NewMonitoringCmd(l *zap.SugaredLogger) *cobra.Command { - cmd := &cobra.Command{ - Use: "enable", - Run: func(cmd *cobra.Command, args []string) { - initMonitoringViperFlags(cmd) - - c, err := parseResetConfig() - if err != nil { - os.Exit(1) - } - - command, err := monitoring.NewMonitoring(*c, l) - if err != nil { - output.PrintError(err, l) - os.Exit(1) - } - - err = command.Run(cmd.Context()) - if err != nil { - output.PrintError(err, l) - os.Exit(1) - } - }, - } - - initMonitoringFlags(cmd) - - return cmd -} - -func initMonitoringFlags(cmd *cobra.Command) { - cmd.Flags().StringP("kubeconfig", "k", "~/.kube/config", "Path to a kubeconfig") - cmd.Flags().String("namespace", "percona-everest", "Namespace where Percona Everest is deployed") - cmd.Flags().Bool("skip-wizard", false, "Skip configuration wizard") - cmd.Flags().String("everest-url", "", "A URL to connect to Everest") - cmd.Flags().String("everest-token", "", "A Token to authenticate in Everest") - cmd.Flags().String("instance-name", "", - "Monitoring instance name from Everest. If defined, other monitoring configuration is ignored", - ) - cmd.Flags().String("new-instance-name", "", - "Name for a new monitoring instance if it's going to be created", - ) - cmd.Flags().String("type", "pmm", "Monitoring type") - cmd.Flags().String("pmm.endpoint", "http://127.0.0.1", "PMM endpoint URL") - cmd.Flags().String("pmm.username", "admin", "PMM username") - cmd.Flags().String("pmm.password", "", "PMM password") -} - -func initMonitoringViperFlags(cmd *cobra.Command) { - viper.BindEnv("kubeconfig") //nolint:errcheck,gosec - viper.BindPFlag("skip-wizard", cmd.Flags().Lookup("skip-wizard")) //nolint:errcheck,gosec - viper.BindPFlag("kubeconfig", cmd.Flags().Lookup("kubeconfig")) //nolint:errcheck,gosec - viper.BindPFlag("namespace", cmd.Flags().Lookup("namespace")) //nolint:errcheck,gosec - viper.BindPFlag("everest-url", cmd.Flags().Lookup("everest-url")) //nolint:errcheck,gosec - viper.BindPFlag("everest-token", cmd.Flags().Lookup("everest-token")) //nolint:errcheck,gosec - viper.BindPFlag("instance-name", cmd.Flags().Lookup("instance-name")) //nolint:errcheck,gosec - viper.BindPFlag("new-instance-name", cmd.Flags().Lookup("new-instance-name")) //nolint:errcheck,gosec - viper.BindPFlag("type", cmd.Flags().Lookup("type")) //nolint:errcheck,gosec - viper.BindPFlag("pmm.endpoint", cmd.Flags().Lookup("pmm.endpoint")) //nolint:errcheck,gosec - viper.BindPFlag("pmm.username", cmd.Flags().Lookup("pmm.username")) //nolint:errcheck,gosec - viper.BindPFlag("pmm.password", cmd.Flags().Lookup("pmm.password")) //nolint:errcheck,gosec -} - -func parseResetConfig() (*monitoring.Config, error) { - c := &monitoring.Config{} - err := viper.Unmarshal(c) - return c, err -} diff --git a/commands/root.go b/commands/root.go index cbb78f3b..7c87b2a5 100644 --- a/commands/root.go +++ b/commands/root.go @@ -40,7 +40,6 @@ func NewRootCmd(l *zap.SugaredLogger) *cobra.Command { // rootCmd.AddCommand(newProvisionCmd(l)) // rootCmd.AddCommand(newListCmd(l)) // rootCmd.AddCommand(newDeleteCmd(l)) - rootCmd.AddCommand(newMonitoringCmd(l)) rootCmd.AddCommand(newTokenCmd(l)) rootCmd.AddCommand(newVersionCmd(l)) rootCmd.AddCommand(newUpgradeCmd(l)) diff --git a/data/crds/olm/percona-dbaas-catalog.yaml b/data/crds/olm/everest-catalog.yaml similarity index 77% rename from data/crds/olm/percona-dbaas-catalog.yaml rename to data/crds/olm/everest-catalog.yaml index c3895b16..f88ed1d9 100644 --- a/data/crds/olm/percona-dbaas-catalog.yaml +++ b/data/crds/olm/everest-catalog.yaml @@ -1,10 +1,10 @@ apiVersion: operators.coreos.com/v1alpha1 kind: CatalogSource metadata: - name: percona-everest-catalog + name: everest-catalog namespace: olm spec: - displayName: Percona Everest Catalog + displayName: Everest Catalog publisher: Percona sourceType: grpc grpcPodConfig: diff --git a/go.mod b/go.mod index ff61ea3d..dd5ebfe2 100644 --- a/go.mod +++ b/go.mod @@ -9,21 +9,21 @@ require ( github.com/hashicorp/go-version v1.6.0 github.com/operator-framework/api v0.20.0 github.com/operator-framework/operator-lifecycle-manager v0.26.0 - github.com/percona/everest-operator v0.6.0-dev1.0.20240125162053-e43000fbf0b8 - github.com/percona/percona-everest-backend v0.5.1-0.20240125151620-f38d8bb174fa + github.com/percona/everest-operator v0.6.0-dev1.0.20240207102146-b96be266f4d9 + github.com/percona/percona-everest-backend v0.5.1-0.20240205094045-e23451782e1a github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.1 github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.26.0 - golang.org/x/crypto v0.17.0 + golang.org/x/crypto v0.18.0 golang.org/x/sync v0.5.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools v2.2.0+incompatible - k8s.io/api v0.29.0 + k8s.io/api v0.29.1 k8s.io/apiextensions-apiserver v0.29.0 - k8s.io/apimachinery v0.29.0 - k8s.io/cli-runtime v0.29.0 - k8s.io/client-go v0.29.0 + k8s.io/apimachinery v0.29.1 + k8s.io/cli-runtime v0.29.1 + k8s.io/client-go v0.29.1 k8s.io/kubectl v0.29.0 sigs.k8s.io/controller-runtime v0.16.3 ) @@ -34,7 +34,7 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.1 // indirect github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect - github.com/aws/aws-sdk-go v1.49.5 // indirect + github.com/aws/aws-sdk-go v1.50.9 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/bshuster-repo/logrus-logstash-hook v1.0.0 // indirect github.com/cert-manager/cert-manager v1.12.4 // indirect @@ -45,13 +45,13 @@ require ( github.com/evanphx/json-patch/v5 v5.7.0 // indirect github.com/flosch/pongo2/v6 v6.0.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/getkin/kin-openapi v0.122.0 // indirect + github.com/getkin/kin-openapi v0.123.0 // indirect github.com/go-errors/errors v1.5.0 // indirect github.com/go-ini/ini v1.67.0 // indirect github.com/go-logr/logr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.20.0 // indirect + github.com/go-openapi/jsonpointer v0.20.2 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-openapi/swag v0.22.8 // indirect github.com/go-sql-driver/mysql v1.7.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -62,7 +62,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/google/uuid v1.4.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/h2non/filetype v1.1.1 // indirect @@ -81,7 +81,7 @@ require ( github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/minio/minio-go v6.0.14+incompatible // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -95,7 +95,7 @@ require ( github.com/montanaflynn/stats v0.6.6 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect - github.com/oapi-codegen/runtime v1.1.0 // indirect + github.com/oapi-codegen/runtime v1.1.1 // indirect github.com/onsi/gomega v1.30.0 // indirect github.com/operator-framework/operator-registry v1.30.1 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect @@ -131,11 +131,11 @@ require ( go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/mod v0.13.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.15.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/term v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/go.sum b/go.sum index 599970eb..e785700a 100644 --- a/go.sum +++ b/go.sum @@ -63,8 +63,8 @@ github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:l github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go v1.49.5 h1:y2yfBlwjPDi3/sBVKeznYEdDy6wIhjA2L5NCBMLUIYA= -github.com/aws/aws-sdk-go v1.49.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.50.9 h1:yX66aKnEtRc/uNV/1EH8CudRT5aLwVwcSwTBphuVPt8= +github.com/aws/aws-sdk-go v1.50.9/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -186,8 +186,8 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/garyburd/redigo v1.6.0 h1:0VruCpn7yAIIu7pWVClQC8wxCJEcG3nyzpMSHKi1PQc= github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/getkin/kin-openapi v0.122.0 h1:WB9Jbl0Hp/T79/JF9xlSW5Kl9uYdk/AWD0yAd9HOM10= -github.com/getkin/kin-openapi v0.122.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= +github.com/getkin/kin-openapi v0.123.0 h1:zIik0mRwFNLyvtXK274Q6ut+dPh6nlxBp0x7mNrPhs8= +github.com/getkin/kin-openapi v0.123.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -222,8 +222,8 @@ github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwds github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= -github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= +github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= +github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= @@ -254,8 +254,8 @@ github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw= +github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= @@ -327,14 +327,14 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 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/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y= +github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.1.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= @@ -344,8 +344,8 @@ github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRid github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -450,8 +450,8 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= @@ -503,8 +503,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oapi-codegen/runtime v1.1.0 h1:rJpoNUawn5XTvekgfkvSZr0RqEnoYpFkyvrzfWeFKWM= -github.com/oapi-codegen/runtime v1.1.0/go.mod h1:BeSfBkWWWnAnGdyS+S/GnlbmHKzf8/hwkvelJZDeKA8= +github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= +github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -513,8 +513,8 @@ github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo/v2 v2.13.2 h1:Bi2gGVkfn6gQcjNjZJVO8Gf0FHzMPf2phUei9tejVMs= -github.com/onsi/ginkgo/v2 v2.13.2/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM= +github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= 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= @@ -539,12 +539,12 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/percona/everest-operator v0.6.0-dev1.0.20240125162053-e43000fbf0b8 h1:nXu+L8fCl+vb9i24zqBCA5AjOMeeEGBn6M/KqWlmrCM= -github.com/percona/everest-operator v0.6.0-dev1.0.20240125162053-e43000fbf0b8/go.mod h1:o84NcJlAImYMpKK9+PIjS4V8SSREt1uZOqNhHt5qXMg= +github.com/percona/everest-operator v0.6.0-dev1.0.20240207102146-b96be266f4d9 h1:M8vHkH1ITw2KP/2MZVeDzcrB0jq8ZbuhRB3ttUxhwqU= +github.com/percona/everest-operator v0.6.0-dev1.0.20240207102146-b96be266f4d9/go.mod h1:45pGpvWrPy495qiQqxNuOJor4wif+vTTTJP4Qee8qZk= github.com/percona/percona-backup-mongodb v1.8.1-0.20230920143330-3b1c2e263901 h1:BDgsZRCjEuxl2/z4yWBqB0s8d20shuIDks7/RVdZiLs= github.com/percona/percona-backup-mongodb v1.8.1-0.20230920143330-3b1c2e263901/go.mod h1:fZRCMpUqkWlLVdRKqqaj001LoVP2eo6F0ZhoMPeXDng= -github.com/percona/percona-everest-backend v0.5.1-0.20240125151620-f38d8bb174fa h1:m1z+ecvHqTbEcazHm3exh4izP149TP/WwcCuWTMOih4= -github.com/percona/percona-everest-backend v0.5.1-0.20240125151620-f38d8bb174fa/go.mod h1:kwa+FWzO3Zvrz6I1ikyg7DVct+3GQUrCHqmAeYTBRtQ= +github.com/percona/percona-everest-backend v0.5.1-0.20240205094045-e23451782e1a h1:2CZcbM4NWnKq3/gE5OySzKMiJhjMwARa6tegJ2XIT48= +github.com/percona/percona-everest-backend v0.5.1-0.20240205094045-e23451782e1a/go.mod h1:Ql0t0eWcZV17MUTse4YYZIgXrSbLom8C96z30/bnyj0= github.com/percona/percona-postgresql-operator v0.0.0-20231220140959-ad5eef722609 h1:+UOK4gcHrRgqjo4smgfwT7/0apF6PhAJdQIdAV4ub/M= github.com/percona/percona-postgresql-operator v0.0.0-20231220140959-ad5eef722609/go.mod h1:znzhtSTF6moUOGNPzVpgfFEMaqIe/ijTSHY8BNDkiEA= github.com/percona/percona-server-mongodb-operator v1.15.0 h1:pcP9GMi9f05VFi8e/TQifBrR+cvOkYMiv1xAftkESBs= @@ -592,8 +592,8 @@ github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwa github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -746,8 +746,8 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= @@ -758,8 +758,8 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -834,13 +834,13 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -875,8 +875,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -961,26 +961,26 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78= k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4= -k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= -k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= +k8s.io/api v0.29.1 h1:DAjwWX/9YT7NQD4INu49ROJuZAAAP/Ijki48GUPzxqw= +k8s.io/api v0.29.1/go.mod h1:7Kl10vBRUXhnQQI8YR/R327zXC8eJ7887/+Ybta+RoQ= k8s.io/apiextensions-apiserver v0.18.2/go.mod h1:q3faSnRGmYimiocj6cHQ1I3WpLqmDgJFlKL37fC4ZvY= k8s.io/apiextensions-apiserver v0.18.4/go.mod h1:NYeyeYq4SIpFlPxSAB6jHPIdvu3hL0pc36wuRChybio= k8s.io/apiextensions-apiserver v0.29.0 h1:0VuspFG7Hj+SxyF/Z/2T0uFbI5gb5LRgEyUVE3Q4lV0= k8s.io/apiextensions-apiserver v0.29.0/go.mod h1:TKmpy3bTS0mr9pylH0nOt/QzQRrW7/h7yLdRForMZwc= k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko= -k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o= -k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis= +k8s.io/apimachinery v0.29.1 h1:KY4/E6km/wLBguvCZv8cKTeOwwOBqFNjwJIdMkMbbRc= +k8s.io/apimachinery v0.29.1/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= k8s.io/apiserver v0.18.2/go.mod h1:Xbh066NqrZO8cbsoenCwyDJ1OSi8Ag8I2lezeHxzwzw= k8s.io/apiserver v0.18.4/go.mod h1:q+zoFct5ABNnYkGIaGQ3bcbUNdmPyOCoEBcg51LChY8= k8s.io/apiserver v0.29.0 h1:Y1xEMjJkP+BIi0GSEv1BBrf1jLU9UPfAnnGGbbDdp7o= k8s.io/apiserver v0.29.0/go.mod h1:31n78PsRKPmfpee7/l9NYEv67u6hOL6AfcE761HapDM= -k8s.io/cli-runtime v0.29.0 h1:q2kC3cex4rOBLfPOnMSzV2BIrrQlx97gxHJs21KxKS4= -k8s.io/cli-runtime v0.29.0/go.mod h1:VKudXp3X7wR45L+nER85YUzOQIru28HQpXr0mTdeCrk= +k8s.io/cli-runtime v0.29.1 h1:By3WVOlEWYfyxhGko0f/IuAOLQcbBSMzwSaDren2JUs= +k8s.io/cli-runtime v0.29.1/go.mod h1:vjEY9slFp8j8UoMhV5AlO8uulX9xk6ogfIesHobyBDU= k8s.io/client-go v0.18.2/go.mod h1:Xcm5wVGXX9HAA2JJ2sSBUn3tCJ+4SVlCbl2MNNv+CIU= k8s.io/client-go v0.18.4/go.mod h1:f5sXwL4yAZRkAtzOxRWUhA/N8XzGCb+nPZI8PfobZ9g= -k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= -k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= +k8s.io/client-go v0.29.1 h1:19B/+2NGEwnFLzt0uB5kNJnfTsbV8w6TgQRz9l7ti7A= +k8s.io/client-go v0.29.1/go.mod h1:TDG/psL9hdet0TI9mGyHJSgRkW3H9JZk2dNEUS7bRks= 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.2/go.mod h1:kqLlMuhJNHQ9lz8Z7V5bxUUtjFZnrypArGl58gmDfUM= diff --git a/pkg/install/install.go b/pkg/install/install.go index 7fa051f3..e9b51c69 100644 --- a/pkg/install/install.go +++ b/pkg/install/install.go @@ -50,6 +50,7 @@ const ( pxcOperatorName = "percona-xtradb-cluster-operator" psmdbOperatorName = "percona-server-mongodb-operator" pgOperatorName = "percona-postgresql-operator" + vmOperatorName = "victoriametrics-operator" operatorInstallThreads = 1 everestServiceAccount = "everest-admin" @@ -61,17 +62,24 @@ const ( pxcOperatorChannel = "stable-v1" psmdbOperatorChannel = "stable-v1" pgOperatorChannel = "fast-v2" - // VMOperatorChannel is the catalog channel for the VM Operator. - VMOperatorChannel = "stable-v0" - - // CatalogSourceNamespace is the namespace where the catalog source is installed. - CatalogSourceNamespace = "olm" - // CatalogSource is the name of the catalog source. - CatalogSource = "percona-everest-catalog" - // OperatorGroup is the name of the operator group. - OperatorGroup = "percona-operators-group" - // EverestNamespace is the namespace where everest is installed. - EverestNamespace = "percona-everest" + vmOperatorChannel = "stable-v0" + + // catalogSourceNamespace is the namespace where the catalog source is installed. + catalogSourceNamespace = "olm" + // catalogSource is the name of the catalog source. + catalogSource = "everest-catalog" + + // systemOperatorGroup is the name of the system operator group. + systemOperatorGroup = "everest-system" + // monitoringOperatorGroup is the name of the monitoring operator group. + monitoringOperatorGroup = "everest-monitoring" + // dbsOperatorGroup is the name of the database operator group. + dbsOperatorGroup = "everest-databases" + + // SystemNamespace is the namespace where everest is installed. + SystemNamespace = "percona-everest" + // monitoringNamespace is the namespace where the monitoring stack is installed. + monitoringNamespace = "percona-everest-monitoring" ) type ( @@ -102,7 +110,7 @@ type ( func NewInstall(c Config, l *zap.SugaredLogger) (*Install, error) { cli := &Install{ config: c, - l: l.With("component", "install/operators"), + l: l.With("component", "install"), } k, err := kubernetes.New(c.KubeconfigPath, cli.l) @@ -119,42 +127,31 @@ func NewInstall(c Config, l *zap.SugaredLogger) (*Install, error) { } // Run runs the operators installation process. -func (o *Install) Run(ctx context.Context) error { //nolint:cyclop +func (o *Install) Run(ctx context.Context) error { if err := o.populateConfig(); err != nil { return err } - if len(o.config.Namespaces) == 0 { - return errors.New("namespace list is empty. Specify at least one namespace using the --namespace flag") - } - for _, ns := range o.config.Namespaces { - if ns == EverestNamespace { - return fmt.Errorf("'%s' namespace is reserved for Everest internals. Please specify another namespace", ns) - } - } - - if err := o.createNamespace(EverestNamespace); err != nil { - return err - } if err := o.provisionOLM(ctx); err != nil { return err } - o.l.Info("Creating operator group for the everest") - if err := o.kubeClient.CreateOperatorGroup(ctx, OperatorGroup, EverestNamespace, o.config.Namespaces); err != nil { + + if err := o.provisionMonitoringStack(ctx); err != nil { return err } - if err := o.provisionAllNamespaces(ctx); err != nil { + + if err := o.provisionDBNamespaces(ctx); err != nil { return err } - if err := o.installEverest(ctx); err != nil { + + if err := o.provisionEverestOperator(ctx); err != nil { return err } - o.l.Info("Updating cluster role bindings for the everest-admin") - if err := o.kubeClient.UpdateClusterRoleBinding(ctx, everestServiceAccountClusterRoleBinding, o.config.Namespaces); err != nil { + + if err := o.provisionEverest(ctx); err != nil { return err } - - _, err := o.kubeClient.GetSecret(ctx, token.SecretName, EverestNamespace) + _, err := o.kubeClient.GetSecret(ctx, token.SecretName, SystemNamespace) if err != nil && !k8serrors.IsNotFound(err) { return errors.Join(err, errors.New("could not get the everest token secret")) } @@ -176,14 +173,80 @@ func (o *Install) populateConfig() error { } } + if len(o.config.Namespaces) == 0 { + return errors.New("namespace list is empty. Specify at least one namespace using the --namespace flag") + } + for _, ns := range o.config.Namespaces { + if ns == SystemNamespace || ns == monitoringNamespace { + return fmt.Errorf("'%s' namespace is reserved for Everest internals. Please specify another namespace", ns) + } + } + return nil } -func (o *Install) installEverest(ctx context.Context) error { - if err := o.installOperator(ctx, everestOperatorChannel, everestOperatorName, EverestNamespace)(); err != nil { +func (o *Install) installVMOperator(ctx context.Context) error { + o.l.Info("Creating operator group for everest") + if err := o.kubeClient.CreateOperatorGroup(ctx, monitoringOperatorGroup, monitoringNamespace, []string{}); err != nil { return err } - d, err := o.kubeClient.GetDeployment(ctx, kubernetes.PerconaEverestDeploymentName, EverestNamespace) + o.l.Infof("Installing %s operator", vmOperatorName) + + params := kubernetes.InstallOperatorRequest{ + Namespace: monitoringNamespace, + Name: vmOperatorName, + OperatorGroup: monitoringOperatorGroup, + CatalogSource: catalogSource, + CatalogSourceNamespace: catalogSourceNamespace, + Channel: vmOperatorChannel, + InstallPlanApproval: v1alpha1.ApprovalManual, + } + + if err := o.kubeClient.InstallOperator(ctx, params); err != nil { + o.l.Errorf("failed installing %s operator", vmOperatorName) + return err + } + o.l.Infof("%s operator has been installed", vmOperatorName) + return nil +} + +func (o *Install) provisionMonitoringStack(ctx context.Context) error { + l := o.l.With("action", "monitoring") + if err := o.createNamespace(monitoringNamespace); err != nil { + return err + } + + l.Info("Preparing k8s cluster for monitoring") + if err := o.installVMOperator(ctx); err != nil { + return err + } + if err := o.kubeClient.ProvisionMonitoring(monitoringNamespace); err != nil { + return errors.Join(err, errors.New("could not provision monitoring configuration")) + } + + l.Info("K8s cluster monitoring has been provisioned successfully") + return nil +} + +func (o *Install) provisionEverestOperator(ctx context.Context) error { + if err := o.createNamespace(SystemNamespace); err != nil { + return err + } + + o.l.Info("Creating operator group for everest") + if err := o.kubeClient.CreateOperatorGroup(ctx, systemOperatorGroup, SystemNamespace, o.config.Namespaces); err != nil { + return err + } + + if err := o.installOperator(ctx, everestOperatorChannel, everestOperatorName, SystemNamespace)(); err != nil { + return err + } + + return nil +} + +func (o *Install) provisionEverest(ctx context.Context) error { + d, err := o.kubeClient.GetDeployment(ctx, kubernetes.PerconaEverestDeploymentName, SystemNamespace) var everestExists bool if err != nil && !k8serrors.IsNotFound(err) { return err @@ -193,30 +256,36 @@ func (o *Install) installEverest(ctx context.Context) error { } if !everestExists { - o.l.Info(fmt.Sprintf("Deploying Everest to %s", EverestNamespace)) - err = o.kubeClient.InstallEverest(ctx, EverestNamespace) + o.l.Info(fmt.Sprintf("Deploying Everest to %s", SystemNamespace)) + err = o.kubeClient.InstallEverest(ctx, SystemNamespace) if err != nil { return err } } else { o.l.Info("Restarting Everest") - if err := o.kubeClient.RestartEverest(ctx, everestOperatorName, EverestNamespace); err != nil { + if err := o.kubeClient.RestartEverest(ctx, everestOperatorName, SystemNamespace); err != nil { return err } - if err := o.kubeClient.RestartEverest(ctx, everestBackendServiceName, EverestNamespace); err != nil { + if err := o.kubeClient.RestartEverest(ctx, everestBackendServiceName, SystemNamespace); err != nil { return err } } + + o.l.Info("Updating cluster role bindings for everest-admin") + if err := o.kubeClient.UpdateClusterRoleBinding(ctx, everestServiceAccountClusterRoleBinding, o.config.Namespaces); err != nil { + return err + } + return nil } -func (o *Install) provisionAllNamespaces(ctx context.Context) error { +func (o *Install) provisionDBNamespaces(ctx context.Context) error { for _, namespace := range o.config.Namespaces { namespace := namespace if err := o.createNamespace(namespace); err != nil { return err } - if err := o.kubeClient.CreateOperatorGroup(ctx, OperatorGroup, namespace, []string{}); err != nil { + if err := o.kubeClient.CreateOperatorGroup(ctx, dbsOperatorGroup, namespace, []string{}); err != nil { return err } @@ -271,7 +340,7 @@ func (o *Install) runEverestWizard() error { continue } - if ns == EverestNamespace { + if ns == SystemNamespace { return fmt.Errorf("'%s' namespace is reserved for Everest internals. Please specify another namespace", ns) } @@ -403,9 +472,9 @@ func (o *Install) installOperator(ctx context.Context, channel, operatorName, na params := kubernetes.InstallOperatorRequest{ Namespace: namespace, Name: operatorName, - OperatorGroup: OperatorGroup, - CatalogSource: CatalogSource, - CatalogSourceNamespace: CatalogSourceNamespace, + OperatorGroup: systemOperatorGroup, + CatalogSource: catalogSource, + CatalogSourceNamespace: catalogSourceNamespace, Channel: channel, InstallPlanApproval: v1alpha1.ApprovalManual, } @@ -414,7 +483,7 @@ func (o *Install) installOperator(ctx context.Context, channel, operatorName, na params.SubscriptionConfig = &v1alpha1.SubscriptionConfig{ Env: []corev1.EnvVar{ { - Name: kubernetes.EverestWatchNamespacesEnvVar, + Name: kubernetes.EverestDBNamespacesEnvVar, Value: strings.Join(o.config.Namespaces, ","), }, }, @@ -487,7 +556,7 @@ func (o *Install) generateToken(ctx context.Context) (*token.ResetResponse, erro r, err := token.NewReset( token.ResetConfig{ KubeconfigPath: o.config.KubeconfigPath, - Namespace: EverestNamespace, + Namespace: SystemNamespace, }, o.l, ) diff --git a/pkg/kubernetes/kubernetes.go b/pkg/kubernetes/kubernetes.go index 625c3a6e..2fcfc7cb 100644 --- a/pkg/kubernetes/kubernetes.go +++ b/pkg/kubernetes/kubernetes.go @@ -73,8 +73,9 @@ const ( // EverestOperatorDeploymentName is the name of the deployment for everest operator. EverestOperatorDeploymentName = "everest-operator-controller-manager" - // EverestWatchNamespacesEnvVar is the name of the environment variable. - EverestWatchNamespacesEnvVar = "WATCH_NAMESPACES" + // EverestDBNamespacesEnvVar is the name of the environment variable that + // contains the list of monitored namespaces. + EverestDBNamespacesEnvVar = "DB_NAMESPACES" pxcDeploymentName = "percona-xtradb-cluster-operator" psmdbDeploymentName = "percona-server-mongodb-operator" @@ -498,7 +499,7 @@ func (k *Kubernetes) applyCSVs(ctx context.Context, resources []unstructured.Uns // InstallPerconaCatalog installs percona catalog and ensures that packages are available. func (k *Kubernetes) InstallPerconaCatalog(ctx context.Context) error { - data, err := fs.ReadFile(data.OLMCRDs, "crds/olm/percona-dbaas-catalog.yaml") + data, err := fs.ReadFile(data.OLMCRDs, "crds/olm/everest-catalog.yaml") if err != nil { return errors.Join(err, errors.New("failed to read percona catalog file")) } @@ -998,8 +999,8 @@ func (k *Kubernetes) DeleteEverest(ctx context.Context, namespace string) error return nil } -// GetWatchedNamespaces returns list of watched namespaces. -func (k *Kubernetes) GetWatchedNamespaces(ctx context.Context, namespace string) ([]string, error) { +// GetDBNamespaces returns a list of namespaces that are monitored by the Everest operator. +func (k *Kubernetes) GetDBNamespaces(ctx context.Context, namespace string) ([]string, error) { deployment, err := k.GetDeployment(ctx, EverestOperatorDeploymentName, namespace) if err != nil { return nil, err @@ -1010,7 +1011,7 @@ func (k *Kubernetes) GetWatchedNamespaces(ctx context.Context, namespace string) continue } for _, envVar := range container.Env { - if envVar.Name != EverestWatchNamespacesEnvVar { + if envVar.Name != EverestDBNamespacesEnvVar { continue } return strings.Split(envVar.Value, ","), nil diff --git a/pkg/monitoring/deps.go b/pkg/monitoring/deps.go deleted file mode 100644 index 22c72be6..00000000 --- a/pkg/monitoring/deps.go +++ /dev/null @@ -1,42 +0,0 @@ -// percona-everest-cli -// Copyright (C) 2023 Percona LLC -// -// 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 monitoring ... -package monitoring - -import ( - "context" - - "github.com/percona/percona-everest-backend/client" -) - -//go:generate ../../bin/mockery --name=everestClientConnector --case=snake --inpackage --testonly - -type everestClientConnector interface { - CreateMonitoringInstance( - ctx context.Context, - body client.CreateMonitoringInstanceJSONRequestBody, - ) (*client.MonitoringInstance, error) - GetMonitoringInstance( - ctx context.Context, - pmmInstanceID string, - ) (*client.MonitoringInstance, error) - ListMonitoringInstances(ctx context.Context) ([]client.MonitoringInstance, error) - - SetKubernetesClusterMonitoring( - ctx context.Context, - body client.SetKubernetesClusterMonitoringJSONRequestBody, - ) error -} diff --git a/pkg/monitoring/enable.go b/pkg/monitoring/enable.go deleted file mode 100644 index 30a6607f..00000000 --- a/pkg/monitoring/enable.go +++ /dev/null @@ -1,427 +0,0 @@ -// percona-everest-cli -// Copyright (C) 2023 Percona LLC -// -// 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 monitoring holds the main logic for provision monitoring -package monitoring - -import ( - "context" - "errors" - "fmt" - "net/url" - "strings" - "time" - - "github.com/AlecAivazis/survey/v2" - "github.com/operator-framework/api/pkg/operators/v1alpha1" - "github.com/percona/percona-everest-backend/client" - "go.uber.org/zap" - k8serrors "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/util/wait" - - "github.com/percona/percona-everest-cli/commands/common" - everestClient "github.com/percona/percona-everest-cli/pkg/everest/client" - "github.com/percona/percona-everest-cli/pkg/install" - "github.com/percona/percona-everest-cli/pkg/kubernetes" -) - -const ( - everestBackendServiceName = "percona-everest-backend" - everestBackendDeploymentName = "percona-everest" - vmOperatorName = "victoriametrics-operator" -) - -// Monitoring implements the logic for provisioning monitoring. -type Monitoring struct { - l *zap.SugaredLogger - - config Config - everestClient everestClientConnector - kubeClient *kubernetes.Kubernetes - - // monitoringInstanceName stores the resolved monitoring instance name. - monitoringInstanceName string -} - -type ( - // monitoringType identifies type of monitoring to be used. - monitoringType string - - // Config stores configuration for the operators. - Config struct { - // Namespace defines the namespace operators shall be installed to. - Namespace string - // SkipWizard skips wizard during installation. - SkipWizard bool `mapstructure:"skip-wizard"` - // KubeconfigPath is a path to a kubeconfig - KubeconfigPath string `mapstructure:"kubeconfig"` - - // EverestToken defines a token to connect to Everest - EverestToken string `mapstructure:"everest-token"` - // EverestURL defines an URL to connect to Everest - EverestURL string `mapstructure:"everest-url"` - - // InstanceName stores monitoring instance name from Everest. - // If provided, the other monitoring configuration is ignored. - InstanceName string `mapstructure:"instance-name"` - // NewInstanceName defines name for a new monitoring instance - // if it's created. - NewInstanceName string `mapstructure:"new-instance-name"` - // Type stores the type of monitoring to be used. - Type monitoringType - // PMM stores configuration for PMM monitoring type. - PMM *PMMConfig - } - - // PMMConfig stores configuration for PMM monitoring type. - PMMConfig struct { - // Endpoint stores URL to PMM. - Endpoint string - // Username stores username for authentication against PMM. - Username string - // Password stores password for authentication against PMM. - Password string - } -) - -// NewMonitoring returns a new Monitoring struct. -func NewMonitoring(c Config, l *zap.SugaredLogger) (*Monitoring, error) { - cli := &Monitoring{ - config: c, - l: l.With("component", "monitoring/enable"), - } - - k, err := kubernetes.New(c.KubeconfigPath, cli.l) - if err != nil { - var u *url.Error - if errors.As(err, &u) { - cli.l.Error("Could not connect to Kubernetes. " + - "Make sure Kubernetes is running and is accessible from this computer/server.") - } - return nil, err - } - cli.kubeClient = k - return cli, nil -} - -// Run runs the operators installation process. -func (m *Monitoring) Run(ctx context.Context) error { - if err := m.populateConfig(ctx); err != nil { - return err - } - if err := m.checkNamespace(ctx); err != nil { - return err - } - if err := m.provisionMonitoring(ctx); err != nil { - return err - } - - return nil -} - -func (m *Monitoring) populateConfig(ctx context.Context) error { - if !m.config.SkipWizard { - if err := m.runEverestWizard(); err != nil { - return err - } - if err := m.runMonitoringWizard(); err != nil { - return err - } - } - m.config.EverestURL = strings.TrimSpace(m.config.EverestURL) - - if err := m.configureEverestConnector(); err != nil { - return err - } - if err := m.checkEverestConnection(ctx); err != nil { - return err - } - - return nil -} - -// checkNamespace provisions a namespace for Everest. -func (m *Monitoring) checkNamespace(ctx context.Context) error { - _, err := m.kubeClient.GetNamespace(ctx, m.config.Namespace) - if err != nil && k8serrors.IsNotFound(err) { - return fmt.Errorf("namespace %s is not found", m.config.Namespace) - } - if err != nil { - return err - } - - _, err = m.kubeClient.GetDeployment(ctx, kubernetes.PerconaEverestDeploymentName, m.config.Namespace) - if err != nil && k8serrors.IsNotFound(err) { - return fmt.Errorf("no Everest installation exist in the %s namespace. Monitoring can be provisioned into the namespace where everest components are deployed", m.config.Namespace) - } - if err != nil { - return err - } - _, err = m.kubeClient.GetDeployment(ctx, kubernetes.EverestOperatorDeploymentName, m.config.Namespace) - if err != nil && k8serrors.IsNotFound(err) { - return fmt.Errorf("no Everest installation exist in the %s namespace. Monitoring can be provisioned into the namespace where everest components are deployed", m.config.Namespace) - } - return err -} - -func (m *Monitoring) installVMOperator(ctx context.Context) error { - m.l.Infof("Installing %s operator", vmOperatorName) - - params := kubernetes.InstallOperatorRequest{ - Namespace: m.config.Namespace, - Name: vmOperatorName, - OperatorGroup: install.OperatorGroup, - CatalogSource: install.CatalogSource, - CatalogSourceNamespace: install.CatalogSourceNamespace, - Channel: install.VMOperatorChannel, - InstallPlanApproval: v1alpha1.ApprovalManual, - } - - if err := m.kubeClient.InstallOperator(ctx, params); err != nil { - m.l.Errorf("failed installing %s operator", vmOperatorName) - return err - } - m.l.Infof("%s operator has been installed", vmOperatorName) - return nil -} - -func (m *Monitoring) provisionMonitoring(ctx context.Context) error { - l := m.l.With("action", "monitoring") - l.Info("Preparing k8s cluster for monitoring") - if err := m.installVMOperator(ctx); err != nil { - return err - } - if err := m.kubeClient.ProvisionMonitoring(m.config.Namespace); err != nil { - return errors.Join(err, errors.New("could not provision monitoring configuration")) - } - - l.Info("K8s cluster monitoring has been provisioned successfully") - if err := m.resolveMonitoringInstanceName(ctx); err != nil { - return err - } - m.l.Info("Deploying VMAgent to k8s cluster") - if err := m.kubeClient.RestartEverest(ctx, everestBackendServiceName, m.config.Namespace); err != nil { - return err - } - if err := m.kubeClient.WaitForRollout(ctx, everestBackendDeploymentName, m.config.Namespace); err != nil { - return errors.Join(err, errors.New("failed waiting for Everest to be ready")) - } - - if err := m.waitForEverestConnection(ctx); err != nil { - return err - } - - // We retry for a bit since the MonitoringConfig may not be properly - // deployed yet and we get a HTTP 500 in this case. - err := wait.PollUntilContextTimeout(ctx, 3*time.Second, 2*time.Minute, true, func(ctx context.Context) (bool, error) { - m.l.Debug("Trying to enable Kubernetes cluster monitoring") - err := m.everestClient.SetKubernetesClusterMonitoring(ctx, client.KubernetesClusterMonitoring{ - Enable: true, - MonitoringInstanceName: m.monitoringInstanceName, - }) - if err != nil { - m.l.Debug(errors.Join(err, errors.New("could not enable Kubernetes cluster monitoring"))) - return false, nil - } - - return true, nil - }) - if err != nil { - return errors.Join(err, errors.New("could not enable Kubernetes cluster monitoring")) - } - - m.l.Info("VMAgent deployed successfully") - return nil -} - -func (m *Monitoring) waitForEverestConnection(ctx context.Context) error { - sleep := time.Second - for i := 0; i < 3; i++ { - time.Sleep(sleep) - sleep *= 2 - if err := m.checkEverestConnection(ctx); err != nil { - if i != 2 { - continue - } - var u *url.Error - if errors.As(err, &u) { - m.l.Debug(err) - - l := m.l.WithOptions(zap.AddStacktrace(zap.DPanicLevel)) - l.Error("Could not connect to Everest. " + - "Make sure Everest is running and is accessible from this machine.", - ) - return common.ErrExitWithError - } - - return errors.Join(err, errors.New("could not check connection to Everest")) - } - } - return nil -} - -func (m *Monitoring) resolveMonitoringInstanceName(ctx context.Context) error { - if m.config.InstanceName != "" { - i, err := m.everestClient.GetMonitoringInstance(ctx, m.config.InstanceName) - if err != nil { - return errors.Join(err, fmt.Errorf("could not get monitoring instance with name %s from Everest", m.config.InstanceName)) - } - m.monitoringInstanceName = i.Name - return nil - } - - if m.config.NewInstanceName == "" && m.monitoringInstanceName == "" { - return errors.New("new-instance-name is required when creating a new monitoring instance") - } - - err := m.createPMMMonitoringInstance( - ctx, m.config.NewInstanceName, m.config.PMM.Endpoint, - m.config.PMM.Username, m.config.PMM.Password, - ) - if err != nil { - return errors.Join(err, errors.New("could not create a new PMM monitoring instance in Everest")) - } - - m.monitoringInstanceName = m.config.NewInstanceName - - return nil -} - -func (m *Monitoring) createPMMMonitoringInstance(ctx context.Context, name, url, username, password string) error { - _, err := m.everestClient.CreateMonitoringInstance(ctx, client.MonitoringInstanceCreateParams{ - Type: client.MonitoringInstanceCreateParamsTypePmm, - Name: name, - Url: url, - Pmm: &client.PMMMonitoringInstanceSpec{ - User: username, - Password: password, - }, - }) - if err != nil { - return errors.Join(err, errors.New("could not create a new monitoring instance")) - } - - return nil -} - -func (m *Monitoring) configureEverestConnector() error { - e, err := everestClient.NewEverestFromURL(m.config.EverestURL, m.config.EverestToken) - if err != nil { - return err - } - m.everestClient = e - return nil -} - -func (m *Monitoring) runEverestWizard() error { - pURL := &survey.Input{ - Message: "Everest URL endpoint", - Default: m.config.EverestURL, - } - if err := survey.AskOne( - pURL, - &m.config.EverestURL, - survey.WithValidator(survey.Required), - ); err != nil { - return err - } - pToken := &survey.Password{Message: "Everest Token"} - if err := survey.AskOne( - pToken, - &m.config.EverestToken, - survey.WithValidator(survey.Required), - ); err != nil { - return err - } - return nil -} - -func (m *Monitoring) runMonitoringWizard() error { - if m.config.PMM == nil { - m.config.PMM = &PMMConfig{} - } - pName := &survey.Input{ - Message: "Registered instance name", - } - if err := survey.AskOne( - pName, - &m.config.InstanceName, - ); err != nil { - return err - } - - if m.config.InstanceName == "" { - if err := m.runMonitoringNewURLWizard(); err != nil { - return err - } - } - - return nil -} - -func (m *Monitoring) runMonitoringNewURLWizard() error { - pURL := &survey.Input{ - Message: "PMM URL Endpoint", - Default: m.config.PMM.Endpoint, - } - if err := survey.AskOne( - pURL, - &m.config.PMM.Endpoint, - survey.WithValidator(survey.Required), - ); err != nil { - return err - } - m.config.PMM.Endpoint = strings.TrimSpace(m.config.PMM.Endpoint) - - pUser := &survey.Input{ - Message: "Username", - Default: m.config.PMM.Username, - } - if err := survey.AskOne( - pUser, - &m.config.PMM.Username, - survey.WithValidator(survey.Required), - ); err != nil { - return err - } - - pPass := &survey.Password{Message: "Password"} - if err := survey.AskOne( - pPass, - &m.config.PMM.Password, - survey.WithValidator(survey.Required), - ); err != nil { - return err - } - - pName := &survey.Input{ - Message: "Name for the new monitoring instance", - Default: m.config.NewInstanceName, - } - if err := survey.AskOne( - pName, - &m.config.NewInstanceName, - survey.WithValidator(survey.Required), - ); err != nil { - return err - } - - return nil -} - -func (m *Monitoring) checkEverestConnection(ctx context.Context) error { - _, err := m.everestClient.ListMonitoringInstances(ctx) - return err -} diff --git a/pkg/monitoring/mock_everest_client_connector_test.go b/pkg/monitoring/mock_everest_client_connector_test.go deleted file mode 100644 index d74c4b3f..00000000 --- a/pkg/monitoring/mock_everest_client_connector_test.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by mockery v2.38.0. DO NOT EDIT. - -package monitoring - -import ( - context "context" - - client "github.com/percona/percona-everest-backend/client" - mock "github.com/stretchr/testify/mock" -) - -// mockEverestClientConnector is an autogenerated mock type for the everestClientConnector type -type mockEverestClientConnector struct { - mock.Mock -} - -// CreateMonitoringInstance provides a mock function with given fields: ctx, body -func (_m *mockEverestClientConnector) CreateMonitoringInstance(ctx context.Context, body client.MonitoringInstanceCreateParams) (*client.MonitoringInstanceBaseWithName, error) { - ret := _m.Called(ctx, body) - - if len(ret) == 0 { - panic("no return value specified for CreateMonitoringInstance") - } - - var r0 *client.MonitoringInstanceBaseWithName - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, client.MonitoringInstanceCreateParams) (*client.MonitoringInstanceBaseWithName, error)); ok { - return rf(ctx, body) - } - if rf, ok := ret.Get(0).(func(context.Context, client.MonitoringInstanceCreateParams) *client.MonitoringInstanceBaseWithName); ok { - r0 = rf(ctx, body) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*client.MonitoringInstanceBaseWithName) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, client.MonitoringInstanceCreateParams) error); ok { - r1 = rf(ctx, body) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetMonitoringInstance provides a mock function with given fields: ctx, pmmInstanceID -func (_m *mockEverestClientConnector) GetMonitoringInstance(ctx context.Context, pmmInstanceID string) (*client.MonitoringInstanceBaseWithName, error) { - ret := _m.Called(ctx, pmmInstanceID) - - if len(ret) == 0 { - panic("no return value specified for GetMonitoringInstance") - } - - var r0 *client.MonitoringInstanceBaseWithName - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*client.MonitoringInstanceBaseWithName, error)); ok { - return rf(ctx, pmmInstanceID) - } - if rf, ok := ret.Get(0).(func(context.Context, string) *client.MonitoringInstanceBaseWithName); ok { - r0 = rf(ctx, pmmInstanceID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*client.MonitoringInstanceBaseWithName) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, pmmInstanceID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListMonitoringInstances provides a mock function with given fields: ctx -func (_m *mockEverestClientConnector) ListMonitoringInstances(ctx context.Context) ([]client.MonitoringInstanceBaseWithName, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for ListMonitoringInstances") - } - - var r0 []client.MonitoringInstanceBaseWithName - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]client.MonitoringInstanceBaseWithName, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) []client.MonitoringInstanceBaseWithName); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]client.MonitoringInstanceBaseWithName) - } - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SetKubernetesClusterMonitoring provides a mock function with given fields: ctx, body -func (_m *mockEverestClientConnector) SetKubernetesClusterMonitoring(ctx context.Context, body client.KubernetesClusterMonitoring) error { - ret := _m.Called(ctx, body) - - if len(ret) == 0 { - panic("no return value specified for SetKubernetesClusterMonitoring") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, client.KubernetesClusterMonitoring) error); ok { - r0 = rf(ctx, body) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// newMockEverestClientConnector creates a new instance of mockEverestClientConnector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func newMockEverestClientConnector(t interface { - mock.TestingT - Cleanup(func()) -}, -) *mockEverestClientConnector { - mock := &mockEverestClientConnector{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/monitoring_test.go b/pkg/monitoring/monitoring_test.go deleted file mode 100644 index a97418f3..00000000 --- a/pkg/monitoring/monitoring_test.go +++ /dev/null @@ -1,153 +0,0 @@ -// percona-everest-cli -// Copyright (C) 2023 Percona LLC -// -// 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 monitoring - -import ( - "context" - "errors" - "strings" - "testing" - - "github.com/percona/percona-everest-backend/client" - mock "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "go.uber.org/zap" -) - -const ( - iName = "monitoring-instance" -) - -func TestInstall_resolveMonitoringInstanceName(t *testing.T) { - t.Parallel() - - l, err := zap.NewDevelopment() - require.NoError(t, err) - - t.Run("shall work with monitoring instance name", func(t *testing.T) { - t.Parallel() - - m := &mockEverestClientConnector{} - m.Mock.On("GetMonitoringInstance", mock.Anything, "123").Return(&client.MonitoringInstance{Name: iName}, nil) - defer m.AssertExpectations(t) - - o := &Monitoring{ - l: l.Sugar(), - config: Config{ - InstanceName: "123", - }, - everestClient: m, - } - - err := o.resolveMonitoringInstanceName(context.Background()) - require.NoError(t, err) - require.Equal(t, iName, o.monitoringInstanceName) - }) - - t.Run("shall fail with monitoring instance name not found", func(t *testing.T) { - t.Parallel() - - m := &mockEverestClientConnector{} - m.Mock.On("GetMonitoringInstance", mock.Anything, "123").Return(nil, errors.New("not-found")) - defer m.AssertExpectations(t) - - o := &Monitoring{ - l: l.Sugar(), - config: Config{ - InstanceName: "123", - }, - everestClient: m, - } - - err := o.resolveMonitoringInstanceName(context.Background()) - require.Error(t, err) - require.True(t, strings.Contains(err.Error(), "not-found")) - }) - - t.Run("shall prefer monitoring instance name", func(t *testing.T) { - t.Parallel() - - m := &mockEverestClientConnector{} - m.Mock.On("GetMonitoringInstance", mock.Anything, "123").Return(&client.MonitoringInstance{Name: iName}, nil) - defer m.AssertExpectations(t) - - o := &Monitoring{ - l: l.Sugar(), - config: Config{ - InstanceName: "123", - PMM: &PMMConfig{ - Endpoint: "http://localhost", - Username: "admin", - Password: "admin", - }, - }, - everestClient: m, - } - - err := o.resolveMonitoringInstanceName(context.Background()) - require.NoError(t, err) - require.Equal(t, iName, o.monitoringInstanceName) - }) - - t.Run("shall fail without new instance name defined when creating a new instance", func(t *testing.T) { - t.Parallel() - - m := &mockEverestClientConnector{} - defer m.AssertExpectations(t) - - o := &Monitoring{ - l: l.Sugar(), - config: Config{}, - everestClient: m, - } - - err := o.resolveMonitoringInstanceName(context.Background()) - require.Error(t, err) - require.True(t, strings.Contains(err.Error(), "new-instance-name is required")) - }) - - t.Run("shall create a new PMM instance", func(t *testing.T) { - t.Parallel() - - m := &mockEverestClientConnector{} - m.Mock.On("CreateMonitoringInstance", mock.Anything, client.MonitoringInstanceCreateParams{ - Type: client.MonitoringInstanceCreateParamsTypePmm, - Name: "new-instance", - Url: "http://monitoring-url", - Pmm: &client.PMMMonitoringInstanceSpec{ - User: "user", - Password: "pass", - }, - }).Return(&client.MonitoringInstance{}, nil) - defer m.AssertExpectations(t) - - o := &Monitoring{ - l: l.Sugar(), - config: Config{ - NewInstanceName: "new-instance", - PMM: &PMMConfig{ - Endpoint: "http://monitoring-url", - Username: "user", - Password: "pass", - }, - }, - everestClient: m, - } - - err := o.resolveMonitoringInstanceName(context.Background()) - require.NoError(t, err) - require.Equal(t, "new-instance", o.monitoringInstanceName) - }) -} diff --git a/pkg/uninstall/uninstall.go b/pkg/uninstall/uninstall.go index e5b29293..d0e4e2fe 100644 --- a/pkg/uninstall/uninstall.go +++ b/pkg/uninstall/uninstall.go @@ -87,7 +87,7 @@ This will uninstall Everest and all monitoring resources deployed by it. All oth if err := u.uninstallK8sResources(ctx); err != nil { return err } - if err := u.kubeClient.DeleteEverest(ctx, install.EverestNamespace); err != nil { + if err := u.kubeClient.DeleteEverest(ctx, install.SystemNamespace); err != nil { return err } @@ -95,23 +95,23 @@ This will uninstall Everest and all monitoring resources deployed by it. All oth } func (u *Uninstall) checkResourcesExist(ctx context.Context) error { - _, err := u.kubeClient.GetNamespace(ctx, install.EverestNamespace) + _, err := u.kubeClient.GetNamespace(ctx, install.SystemNamespace) if err != nil && k8serrors.IsNotFound(err) { - return fmt.Errorf("namespace %s is not found", install.EverestNamespace) + return fmt.Errorf("namespace %s is not found", install.SystemNamespace) } if err != nil && !k8serrors.IsNotFound(err) { return err } - _, err = u.kubeClient.GetDeployment(ctx, kubernetes.PerconaEverestDeploymentName, install.EverestNamespace) + _, err = u.kubeClient.GetDeployment(ctx, kubernetes.PerconaEverestDeploymentName, install.SystemNamespace) if err != nil && k8serrors.IsNotFound(err) { - return fmt.Errorf("no Everest deployment in %s namespace", install.EverestNamespace) + return fmt.Errorf("no Everest deployment in %s namespace", install.SystemNamespace) } return err } func (u *Uninstall) uninstallK8sResources(ctx context.Context) error { u.l.Info("Deleting all Kubernetes monitoring resources in Kubernetes cluster") - if err := u.kubeClient.DeleteAllMonitoringResources(ctx, install.EverestNamespace); err != nil { + if err := u.kubeClient.DeleteAllMonitoringResources(ctx, install.SystemNamespace); err != nil { return errors.Join(err, errors.New("could not uninstall monitoring resources from the Kubernetes cluster")) } diff --git a/pkg/upgrade/upgrade.go b/pkg/upgrade/upgrade.go index 3dd52b3d..2c94f6f6 100644 --- a/pkg/upgrade/upgrade.go +++ b/pkg/upgrade/upgrade.go @@ -96,7 +96,7 @@ func (u *Upgrade) Run(ctx context.Context) error { } u.l.Info("Subscriptions have been patched") u.l.Info("Upgrading Everest") - if err := u.kubeClient.InstallEverest(ctx, install.EverestNamespace); err != nil { + if err := u.kubeClient.InstallEverest(ctx, install.SystemNamespace); err != nil { return err } u.l.Info("Everest has been upgraded") @@ -105,7 +105,7 @@ func (u *Upgrade) Run(ctx context.Context) error { func (u *Upgrade) runEverestWizard(ctx context.Context) error { if !u.config.SkipWizard { - namespaces, err := u.kubeClient.GetWatchedNamespaces(ctx, install.EverestNamespace) + namespaces, err := u.kubeClient.GetDBNamespaces(ctx, install.SystemNamespace) if err != nil { return err }