Skip to content

Commit

Permalink
fix clusterVersion check
Browse files Browse the repository at this point in the history
Signed-off-by: Thibault Mange <[email protected]>
  • Loading branch information
thibaultmg committed Jul 17, 2024
1 parent 5573a19 commit 4cbaacf
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,15 @@ func (r *ObservabilityAddonReconciler) Reconcile(ctx context.Context, req ctrl.R

clusterID, err = openshift.GetClusterID(ctx, r.Client)
if err != nil {
if !errors.IsNotFound(err) {
if errors.IsInvalid(err) {
// ClusterVersion kind does not exist in OCP 3.x
log.Info("ClusterVersion kind does not exist in OCP 3.x")
} else if errors.IsNotFound(err) {
return ctrl.Result{}, fmt.Errorf("failed to get cluster id: %w", err)
} else {
// TODO: once the IsInvalid check is validated on OCP 3.x, return error instead of logging (merge with the previous if block)
log.Error(err, "Failed to get cluster id")
}
log.Error(err, "Failed to get cluster id")

// OCP 3.11 has no cluster id, set it as empty string
clusterID = ""
Expand Down

0 comments on commit 4cbaacf

Please sign in to comment.