Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jclaret/8781043f99be8c3ae3d956dd806b62f5 to your computer and use it in GitHub Desktop.
Save jclaret/8781043f99be8c3ae3d956dd806b62f5 to your computer and use it in GitHub Desktop.
How to approve OpenShift operator upgrade using CLI

Install the operator using the Manual approval strategy

cat <<EOF| oc apply -f -
apiVersion: v1
kind: Namespace
metadata:
  name: amq
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  labels:
    operators.coreos.com/amq7-interconnect-operator.amq: ""
  name: amq7-interconnect-operator
  namespace: amq
spec:
  channel: 1.10.x
  installPlanApproval: Manual
  name: amq7-interconnect-operator
  source: redhat-operators
  sourceNamespace: openshift-marketplace
  startingCSV: amq7-interconnect-operator.v1.10.14
EOF

An install plan has been created but not executed as it has not been approved:

oc get installplan -n amq
NAME            CSV                                    APPROVAL   APPROVED
install-qrpp8   amq7-interconnect-operator.v1.10.14   Manual     true

Approve the installation of the operator by updating the approved field of the InstallPlan:

$ oc patch installplan install-qrpp8 \
    --namespace amq \
    --type merge \
    --patch '{"spec":{"approved":true}}'

Check that the operator has been installed:

NAME                                  DISPLAY                                  VERSION   REPLACES   PHASE
amq7-interconnect-operator.v1.10.14   Red Hat Integration - AMQ Interconnect   1.10.14              Succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment