diff --git a/cmd/flux/cluster_info.go b/cmd/flux/cluster_info.go index 77c367b9ec..0a1f59bfdd 100644 --- a/cmd/flux/cluster_info.go +++ b/cmd/flux/cluster_info.go @@ -40,15 +40,18 @@ var bootstrapLabels = []string{ type fluxClusterInfo struct { // bootstrapped indicates that Flux was installed using the `flux bootstrap` command. bootstrapped bool - // managedBy is the name of the manager who installed Flux. + // managedBy is the name of the tool being used to manage the installation of Flux. managedBy string // version is the Flux version number in semver format. version string } -// getFluxClusterInfo checks the GitRepository CRD for labels passed into the function. It returns the version of Flux -// (from the app.kubernetes.io/version label), a boolean to indicate whether the CRD was found -// with the required labels and an error if the CRD query failed. +// getFluxClusterInfo returns information on the Flux installation running on the cluster. +// If the information cannot be retrieved, the boolean return value will be false. +// If an error occurred, the returned error will be non-nil. +// +// This function retrieves the GitRepository CRD from the cluster and checks it +// for a set of labels used to determine the Flux version and how Flux was installed. func getFluxClusterInfo(ctx context.Context, c client.Client) (fluxClusterInfo, bool, error) { var info fluxClusterInfo crdMetadata := &metav1.PartialObjectMetadata{ diff --git a/cmd/flux/install.go b/cmd/flux/install.go index 578d044f5c..6580c0e4d5 100644 --- a/cmd/flux/install.go +++ b/cmd/flux/install.go @@ -190,7 +190,7 @@ func installCmdRun(cmd *cobra.Command, args []string) error { info, installed, err := getFluxClusterInfo(ctx, kubeClient) if err != nil { - return fmt.Errorf("error checking for exisiting flux installation: %w", err) + return fmt.Errorf("cluster info unavailable: %w", err) } if installed && info.bootstrapped {