Skip to content

Commit

Permalink
Merge pull request #51 from crobby/110picksbranch
Browse files Browse the repository at this point in the history
picking changes to v1.0.0 branch for v1.0.10
  • Loading branch information
Chad Roberts authored Apr 22, 2021
2 parents 05d8306 + 138fd20 commit 1d43d94
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 6 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,22 @@
## Release 1.0.1 (2021-02-18T20:31:05)
### Features
* Update .thoth.yaml
### Bug Fix
* Rebase the version string with latest release (#104)

## Release 1.0.6 (2021-03-25T17:17:12)
### Bug Fix
* Bump version to v1.0.5 for kebechet bot (#109)

## Release 1.0.9 (2021-04-15T16:14:40)
### Improvements
* Fix imagestream watch (#118)
* Update resource watches (#116)
### Features
* Implement clean uninstall of operator (#117)

## Release 1.0.10 (2021-04-22T13:13:22)
### Improvements
* Update ODH operator to reconcile updated objects (#119)
### Features
* Implement initial KfDef status (#113)
2 changes: 1 addition & 1 deletion odh-manifests
Submodule odh-manifests updated 36 files
+15 −0 CHANGELOG.md
+0 −0 grafana/grafana/base/argo-dashboards/argo-dashboard.yaml
+5 −0 grafana/grafana/base/argo-dashboards/kustomization.yaml
+0 −0 grafana/grafana/base/jupyterhub-dashboards/jupyterhub-sli-dashboard.yaml
+0 −0 grafana/grafana/base/jupyterhub-dashboards/jupyterhub-sli-slo.json
+0 −0 grafana/grafana/base/jupyterhub-dashboards/jupyterhub-usage-dashboard.yaml
+0 −0 grafana/grafana/base/jupyterhub-dashboards/jupyterhub-usage.json
+23 −0 grafana/grafana/base/jupyterhub-dashboards/kustomization.yaml
+0 −0 grafana/grafana/base/kafka-dashboards/kafka-dashboard.yaml
+5 −0 grafana/grafana/base/kafka-dashboards/kustomization.yaml
+8 −14 grafana/grafana/base/kustomization.yaml
+1 −1 jupyterhub/jupyterhub/base/jupyterhub-img-imagestream.yaml
+14 −0 jupyterhub/jupyterhub/base/jupyterhub-nodereader-rolebinding.yaml
+0 −26 jupyterhub/jupyterhub/base/jupyterhub-singleuser-profiles-configmap.yaml
+33 −0 jupyterhub/jupyterhub/base/jupyterhub-singleuser-profiles-sizes-configmap.yaml
+2 −0 jupyterhub/jupyterhub/base/kustomization.yaml
+2 −0 jupyterhub/jupyterhub/base/params.yaml
+3 −0 jupyterhub/jupyterhub/overrides/overlays/jupyterhub-db-deployment-patch/jupyterhub-db-patch.yaml
+13 −0 jupyterhub/jupyterhub/overrides/overlays/jupyterhub-db-deployment-patch/kustomization.yaml
+6 −0 jupyterhub/jupyterhub/overrides/overlays/jupyterhub-deployment-patch/jupyterhub-patch.yaml
+13 −1 jupyterhub/notebook-images/overlays/additional/minimal-notebook-imagestream.yaml
+33 −0 jupyterhub/notebook-images/overlays/cuda-11.0.3/gpu-notebook.yaml
+2 −1 kafka/cluster/base/subscription.yaml
+27 −130 kafka/kafka/base/kafka-cluster.yaml
+130 −0 kafka/kafka/base/kafka-metrics-config.yaml
+1 −1 kafka/kafka/base/kustomization.yaml
+12 −0 odh-dashboard/base/cluster-role-binding.yaml
+29 −0 odh-dashboard/base/cluster-role.yaml
+1 −1 odh-dashboard/base/deployment.yaml
+2 −0 odh-dashboard/base/kustomization.yaml
+35 −0 odh-dashboard/base/role.yaml
+1 −1 openshift-pipelines/cluster/base/subscription.yaml
+23 −0 partners/anaconda/base/anaconda-ce-imagestream.yaml
+34 −0 partners/anaconda/base/anaconda-ce-validator-cron.yaml
+9 −0 partners/anaconda/base/kustomization.yaml
+7 −0 tests/scripts/installandtest.sh
22 changes: 18 additions & 4 deletions pkg/controller/kfdef/kfdef_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,17 @@ var ownedResourcePredicates = predicate.Funcs{
return true
},
UpdateFunc: func(e event.UpdateEvent) bool {
// no action
return false
// handle update events
object, err := meta.Accessor(e.ObjectOld)
if err != nil {
return false
}
log.Infof("Got update event for %v.%v.", object.GetName(), object.GetNamespace())
// if this object has an owner, let the owner handle the appropriate recovery
if len(object.GetOwnerReferences()) > 0 {
return false
}
return true
},
}

Expand Down Expand Up @@ -361,7 +370,7 @@ func (r *ReconcileKfDef) Reconcile(request reconcile.Request) (reconcile.Result,
}
}

err = kfApply(instance)
err = getReconcileStatus(instance, kfApply(instance))
if err == nil {
log.Infof("KubeFlow Deployment Completed.")

Expand All @@ -370,7 +379,7 @@ func (r *ReconcileKfDef) Reconcile(request reconcile.Request) (reconcile.Result,
kfdefInstances[strings.Join([]string{instance.GetName(), instance.GetNamespace()}, ".")] = struct{}{}
}

if b2ndController == false {
if !b2ndController {
c, err := controller.New("kubeflow-controller", kfdefManager, controller.Options{Reconciler: r})
if err != nil {
return reconcile.Result{}, nil
Expand Down Expand Up @@ -400,6 +409,11 @@ func (r *ReconcileKfDef) Reconcile(request reconcile.Request) (reconcile.Result,
return reconcile.Result{Requeue: true}, nil
}

// set status of the KfDef resource
if err := r.reconcileStatus(instance); err != nil {
return reconcile.Result{}, err
}

// If deployment created successfully - don't requeue
return reconcile.Result{}, err
}
Expand Down
62 changes: 62 additions & 0 deletions pkg/controller/kfdef/status.go
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
}
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"""opendatahub operator."""


__version__ = "1.0.1"
__version__ = "1.0.10"

0 comments on commit 1d43d94

Please sign in to comment.