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

EVEREST-386: backup name is required #134

Merged
2 commits merged into from
Sep 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions pkg/install/operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,8 @@ func NewOperators(c OperatorsConfig, l *zap.SugaredLogger) (*Operators, error) {

// Run runs the operators installation process.
func (o *Operators) Run(ctx context.Context) error {
if !o.config.SkipWizard {
if err := o.runWizard(ctx); err != nil {
return err
}
}

if o.config.Name == "" {
o.config.Name = o.kubeClient.ClusterName()
if err := o.populateConfig(ctx); err != nil {
return err
}

if o.everestClient == nil {
Expand Down Expand Up @@ -224,6 +218,26 @@ func (o *Operators) Run(ctx context.Context) error {
return o.performProvisioning(ctx)
}

func (o *Operators) populateConfig(ctx context.Context) error {
if !o.config.SkipWizard {
if err := o.runWizard(ctx); err != nil {
return err
}
}

if o.config.Name == "" {
o.config.Name = o.kubeClient.ClusterName()
}

if o.config.Backup.Enable && o.config.Backup.Name == "" {
l := o.l.WithOptions(zap.AddStacktrace(zap.DPanicLevel))
l.Error("Backup name cannot be empty if backup is enabled")
return common.ErrExitWithError
}

return nil
}

func (o *Operators) checkEverestConnection(ctx context.Context) error {
o.l.Info("Checking connection to Everest")
_, err := o.everestClient.ListMonitoringInstances(ctx)
Expand Down