Skip to content

Commit

Permalink
Merge branch 'incubation' into automate-audiences
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszmajsak committed Apr 15, 2024
2 parents a27dba9 + ef977c2 commit 65887e4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
12 changes: 6 additions & 6 deletions components/datasciencepipelines/datasciencepipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ func UnmanagedArgoWorkFlowExists(ctx context.Context,
}
return fmt.Errorf("failed to get existing Workflow CRD : %w", err)
}
// Verify if existing workflow is deployed by ODH
_, odhLabelExists := workflowCRD.Labels[labels.ODH.Component(ComponentName)]
if odhLabelExists {
return nil
// Verify if existing workflow is deployed by ODH with label
odhLabelValue, odhLabelExists := workflowCRD.Labels[labels.ODH.Component(ComponentName)]
if odhLabelExists && odhLabelValue != "true" {
return fmt.Errorf(" %v CRD already exists but not deployed by this operator. Remove existing Argo workflows or set datasciencepipelines to Removed to proceed ",
ArgoWorkflowCRD)
}
return fmt.Errorf(" %v CRD already exists but not deployed by this operator. Remove existing Argo workflows or set datasciencepipelines to Removed to proceed ",
ArgoWorkflowCRD)
return nil
}
11 changes: 7 additions & 4 deletions controllers/datasciencecluster/datasciencecluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import (
"github.com/opendatahub-io/opendatahub-operator/v2/components/datasciencepipelines"
"github.com/opendatahub-io/opendatahub-operator/v2/controllers/status"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/cluster"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/metadata/labels"
"github.com/opendatahub-io/opendatahub-operator/v2/pkg/upgrade"
)

Expand Down Expand Up @@ -473,11 +474,13 @@ func (r *DataScienceClusterReconciler) watchDataScienceClusterResources(a client
var argoWorkflowCRDPredicates = predicate.Funcs{
DeleteFunc: func(e event.DeleteEvent) bool {
if e.Object.GetName() == datasciencepipelines.ArgoWorkflowCRD {
labels := e.Object.GetLabels()
if _, ok := labels["app.opendatahub.io/"+datasciencepipelines.ComponentName]; !ok {
return true
labelList := e.Object.GetLabels()
// CRD to be deleted with label "app.opendatahub.io/datasciencepipeline":"true", should not trigger reconcile
if value, exist := labelList[labels.ODH.Component(datasciencepipelines.ComponentName)]; exist && value == "true" {
return false
}
}
return false
// CRD to be deleted either not with label or label value is not "true", should trigger reconcile
return true
},
}
2 changes: 1 addition & 1 deletion pkg/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func manageResource(ctx context.Context, cli client.Client, obj *unstructured.Un
// TODO: Remove this when we have generalize custom config requirements across all components
if componentName == "kserve" {
// do not reconcile kserve resource with annotation "opendatahub.io/managed: false"
if found.GetAnnotations()[annotation.ManagedAnnotation] == "false" {
if found.GetAnnotations()[annotation.ManagedByODHOperator] == "false" {
return nil
}
// do not patch resources field in Kserve deployment i.e allows users to update resources field
Expand Down
2 changes: 1 addition & 1 deletion pkg/metadata/annotations/annoations.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package annotations

// skip reconcile.
const ManagedAnnotation = "opendatahub.io/managed"
const ManagedByODHOperator = "opendatahub.io/managed"

// trust CA bundler.
const InjectionOfCABundleAnnotatoion = "security.opendatahub.io/inject-trusted-ca-bundle"
Expand Down

0 comments on commit 65887e4

Please sign in to comment.