$ oc get subscription metallb-operator -n metallb-system -o yaml | grep currentCSV
The automatic upgrade procedure does not work as expected from OpenShift Container Platform 4.10 and earlier. A summary of the upgrade procedure is as follows:
Delete the previously installed Operator version for example 4.10. Ensure that the namespace and the metallb
custom resource are not removed.
Install the 4.11 version of the Operator using the CLI. Install the 4.11 version of the Operator in the same namespace that the previously installed Operator version was installed to.
This procedure does not apply to automatic z-stream updates of the MetalLB Operator, which follow the standard straightforward method. |
For detailed steps to upgrade the MetalLB Operator from 4.10 and earlier, see the guidance that follows. As a cluster administrator, start the upgrade process by deleting the MetalLB Operator by using the OpenShift CLI (oc
) or the web console.
Cluster administrators can delete installed Operators from a selected namespace by using the web console.
Access to an OpenShift Container Platform cluster web console using an account with
cluster-admin
permissions.
Navigate to the Operators → Installed Operators page.
Search for the MetalLB Operator. Then, click on it.
On the right side of the Operator Details page, select Uninstall Operator from the Actions drop-down menu.
An Uninstall Operator? dialog box is displayed.
Select Uninstall to remove the Operator, Operator deployments, and pods. Following this action, the Operator stops running and no longer receives updates.
This action does not remove resources managed by the Operator, including custom resource definitions (CRDs) and custom resources (CRs). Dashboards and navigation items enabled by the web console and off-cluster resources that continue to run might need manual clean up. To remove these after uninstalling the Operator, you might need to manually delete the Operator CRDs. |
Cluster administrators can delete installed Operators from a selected namespace by using the CLI.
Access to an OpenShift Container Platform cluster using an account with
cluster-admin
permissions.
oc
command installed on workstation.
Check the current version of the subscribed MetalLB Operator in the currentCSV
field:
$ oc get subscription metallb-operator -n metallb-system -o yaml | grep currentCSV
currentCSV: metallb-operator.4.10.0-202207051316
Delete the subscription:
$ oc delete subscription metallb-operator -n metallb-system
subscription.operators.coreos.com "metallb-operator" deleted
Delete the CSV for the Operator in the target namespace using the currentCSV
value from the previous step:
$ oc delete clusterserviceversion metallb-operator.4.10.0-202207051316 -n metallb-system
clusterserviceversion.operators.coreos.com "metallb-operator.4.10.0-202207051316" deleted
When upgrading from any MetalLB Operator version up to and including 4.10 to 4.11 and later, remove spec.targetNamespaces
from the Operator group custom resource (CR). You must remove the spec regardless of whether you used the web console or the CLI to delete the MetalLB Operator.
The MetalLB Operator version 4.11 or later only supports the |
You have access to an OpenShift Container Platform cluster with cluster-admin
permissions.
You have installed the OpenShift CLI (oc
).
List the Operator groups in the metallb-system
namespace by running the following command:
$ oc get operatorgroup -n metallb-system
NAME AGE
metallb-system-7jc66 85m
Verify that the spec.targetNamespaces
is present in the Operator group CR associated with the metallb-system
namespace by running the following command:
$ oc get operatorgroup metallb-system-7jc66 -n metallb-system -o yaml
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
annotations:
olm.providedAPIs: ""
creationTimestamp: "2023-10-25T09:42:49Z"
generateName: metallb-system-
generation: 1
name: metallb-system-7jc66
namespace: metallb-system
resourceVersion: "25027"
uid: f5f644a0-eef8-4e31-a306-e2bbcfaffab3
spec:
targetNamespaces:
- metallb-system
upgradeStrategy: Default
status:
lastUpdated: "2023-10-25T09:42:49Z"
namespaces:
- metallb-system
Edit the Operator group and remove the targetNamespaces
and metallb-system
present under the spec
section by running the following command:
$ oc edit n metallb-system
operatorgroup.operators.coreos.com/metallb-system-7jc66 edited
Verify the spec.targetNamespaces
is removed from the Operator group custom resource associated with the metallb-system
namespace by running the following command:
$ oc get operatorgroup metallb-system-7jc66 -n metallb-system -o yaml
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
annotations:
olm.providedAPIs: ""
creationTimestamp: "2023-10-25T09:42:49Z"
generateName: metallb-system-
generation: 2
name: metallb-system-7jc66
namespace: metallb-system
resourceVersion: "61658"
uid: f5f644a0-eef8-4e31-a306-e2bbcfaffab3
spec:
upgradeStrategy: Default
status:
lastUpdated: "2023-10-25T14:31:30Z"
namespaces:
- ""
Access the cluster as a user with the cluster-admin
role.
Verify that the metallb-system
namespace still exists:
$ oc get namespaces | grep metallb-system
metallb-system Active 31m
Verify the metallb
custom resource still exists:
$ oc get metallb -n metallb-system
NAME AGE
metallb 33m
Follow the guidance in "Installing from OperatorHub using the CLI" to install the latest 4.11 version of the MetalLB Operator.
When installing the latest 4.11 version of the MetalLB Operator, you must install the Operator to the same namespace it was previously installed to. |
Verify the upgraded version of the Operator is now the 4.11 version.
$ oc get csv -n metallb-system
NAME DISPLAY VERSION REPLACES PHASE
metallb-operator.{product-version}.0-202207051316 MetalLB Operator {product-version}.0-202207051316 Succeeded