Skip to content

Commit

Permalink
Merge branch 'main' into EVEREST-1647-ui-monthly-schedule-creates-an-…
Browse files Browse the repository at this point in the history
…invalid-configuration-for-psmdb
  • Loading branch information
fabio-silva authored Jan 19, 2025
2 parents 43b6f86 + 9aab6ea commit 00ced55
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
20 changes: 12 additions & 8 deletions commands/namespaces/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package namespaces

import (
"errors"
"fmt"
"os"

Expand All @@ -18,10 +19,11 @@ import (
// NewUpdateCommand returns a new command to update an existing namespace.
func NewUpdateCommand(l *zap.SugaredLogger) *cobra.Command {
cmd := &cobra.Command{
Use: "update",
Long: "Update an existing Everest namespace",
Short: "Update an existing Everest namespace",
Example: `everestctl update add [NAMESPACE] [FLAGS]`,
Use: "update [flags] NAMESPACES",
Long: "Add database operator to existing namespace managed by Everest",
Short: "Add database operator to existing namespace managed by Everest",
Example: `everestctl namespaces update --operator.mongodb=true --skip-wizard ns-1,ns-2`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
initUpdateViperFlags(cmd)
c := &namespaces.NamespaceAddConfig{}
Expand All @@ -33,10 +35,6 @@ func NewUpdateCommand(l *zap.SugaredLogger) *cobra.Command {
bindInstallHelmOpts(c)
c.Update = true

if len(args) != 1 {
output.PrintError(fmt.Errorf("invalid number of arguments: expected 1, got %d", len(args)), l, true)
os.Exit(1)
}
c.Namespaces = args[0]

enableLogging := viper.GetBool("verbose") || viper.GetBool("json")
Expand All @@ -47,6 +45,12 @@ func NewUpdateCommand(l *zap.SugaredLogger) *cobra.Command {
cmd.Flags().Lookup("operator.xtradb-cluster").Changed)

if err := c.Populate(cmd.Context(), false, askOperators); err != nil {
if errors.Is(err, namespaces.ErrNamespaceNotManagedByEverest) {
err = fmt.Errorf("%w. HINT: use 'everestctl namespaces add --%s %s' first to make namespace managed by Everest",
err,
cli.FlagTakeNamespaceOwnership,
c.Namespaces)
}
output.PrintError(err, l, !enableLogging)
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/operator-framework/api v0.27.0
github.com/operator-framework/operator-lifecycle-manager v0.27.0
github.com/percona/everest-operator v0.6.0-dev1.0.20250113063626-b38e7d1b3932
github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250115071212-bc3ad1c4c054
github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250117110506-e038d85918c5
github.com/rodaine/table v1.3.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.18.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2228,8 +2228,8 @@ github.com/percona/everest-operator v0.6.0-dev1.0.20250113063626-b38e7d1b3932 h1
github.com/percona/everest-operator v0.6.0-dev1.0.20250113063626-b38e7d1b3932/go.mod h1:76ol+aF1CAkDey7kNkqmgtcjdTzJdEMFegfUiGS3q7M=
github.com/percona/percona-backup-mongodb v1.8.1-0.20241002124601-957ac501f939 h1:OggdqSzqe9pO3A4GaRlrLwZXS3zEQ84O4+7Jm9cg74s=
github.com/percona/percona-backup-mongodb v1.8.1-0.20241002124601-957ac501f939/go.mod h1:KhIlTT4wR2mIkMvDtEFerr9zaADJorL7UThSztzxBaY=
github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250115071212-bc3ad1c4c054 h1:8zdmCMqxg6hhGj/Y9SVzf1z+x0NemuT0KsRe51OSKbs=
github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250115071212-bc3ad1c4c054/go.mod h1:j5Ci48Azwb4Xs4XvZQNfleWCn2uyiZywazklxNH1ut4=
github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250117110506-e038d85918c5 h1:+cv7z5tYacTjX7qaya5HYfIp3FB16zmChFKmJTVFLOY=
github.com/percona/percona-helm-charts/charts/everest v0.0.0-20250117110506-e038d85918c5/go.mod h1:j5Ci48Azwb4Xs4XvZQNfleWCn2uyiZywazklxNH1ut4=
github.com/percona/percona-postgresql-operator v0.0.0-20241007204305-35d61aa5aebd h1:9RCUfPUxbdXuL/247r77DJmRSowDzA2xzZC9FpuLuUw=
github.com/percona/percona-postgresql-operator v0.0.0-20241007204305-35d61aa5aebd/go.mod h1:ICbLstSO4zhYo+SFSciIWO9rLHQg29GJ1335L0tfhR0=
github.com/percona/percona-server-mongodb-operator v1.18.0 h1:inRWonCOTacD++D/tvyFXVUqKx7f2OQzz8w1NyT3cAI=
Expand Down

0 comments on commit 00ced55

Please sign in to comment.