Skip to content

Commit

Permalink
Rename GetPlatform functions to not reflect implementation (opendatah…
Browse files Browse the repository at this point in the history
…ub-io#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 <ykaliuta@redhat.com>

* 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 <ykaliuta@redhat.com>

---------

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
  • Loading branch information
ykaliuta authored Sep 13, 2024
1 parent 10dd554 commit b4c880a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,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
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,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")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion pkg/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,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
Expand Down

0 comments on commit b4c880a

Please sign in to comment.