Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
EVEREST-838 fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
recharte committed Feb 14, 2024
1 parent 871a93c commit 5edd882
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
4 changes: 0 additions & 4 deletions pkg/kubernetes/monitoring_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import (
everestv1alpha1 "github.com/percona/everest-operator/api/v1alpha1"
)

const (
monitoringConfigNameLabel = "monitoringConfigName"
)

// ListMonitoringConfigs returns list of managed monitoring configs.
func (k *Kubernetes) ListMonitoringConfigs(ctx context.Context, namespace string) (*everestv1alpha1.MonitoringConfigList, error) {
return k.client.ListMonitoringConfigs(ctx, namespace)
Expand Down
39 changes: 25 additions & 14 deletions pkg/uninstall/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,14 @@ This will uninstall Everest and all its components from the cluster.`
return err
}
if dbsExist {
if !u.config.Force {
confirm := &survey.Confirm{
Message: "There are still database clusters managed by Everest. Do you want to delete them?",
}
prompt := false
if err := survey.AskOne(confirm, &prompt); err != nil {
return err
}
force, err := u.config.Force()

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / Tests (1.21.x)

invalid operation: cannot call non-function u.config.Force (variable of type bool)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / CLI Integration Tests

invalid operation: cannot call non-function u.config.Force (variable of type bool)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / CLI tests (test-pxc-operator) / CLI test-pxc-operator

invalid operation: cannot call non-function u.config.Force (variable of type bool)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / CLI tests (test-all-operators) / CLI test-all-operators

invalid operation: cannot call non-function u.config.Force (variable of type bool)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / CLI tests (test-mongo-operator) / CLI test-mongo-operator

invalid operation: cannot call non-function u.config.Force (variable of type bool)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / CLI tests (test-pg-operator) / CLI test-pg-operator

invalid operation: cannot call non-function u.config.Force (variable of type bool)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / Check (1.21.x, false)

invalid operation: cannot call non-function u.config.Force (variable of type bool) (typecheck)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / Check (1.21.x, false)

invalid operation: cannot call non-function u.config.Force (variable of type bool)) (typecheck)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / Check (1.21.x, false)

invalid operation: cannot call non-function u.config.Force (variable of type bool) (typecheck)

Check failure on line 93 in pkg/uninstall/uninstall.go

View workflow job for this annotation

GitHub Actions / Check (1.21.x, false)

invalid operation: cannot call non-function u.config.Force (variable of type bool)) (typecheck)
if err != nil {
return err
}

if !prompt {
u.l.Info("Can't proceed without deleting database clusters")
return nil
}
if !force {
u.l.Info("Can't proceed without deleting database clusters")
return nil
}

if err := u.deleteDBs(ctx); err != nil {
Expand Down Expand Up @@ -147,6 +142,22 @@ This will uninstall Everest and all its components from the cluster.`
return nil
}

func (u *Uninstall) confirmForce() (bool, error) {
if u.config.Force {
return true, nil
}

confirm := &survey.Confirm{
Message: "There are still database clusters managed by Everest. Do you want to delete them?",
}
prompt := false
if err := survey.AskOne(confirm, &prompt); err != nil {
return false, err
}

return prompt, nil
}

func (u *Uninstall) getDBs(ctx context.Context) (map[string]*everestv1alpha1.DatabaseClusterList, error) {
namespaces, err := u.kubeClient.GetDBNamespaces(ctx, install.SystemNamespace)
if err != nil {
Expand Down Expand Up @@ -259,7 +270,7 @@ func (u *Uninstall) deleteDBNamespaces(ctx context.Context) error {
return u.deleteNamespaces(ctx, namespaces)
}

func (u *Uninstall) deleteBackupStorages(ctx context.Context) error {
func (u *Uninstall) deleteBackupStorages(ctx context.Context) error { //nolint:dupl
storages, err := u.kubeClient.ListBackupStorages(ctx, install.SystemNamespace)
if err != nil {
return err
Expand Down Expand Up @@ -294,7 +305,7 @@ func (u *Uninstall) deleteBackupStorages(ctx context.Context) error {
})
}

func (u *Uninstall) deleteMonitoringConfigs(ctx context.Context) error {
func (u *Uninstall) deleteMonitoringConfigs(ctx context.Context) error { //nolint:dupl
monitoringConfigs, err := u.kubeClient.ListMonitoringConfigs(ctx, install.MonitoringNamespace)
if err != nil {
return err
Expand Down

0 comments on commit 5edd882

Please sign in to comment.