Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding none as option for not installing controllers #3701

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion cmd/gitops/app/bootstrap/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func Command(opts *config.Options) *cobra.Command {
}

cmd.Flags().StringVarP(&flags.version, "version", "v", "", "version of Weave GitOps Enterprise (should be from the latest 3 versions)")
cmd.Flags().StringSliceVar(&flags.componentsExtra, "components-extra", nil, "extra components to be installed. Supported components: policy-agent, tf-controller")
cmd.Flags().StringSliceVar(&flags.componentsExtra, "components-extra", nil, "extra components to be installed. Supported components: none, policy-agent, tf-controller")
cmd.PersistentFlags().BoolVarP(&flags.silent, "silent", "s", false, "non-interactive session: it will not ask questions but rather to use default values to complete the introduced flags")
cmd.PersistentFlags().BoolVarP(&flags.bootstrapFlux, "bootstrap-flux", "", false, "flags that you want to bootstrap Flux in case is not detected")
cmd.PersistentFlags().StringVarP(&flags.gitUsername, "git-username", "", "", "git username used in https authentication type")
Expand Down
10 changes: 5 additions & 5 deletions pkg/bootstrap/steps/components_extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ const (
)

const (
none = "none"
policyAgentController = "policy-agent"
tfController = "tf-controller"
)

var ComponentsExtra = []string{
"",
none,
policyAgentController,
tfController,
}
Expand Down Expand Up @@ -59,7 +60,7 @@ func NewInstallExtraComponentsStep(config ComponentsExtraConfig, silent bool) Bo
Type: multiSelectionChoice,
Msg: componentsExtraMsg,
Values: ComponentsExtra,
DefaultValue: "",
DefaultValue: none,
}

if len(config.Requested) < 1 && !silent {
Expand All @@ -84,6 +85,8 @@ func installExtraComponents(input []StepInput, c *Config) ([]StepOutput, error)
}
for _, controller := range c.ComponentsExtra.Requested {
switch controller {
case none:
return []StepOutput{}, nil
case policyAgentController:
agentStep := NewInstallPolicyAgentStep(*c)
_, err := agentStep.Execute(c)
Expand All @@ -96,9 +99,6 @@ func installExtraComponents(input []StepInput, c *Config) ([]StepOutput, error)
if err != nil {
return []StepOutput{}, fmt.Errorf("can't install tf controller: %v", err)
}
case "":
c.Logger.Successf("selected none extra components")
return []StepOutput{}, nil
default:
return []StepOutput{}, fmt.Errorf("unsupported component selected: %s", controller)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/bootstrap/steps/components_extra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestNewInstallExtraComponents(t *testing.T) {
Type: multiSelectionChoice,
Msg: componentsExtraMsg,
Values: ComponentsExtra,
DefaultValue: "",
DefaultValue: none,
},
},
Step: installExtraComponents,
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestInstallExtraComponents(t *testing.T) {
Name: inComponentsExtra,
Type: multiSelectionChoice,
Msg: componentsExtraMsg,
Value: "",
Value: none,
},
},
},
Expand Down
Loading