// Module included in the following assemblies:
//
// * operators/admin/olm-managing-operatorconditions.adoc

:_mod-docs-content-type: PROCEDURE
[id="olm-supported-operatorconditions_{context}"]
= Overriding Operator conditions

ifndef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
As a cluster administrator,
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
ifdef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
As an administrator with the `dedicated-admin` role,
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
you might want to ignore a supported Operator condition reported by an Operator. When present, Operator conditions in the `Spec.Overrides` array override the conditions in the `Spec.Conditions` array, allowing
ifndef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
cluster administrators
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
ifdef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
`dedicated-admin` administrators
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
to deal with situations where an Operator is incorrectly reporting a state to Operator Lifecycle Manager (OLM).

[NOTE]
====
By default, the `Spec.Overrides` array is not present in an `OperatorCondition` object until it is added by
ifndef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
a cluster administrator
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
ifdef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
an administrator with the `dedicated-admin` role
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
. The `Spec.Conditions` array is also not present until it is either added by a user or as a result of custom Operator logic.
====

For example, consider a known version of an Operator that always communicates that it is not upgradeable. In this instance, you might want to upgrade the Operator despite the Operator communicating that it is not upgradeable. This could be accomplished by overriding the Operator condition by adding the condition `type` and `status` to the `Spec.Overrides` array in the `OperatorCondition` object.

.Prerequisites

ifndef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
* You have access to the cluster as a user with the `cluster-admin` role.
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
ifdef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
* You have access to the cluster as a user with the `dedicated-admin` role.
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
* An Operator with an `OperatorCondition` object, installed using OLM.

.Procedure

. Edit the `OperatorCondition` object for the Operator:
+
[source,terminal]
----
$ oc edit operatorcondition <name>
----

. Add a `Spec.Overrides` array to the object:
+
.Example Operator condition override
[source,yaml]
----
apiVersion: operators.coreos.com/v2
kind: OperatorCondition
metadata:
  name: my-operator
  namespace: operators
spec:
  overrides:
  - type: Upgradeable
    status: "True"
    reason: "upgradeIsSafe"
    message: "This is a known issue with the Operator where it always reports that it cannot be upgraded."
  conditions:
  - type: Upgradeable
    status: "False"
    reason: "migration"
    message: "The operator is performing a migration."
    lastTransitionTime: "2020-08-24T23:15:55Z"
----
ifndef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
+
Setting the 'type' field to `Upgradeable` allows the cluster administrator to change the upgrade readiness to `True`.
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
ifdef::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
+
Setting the 'type' field to `Upgradeable` allows the `dedicated-admin` user to change the upgrade readiness to `True`.
endif::openshift-dedicated,openshift-rosa,openshift-rosa-hcp[]
