Add option to skip cluster setup
@@ -43,6 +43,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) *cobra.Command {
}
cmd.Flags().BoolVar(&options.clusterSetupOnly, "cluster-setup", false, "Execute cluster-wide operations only (may require admin rights)")
+ cmd.Flags().BoolVar(&options.skipClusterSetup, "skip-cluster-setup", false, "Skip the cluster-setup phase")
cmd.Flags().BoolVar(&options.exampleSetup, "example", false, "Install example integration")
cmd.Flags().StringVar(&options.registry, "registry", "", "A Docker registry that can be used to publish images")
cmd.Flags().StringVarP(&options.outputFormat, "output", "o", "", "Output format. One of: json|yaml")
@@ -56,6 +57,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) *cobra.Command {
type installCmdOptions struct {
*RootCmdOptions
clusterSetupOnly bool
+ skipClusterSetup bool
exampleSetup bool
registry string
outputFormat string
@@ -72,6 +74,7 @@ func (o *installCmdOptions) install(cmd *cobra.Command, args []string) error {
collection = kubernetes.NewCollection()
}
+ if !o.skipClusterSetup {
err := install.SetupClusterwideResourcesOrCollect(collection)
if err != nil && k8serrors.IsForbidden(err) {
fmt.Println("Current user is not authorized to create cluster-wide objects like custom resource definitions or cluster roles: ", err)
@@ -79,6 +82,7 @@ func (o *installCmdOptions) install(cmd *cobra.Command, args []string) error {
} else if err != nil {
return err
}
+ }
if o.clusterSetupOnly {
if collection == nil {
@@ -87,7 +91,7 @@ func (o *installCmdOptions) install(cmd *cobra.Command, args []string) error {
} else {
namespace := o.Namespace
- err = install.OperatorOrCollect(namespace, collection)
+ err := install.OperatorOrCollect(namespace, collection)
if err != nil {
return err
}
