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 <[email protected]>

* 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 <[email protected]>

---------

Signed-off-by: Yauheni Kaliuta <[email protected]>
(cherry picked from commit b4c880a)
  • Loading branch information
ykaliuta authored and zdtsw committed Sep 16, 2024
1 parent 92ac207 commit ad7fbda
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 @@ -224,7 +224,7 @@ func main() {
os.Exit(1)
}
// 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 @@ -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
Expand Down

0 comments on commit ad7fbda

Please sign in to comment.