From 53ffc496e5f2041db3e455a42ccbcd8ce216dd80 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Fri, 13 Sep 2024 15:44:39 +0300 Subject: [PATCH] Rename GetPlatform functions to not reflect implementation (#1232) * upgrade: rename GetReleaseFromCR to GetDeployedRelease GetReleaseFromCR name is more about implementation than the task it performs. The function fetches release from DSC/DSCI mean the latest release the data science cluster was deployed by. Consider it as "deployed release". Signed-off-by: Yauheni Kaliuta * cluster: rename GetReleaseFromCSV back to GetRelease GetReleaseFromCSV name is more about implementation than the task it performs. The function fetches actual running operator release and CSV is only one possibility for that. Signed-off-by: Yauheni Kaliuta --------- Signed-off-by: Yauheni Kaliuta (cherry picked from commit b4c880a730928f4f68014df386ad1d918094dfd9) --- controllers/datasciencecluster/datasciencecluster_controller.go | 2 +- controllers/dscinitialization/dscinitialization_controller.go | 2 +- main.go | 2 +- pkg/cluster/cluster_config.go | 2 +- pkg/upgrade/upgrade.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/datasciencecluster/datasciencecluster_controller.go b/controllers/datasciencecluster/datasciencecluster_controller.go index 8d9be2d69f8..ab6e6c2d603 100644 --- a/controllers/datasciencecluster/datasciencecluster_controller.go +++ b/controllers/datasciencecluster/datasciencecluster_controller.go @@ -85,7 +85,7 @@ func (r *DataScienceClusterReconciler) Reconcile(ctx context.Context, req ctrl.R r.Log.Info("Reconciling DataScienceCluster resources", "Request.Name", req.Name) // Get information on version - currentOperatorReleaseVersion, err := cluster.GetReleaseFromCSV(ctx, r.Client) + currentOperatorReleaseVersion, err := cluster.GetRelease(ctx, r.Client) if err != nil { r.Log.Error(err, "failed to get operator release version") return ctrl.Result{}, err diff --git a/controllers/dscinitialization/dscinitialization_controller.go b/controllers/dscinitialization/dscinitialization_controller.go index 56b166756c0..7ca934682a5 100644 --- a/controllers/dscinitialization/dscinitialization_controller.go +++ b/controllers/dscinitialization/dscinitialization_controller.go @@ -80,7 +80,7 @@ type DSCInitializationReconciler struct { func (r *DSCInitializationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { //nolint:funlen,gocyclo,maintidx r.Log.Info("Reconciling DSCInitialization.", "DSCInitialization Request.Name", req.Name) - currentOperatorReleaseVersion, err := cluster.GetReleaseFromCSV(ctx, r.Client) + currentOperatorReleaseVersion, err := cluster.GetRelease(ctx, r.Client) if err != nil { r.Log.Error(err, "failed to get operator release version") return ctrl.Result{}, err diff --git a/main.go b/main.go index 8288610fc24..aa14a070712 100644 --- a/main.go +++ b/main.go @@ -250,7 +250,7 @@ func main() { //nolint:funlen,maintidx } // get old release version before we create default DSCI CR - oldReleaseVersion, _ := upgrade.GetReleaseFromCR(ctx, setupClient) + oldReleaseVersion, _ := upgrade.GetDeployedRelease(ctx, setupClient) // Check if user opted for disabling DSC configuration disableDSCConfig, existDSCConfig := os.LookupEnv("DISABLE_DSC_CONFIG") diff --git a/pkg/cluster/cluster_config.go b/pkg/cluster/cluster_config.go index 6e2707dbfa6..a1c462aeeee 100644 --- a/pkg/cluster/cluster_config.go +++ b/pkg/cluster/cluster_config.go @@ -133,7 +133,7 @@ type Release struct { Version version.OperatorVersion `json:"version,omitempty"` } -func GetReleaseFromCSV(ctx context.Context, cli client.Client) (Release, error) { +func GetRelease(ctx context.Context, cli client.Client) (Release, error) { initRelease := Release{ // dummy version set to name "", version 0.0.0 Version: version.OperatorVersion{ diff --git a/pkg/upgrade/upgrade.go b/pkg/upgrade/upgrade.go index 93f94b9c071..449353fd6c2 100644 --- a/pkg/upgrade/upgrade.go +++ b/pkg/upgrade/upgrade.go @@ -513,7 +513,7 @@ func deleteDeprecatedNamespace(ctx context.Context, cli client.Client, namespace return nil } -func GetReleaseFromCR(ctx context.Context, cli client.Client) (cluster.Release, error) { +func GetDeployedRelease(ctx context.Context, cli client.Client) (cluster.Release, error) { dsciInstance := &dsciv1.DSCInitializationList{} if err := cli.List(ctx, dsciInstance); err != nil { return cluster.Release{}, err