forked from opendatahub-io/opendatahub-operator
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from crobby/110picksbranch
picking changes to v1.0.0 branch for v1.0.10
- Loading branch information
Showing
5 changed files
with
101 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule odh-manifests
updated
36 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package kfdef | ||
|
||
import ( | ||
"context" | ||
"reflect" | ||
|
||
kfdefv1 "github.com/kubeflow/kfctl/v3/pkg/apis/apps/kfdef/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
const DeploymentCompleted string = "Kubeflow Deployment completed" | ||
|
||
// The setKfDefStatus method accepts a custom resource of type KfDef type | ||
// It retrieves the current stored version of the resource and compares the | ||
// status subresource. If different, the status is updated | ||
func (r *ReconcileKfDef) setKfDefStatus(cr *kfdefv1.KfDef) error { | ||
ctx := context.Background() | ||
objKey := types.NamespacedName{ | ||
Namespace: cr.Namespace, | ||
Name: cr.Name, | ||
} | ||
current := &kfdefv1.KfDef{} | ||
if err := r.client.Get(ctx, objKey, current); err != nil { | ||
return err | ||
} | ||
|
||
if !reflect.DeepEqual(cr.Status, current.Status) { | ||
current.Status = cr.Status | ||
return r.client.Status().Update(ctx, current) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (r *ReconcileKfDef) reconcileStatus(cr *kfdefv1.KfDef) error { | ||
return r.setKfDefStatus(cr) | ||
} | ||
|
||
func getReconcileStatus(cr *kfdefv1.KfDef, err error) error { | ||
conditions := []kfdefv1.KfDefCondition{} | ||
|
||
if err != nil { | ||
conditions = append(conditions, kfdefv1.KfDefCondition{ | ||
LastUpdateTime: cr.CreationTimestamp, | ||
Status: corev1.ConditionTrue, | ||
Reason: err.Error(), | ||
Type: kfdefv1.KfDegraded, | ||
}) | ||
} | ||
|
||
conditions = append(conditions, kfdefv1.KfDefCondition{ | ||
LastUpdateTime: cr.CreationTimestamp, | ||
Status: corev1.ConditionTrue, | ||
Reason: DeploymentCompleted, | ||
Type: kfdefv1.KfAvailable, | ||
}) | ||
|
||
cr.Status.Conditions = conditions | ||
|
||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
"""opendatahub operator.""" | ||
|
||
|
||
__version__ = "1.0.1" | ||
__version__ = "1.0.10" |