Skip to content

Commit b40b65f

Browse files
Prepare for Dev Preview v0.0.5 (#327)
* Prepare for Dev Preview v0.0.5 * Update reconcile for DSC
1 parent 1097d53 commit b40b65f

File tree

6 files changed

+56
-21
lines changed

6 files changed

+56
-21
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
55
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
66
IMAGE_OWNER ?= opendatahub
7-
VERSION ?= 0.0.4
7+
VERSION ?= 0.0.5
88
# IMAGE_TAG_BASE defines the opendatahub.io namespace and part of the image name for remote images.
99
# This variable is used to construct full image tags for bundle and catalog images.
1010
#

bundle/manifests/opendatahub-operator.clusterserviceversion.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ metadata:
1212
operators.operatorframework.io/internal-objects: '[dscinitialization.opendatahub.io]'
1313
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
1414
repository: https://github.com/opendatahub-io/opendatahub-operator
15-
name: opendatahub-operator.v0.0.4
15+
name: opendatahub-operator.v0.0.5
1616
namespace: placeholder
1717
spec:
1818
apiservicedefinitions: {}
@@ -28,6 +28,9 @@ spec:
2828
kind: DSCInitialization
2929
name: dscinitializations.dscinitialization.opendatahub.io
3030
version: v1alpha1
31+
- kind: KfDef
32+
name: kfdefs.kfdef.apps.kubeflow.org
33+
version: v1
3134
- kind: OdhApplication
3235
name: odhapplications.dashboard.opendatahub.io
3336
version: v1
@@ -233,7 +236,7 @@ spec:
233236
- --leader-elect
234237
command:
235238
- /manager
236-
image: quay.io/opendatahub/opendatahub-operator:dev-0.0.4
239+
image: quay.io/opendatahub/opendatahub-operator:dev-0.0.5
237240
imagePullPolicy: Always
238241
livenessProbe:
239242
httpGet:
@@ -321,4 +324,4 @@ spec:
321324
maturity: alpha
322325
provider:
323326
name: ODH
324-
version: 0.0.4
327+
version: 0.0.5

config/manager/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ kind: Kustomization
1313
images:
1414
- name: controller
1515
newName: quay.io/opendatahub/opendatahub-operator
16-
newTag: dev-0.0.4
16+
newTag: dev-0.0.5

controllers/datasciencecluster/datasciencecluster_controller.go

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,40 +108,75 @@ func (r *DataScienceClusterReconciler) Reconcile(ctx context.Context, req ctrl.R
108108
}
109109

110110
// reconcile dashboard component
111-
enabled := r.isComponentEnabled(instance, dashboard.ComponentName, &(instance.Spec.Components.Dashboard), ctx)
111+
enabled := r.isComponentEnabled(&(instance.Spec.Components.Dashboard))
112112
if val, err := r.reconcileSubComponent(instance, dashboard.ComponentName, enabled, &(instance.Spec.Components.Dashboard), ctx); err != nil {
113+
// Update immediately only when error occurs, else skip to end
114+
err := r.Client.Update(ctx, instance)
115+
if err != nil {
116+
r.Log.Info(fmt.Sprintf("failed to set DataScienceCluster component %s to enabled: false", dashboard.ComponentName), "error", err)
117+
// no need to return error as this is not critical and will be reconciled in the next update or reconcile loop
118+
}
113119
// no need to log any errors as this is done in the reconcileSubComponent method
114120
return val, err
115121
}
116122

117123
// reconcile DataSciencePipelines component
118-
enabled = r.isComponentEnabled(instance, datasciencepipelines.ComponentName, &(instance.Spec.Components.DataSciencePipelines), ctx)
124+
enabled = r.isComponentEnabled(&(instance.Spec.Components.DataSciencePipelines))
119125
if val, err := r.reconcileSubComponent(instance, datasciencepipelines.ComponentName, enabled, &(instance.Spec.Components.DataSciencePipelines), ctx); err != nil {
126+
// Update immediately only when error occurs, else skip to end
127+
err := r.Client.Update(ctx, instance)
128+
if err != nil {
129+
r.Log.Info(fmt.Sprintf("failed to set DataScienceCluster component %s to enabled: false", datasciencepipelines.ComponentName), "error", err)
130+
// no need to return error as this is not critical and will be reconciled in the next update or reconcile loop
131+
}
120132
// no need to log any errors as this is done in the reconcileSubComponent method
121133
return val, err
122134
}
123135

124136
// reconcile ModelMesh component
125-
enabled = r.isComponentEnabled(instance, modelmeshserving.ComponentName, &(instance.Spec.Components.ModelMeshServing), ctx)
137+
enabled = r.isComponentEnabled(&(instance.Spec.Components.ModelMeshServing))
126138
if val, err := r.reconcileSubComponent(instance, modelmeshserving.ComponentName, enabled, &(instance.Spec.Components.ModelMeshServing), ctx); err != nil {
139+
// Update immediately only when error occurs, else skip to end
140+
err := r.Client.Update(ctx, instance)
141+
if err != nil {
142+
r.Log.Info(fmt.Sprintf("failed to set DataScienceCluster component %s to enabled: false", modelmeshserving.ComponentName), "error", err)
143+
// no need to return error as this is not critical and will be reconciled in the next update or reconcile loop
144+
}
127145
// no need to log any errors as this is done in the reconcileSubComponent method
128146
return val, err
129147
}
130148

131149
// reconcile Workbench component
132-
enabled = r.isComponentEnabled(instance, workbenches.ComponentName, &(instance.Spec.Components.Workbenches), ctx)
150+
enabled = r.isComponentEnabled(&(instance.Spec.Components.Workbenches))
133151
if val, err := r.reconcileSubComponent(instance, workbenches.ComponentName, enabled, &(instance.Spec.Components.Workbenches), ctx); err != nil {
152+
// Update immediately only when error occurs, else skip to end
153+
err := r.Client.Update(ctx, instance)
154+
if err != nil {
155+
r.Log.Info(fmt.Sprintf("failed to set DataScienceCluster component %s to enabled: false", workbenches.ComponentName), "error", err)
156+
// no need to return error as this is not critical and will be reconciled in the next update or reconcile loop
157+
}
134158
// no need to log any errors as this is done in the reconcileSubComponent method
135159
return val, err
136160
}
137161

138162
// reconcile Kserve component
139-
enabled = r.isComponentEnabled(instance, kserve.ComponentName, &(instance.Spec.Components.Kserve), ctx)
163+
enabled = r.isComponentEnabled(&(instance.Spec.Components.Kserve))
140164
if val, err := r.reconcileSubComponent(instance, kserve.ComponentName, enabled, &(instance.Spec.Components.Kserve), ctx); err != nil {
165+
err := r.Client.Update(ctx, instance)
166+
if err != nil {
167+
r.Log.Info(fmt.Sprintf("failed to set DataScienceCluster component %s to enabled: false", kserve.ComponentName), "error", err)
168+
// no need to return error as this is not critical and will be reconciled in the next update or reconcile loop
169+
}
141170
// no need to log any errors as this is done in the reconcileSubComponent method
142171
return val, err
143172
}
144173

174+
// Update final state of spec
175+
err = r.Client.Update(ctx, instance)
176+
if err != nil {
177+
r.Log.Info(fmt.Sprintf("failed to set DataScienceCluster CR :%v", instance.Name), "error", err)
178+
// no need to return error as this is not critical and will be reconciled in the next update or reconcile loop
179+
}
145180
// finalize reconciliation
146181
status.SetCompleteCondition(&instance.Status.Conditions, status.ReconcileCompleted, "DataScienceCluster resource reconciled successfully.")
147182
err = r.Client.Status().Update(ctx, instance)
@@ -162,14 +197,9 @@ func (r *DataScienceClusterReconciler) Reconcile(ctx context.Context, req ctrl.R
162197
return ctrl.Result{}, nil
163198
}
164199

165-
func (r *DataScienceClusterReconciler) isComponentEnabled(instance *dsc.DataScienceCluster, componentName string, component components.ComponentInterface, ctx context.Context) bool {
200+
func (r *DataScienceClusterReconciler) isComponentEnabled(component components.ComponentInterface) bool {
166201
if component.IsEnabled() == nil {
167202
component.SetEnabled(false)
168-
err := r.Client.Update(ctx, instance)
169-
if err != nil {
170-
r.reportError(err, instance, ctx, fmt.Sprintf("failed to set DataScienceCluster component %s to enabled: false", componentName))
171-
// no need to return error as this is not critical and will be reconciled in the next update or reconcile loop
172-
}
173203
}
174204
return *component.IsEnabled()
175205
}

controllers/dscinitialization/utils.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ func (r *DSCInitializationReconciler) createOdhNamespace(dscInit *dsci.DSCInitia
6060
if apierrs.IsNotFound(err) {
6161
r.Log.Info("Creating namespace", "name", name)
6262
// Set Controller reference
63-
err = ctrl.SetControllerReference(dscInit, desiredNamespace, r.Scheme)
64-
if err != nil {
65-
r.Log.Error(err, "Unable to add OwnerReference to the Namespace")
66-
return err
67-
}
63+
//err = ctrl.SetControllerReference(dscInit, desiredNamespace, r.Scheme)
64+
//if err != nil {
65+
// r.Log.Error(err, "Unable to add OwnerReference to the Namespace")
66+
// return err
67+
//}
6868
err = r.Create(ctx, desiredNamespace)
6969
if err != nil && !apierrs.IsAlreadyExists(err) {
7070
r.Log.Error(err, "Unable to create namespace", "name", name)

docs/Dev-Preview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ released in phases and will be made available before release in the form of a `c
6363
publisher: ODH
6464
EOF
6565
```
66+
67+
2. Select `fast` channel to update
6668

6769
## Usage
6870

0 commit comments

Comments
 (0)