Skip to content

Commit

Permalink
add: check for if KfDef CRD already in the cluster (opendatahub-io#664)
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw authored Oct 25, 2023
1 parent b17ad7a commit f8a23a5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,22 @@ func UpdateFromLegacyVersion(cli client.Client, platform deploy.Platform) error
return nil
}

// If KfDef CRD is not found, we see it as a cluster not pre-installed v1 operator // Check if kfdef are deployed
kfdefCrd := &apiextv1.CustomResourceDefinition{}
err := cli.Get(context.TODO(), client.ObjectKey{Name: "kfdefs.kfdef.apps.kubeflow.org"}, kfdefCrd)
if err != nil {
if apierrs.IsNotFound(err) {
// If no Crd found, return, since its a new Installation
return nil
} else {
return fmt.Errorf("error retrieving kfdef CRD : %v", err)
}
}

// If KfDef Instances found, and no DSC instances are found in Self-managed, that means this is an upgrade path from
// legacy version. Create a default DSC instance
kfDefList := &kfdefv1.KfDefList{}
err := cli.List(context.TODO(), kfDefList)
err = cli.List(context.TODO(), kfDefList)
if err != nil {
if apierrs.IsNotFound(err) {
// If no KfDefs, do nothing and return
Expand Down

0 comments on commit f8a23a5

Please sign in to comment.