Skip to content

Commit

Permalink
move check so --export still works
Browse files Browse the repository at this point in the history
Signed-off-by: Somtochi Onyekwere <[email protected]>
  • Loading branch information
somtochiama committed Oct 19, 2023
1 parent 36be24a commit 32e9be6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions cmd/flux/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,6 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
return err
}

kubeClient, err := utils.KubeClient(kubeconfigArgs, kubeclientOptions)
if err != nil {
return err
}

info, installed, err := getFluxClusterInfo(ctx, kubeClient)
if err != nil {
return fmt.Errorf("error checking for exisiting flux installation: %w", err)
}

if installed && info.bootstrapped {
return fmt.Errorf("this cluster has been bootstrapped with Flux %s! Please use 'flux bootstrap' to upgrade", info.version)
}

if ver, err := getVersion(installArgs.version); err != nil {
return err
} else {
Expand Down Expand Up @@ -197,6 +183,20 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
logger.Successf("manifests build completed")
logger.Actionf("installing components in %s namespace", *kubeconfigArgs.Namespace)

kubeClient, err := utils.KubeClient(kubeconfigArgs, kubeclientOptions)
if err != nil {
return err
}

info, installed, err := getFluxClusterInfo(ctx, kubeClient)
if err != nil {
return fmt.Errorf("error checking for exisiting flux installation: %w", err)
}

if installed && info.bootstrapped {
return fmt.Errorf("this cluster has already been bootstrapped with Flux %s! Please use 'flux bootstrap' to upgrade", info.version)
}

applyOutput, err := utils.Apply(ctx, kubeconfigArgs, kubeclientOptions, tmpDir, filepath.Join(tmpDir, manifest.Path))
if err != nil {
return fmt.Errorf("install failed: %w", err)
Expand Down

0 comments on commit 32e9be6

Please sign in to comment.