Skip to content

Commit

Permalink
EVEREST-1757 | [CLI] improve post-install message and make consistent…
Browse files Browse the repository at this point in the history
… with helm (#950)

Signed-off-by: Mayank Shah <[email protected]>
  • Loading branch information
mayankshah1607 authored Dec 20, 2024
1 parent d7539ab commit 0a4970c
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cli-tests/tests/flow/all-operators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test.describe('Everest CLI install', async () => {
'✓ Ensuring Everest CatalogSource is ready',
'✓ Ensuring monitoring stack is ready',
'✓ Provisioning database namespaces (everest-all)',
'🚀 Everest has been successfully installed!',
'Thank you for installing Everest',
]);
});
await page.waitForTimeout(10_000);
Expand Down
2 changes: 1 addition & 1 deletion cli-tests/tests/flow/mongodb-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test.describe('Everest CLI install', async () => {
'✓ Ensuring Everest CatalogSource is ready',
'✓ Ensuring monitoring stack is ready',
'✓ Provisioning database namespaces (everest-operators)',
'🚀 Everest has been successfully installed!',
'Thank you for installing Everest',
]);
});
await page.waitForTimeout(10_000);
Expand Down
2 changes: 1 addition & 1 deletion cli-tests/tests/flow/namespaces.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test.describe('Everest CLI install', async () => {
'✓ Ensuring OLM components are ready',
'✓ Ensuring Everest CatalogSource is ready',
'✓ Ensuring monitoring stack is ready',
'🚀 Everest has been successfully installed!',
'Thank you for installing Everest',
]);
});
await page.waitForTimeout(10_000);
Expand Down
2 changes: 1 addition & 1 deletion cli-tests/tests/flow/pg-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test.describe('Everest CLI install', async () => {
'✓ Ensuring Everest CatalogSource is ready',
'✓ Ensuring monitoring stack is ready',
'✓ Provisioning database namespaces (everest-operators)',
'🚀 Everest has been successfully installed!',
'Thank you for installing Everest',
]);
});
await page.waitForTimeout(10_000);
Expand Down
2 changes: 1 addition & 1 deletion cli-tests/tests/flow/pxc-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test.describe('Everest CLI install', async () => {
'✓ Ensuring Everest CatalogSource is ready',
'✓ Ensuring monitoring stack is ready',
'✓ Provisioning database namespaces (everest-operators)',
'🚀 Everest has been successfully installed!',
'Thank you for installing Everest',
]);
});
await page.waitForTimeout(10_000);
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/casbin/casbin/v2 v2.100.0
github.com/casbin/govaluate v1.2.0
github.com/cenkalti/backoff/v4 v4.3.0
github.com/fatih/color v1.17.0
github.com/fatih/color v1.18.0
github.com/getkin/kin-openapi v0.127.0
github.com/go-logr/zapr v1.3.0
github.com/golang-jwt/jwt/v5 v5.2.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1610,8 +1610,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/flosch/pongo2/v6 v6.0.0 h1:lsGru8IAzHgIAw6H2m4PCyleO58I40ow6apih0WprMU=
Expand Down
38 changes: 25 additions & 13 deletions pkg/cli/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"time"

versionpb "github.com/Percona-Lab/percona-version-service/versionpb"
"github.com/fatih/color"
goversion "github.com/hashicorp/go-version"
"github.com/spf13/cobra"
"go.uber.org/zap"
Expand All @@ -51,8 +52,6 @@ const (
pollTimeout = 10 * time.Minute
backoffInterval = 5 * time.Second

postInstallMessage = "Everest has been successfully installed!"

// DefaultDBNamespaceName is the name of the default DB namespace during installation.
DefaultDBNamespaceName = "everest"
)
Expand Down Expand Up @@ -169,7 +168,8 @@ func (o *Install) Run(ctx context.Context) error {
return err
}
o.l.Infof("Everest '%s' has been successfully installed", o.installVersion)
return o.printPostInstallMessage(ctx, out)
o.printPostInstallMessage(out)
return nil
}

func (o *Install) installDBNamespacesStep(ctx context.Context) (*steps.Step, error) {
Expand Down Expand Up @@ -202,17 +202,29 @@ func (o *Install) installDBNamespacesStep(ctx context.Context) (*steps.Step, err
}, nil
}

func (o *Install) printPostInstallMessage(ctx context.Context, out io.Writer) error {
fmt.Fprint(out, "\n", output.Rocket(postInstallMessage))
// Print message to retrieve admin password
isAdminSecure, err := o.kubeClient.Accounts().IsSecure(ctx, common.EverestAdminUser)
if err != nil {
return errors.Join(err, errors.New("could not check if the admin password is secure"))
}
if !isAdminSecure {
fmt.Fprint(out, "\n", common.InitialPasswordWarningMessage)
//nolint:gochecknoglobals
var bold = color.New(color.Bold).SprintFunc()

func (o *Install) printPostInstallMessage(out io.Writer) {
message := "\n" + output.Rocket("Thank you for installing Everest (v%s)!\n", o.installVersion)
message += "Follow the steps below to get started:\n\n"

if len(o.config.NamespaceList) == 0 {
message += bold("PROVISION A NAMESPACE FOR YOUR DATABASE:\n\n")
message += "Install a namespace for your databases using the following command:\n\n"
message += "\teverestctl namespaces add [NAMESPACE]"
message += "\n\n"
}
return nil

message += bold("RETRIEVE THE INITIAL ADMIN PASSWORD:\n\n")
message += common.InitialPasswordWarningMessage + "\n\n"

message += bold("ACCESS THE EVEREST UI:\n\n")
message += "To access the web UI, set up port-forwarding and visit http://localhost:8080 in your browser:\n\n"
message += "\tkubectl port-forward -n everest-system svc/everest-server 8080:80"
message += "\n"

fmt.Fprint(out, message)
}

func (o *Install) setVersionInfo(ctx context.Context) error {
Expand Down
13 changes: 4 additions & 9 deletions pkg/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,7 @@ const (

// InitialPasswordWarningMessage is the message that is shown to the user after the installation/upgrade,
// regarding insecure admin password.
const InitialPasswordWarningMessage = `To view the password for the 'admin' user, run the following command:
everestctl accounts initial-admin-password
IMPORTANT: This password is NOT stored in a hashed format. To secure it, update the password using the following command:
everestctl accounts set-password --username admin
`
const InitialPasswordWarningMessage = "Run the following command to get the initial admin password:\n\n" +
"\teverestctl accounts initial-admin-password\n\n" +
"NOTE: The initial password is stored in plain text. For security, change it immediately using the following command:\n\n" +
"\teverestctl accounts set-password --username admin"

0 comments on commit 0a4970c

Please sign in to comment.