Bug 2126537 - HCO upgrade (4.10.z->4.11) should not be blocked if no knmstate policy is applied
Summary: HCO upgrade (4.10.z->4.11) should not be blocked if no knmstate policy is app...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Networking
Version: 4.10.5
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.10.6
Assignee: Quique Llorente
QA Contact: Yossi Segev
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-09-13 18:49 UTC by Yossi Segev
Modified: 2023-01-30 14:04 UTC (History)
3 users (show)

Fixed In Version: cluster-network-addons-operator v4.10.6-2
Doc Type: Known Issue
Doc Text:
This should be mentioned in 4.11 release notes. Cause: Kubernetes NMState was turned into a standalone operator and will not be a part of OpenShift Virtualization deployments in 4.11. 4.10 users that are utilizing Kubernetes NMState will be asked to install the standalone version before upgrading. However due to a bug, all users, including those that did not use the component, will be asked to install it. Consequence: This conditions upgrades to 4.11 by installing the standalone Kubernetes NMState operator, no matter if it is needed or not. Workaround (if any): The upgrade can be unblocked by annotating HCO CR. Caution is required: This workaround should be done only if there are no NMState resources on the cluster: 1. Confirm there are no Node Network Configuration Policies present: oc get nncp 2. If the list is empty, annotate HCO. Note that this overwrites the whole annotation. If there already is a json patch present, extend it accordingly: oc annotate --overwrite -n openshift-cnv hco kubevirt-hyperconverged 'networkaddonsconfigs.kubevirt.io/jsonpatch=[{"op": "replace","path": "/spec/nmstate", "value": null}]' After the upgrade it completed, remove the annotation. Note that while this patch is applied, HCO will report TaintedConfiguration condition. Result: Upgrade to 4.11 should be unblocked.
Clone Of:
Environment:
Last Closed: 2023-01-30 14:01:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt cluster-network-addons-operator pull 1415 0 None open nmstate, upgrade: Check nncp before failing 2022-09-14 07:44:48 UTC
Red Hat Issue Tracker CNV-21251 0 None None None 2023-01-30 14:04:15 UTC
Red Hat Issue Tracker CNV-21367 0 None None None 2023-01-30 14:04:17 UTC

Description Yossi Segev 2022-09-13 18:49:55 UTC
Description of problem:
Until CNv 4.10, knmstate was installed as part of CNV.
Starting from CNV 4.11, knmstate is installed as a standalone operator, and CNV does not depend on knmstate anymore (unless user explicitly wish to install and use knmstate).
Upgrading CNV 4.10->4.11 should be blocked if knmstate is currently used (i.e. if there are NodeNetworkConfigurationPolicy's applied), and standalone knmstate is not yet installed. Currently - the upgrade is blocked even if there is no policy applied.


Version-Release number of selected component (if applicable):
OCP 4.11.0
CNV 4.10.5
knmstate v4.10.5-1
HCO v4.10.5-1
cluster-network-addons-operator v4.10.5-1


How reproducible:
100%


Steps to Reproduce:
1.
On a cluster with OCP 4.11 and CNV 4.10.z (z>=2) - make sure there is no NodeNetworkConfigurationPolicy (NNCP):
$ oc get nncp
No resources found

2.
Make sure standalone knmstate is not installed:
$ oc get ns | grep nmstate
$ 

3.
Check the Upgradeable status of HCO:
$ oc get hco -n openshift-cnv kubevirt-hyperconverged -ojsonpath={.status.conditions} | jq
[
 ...
  {
    "lastTransitionTime": "2022-09-13T14:54:19Z",
    "message": "NetworkAddonsConfig is not upgradeable: NMState deployment is not supported by CNAO anymore, please install Kubernetes NMState Operator",
    "observedGeneration": 2,
    "reason": "NetworkAddonsConfigNotUpgradeable",
    "status": "False",
    "type": "Upgradeable"
  }
]

<BUG>
Upgradeable should be "True"

Comment 1 Quique Llorente 2022-09-14 07:44:29 UTC
Upstream fix https://github.com/kubevirt/cluster-network-addons-operator/pull/1415

Comment 2 Quique Llorente 2022-09-14 09:10:33 UTC
Workaround is to remove kubernetes-nmstate before upgrade with the following command

oc annotate --overwrite -n openshift-cnv hco kubevirt-hyperconverged 'networkaddonsconfigs.kubevirt.io/jsonpatch=[{"op": "replace","path": "/spec/nmstate", "value": null}]'

Comment 3 Petr Horáček 2022-09-15 07:53:53 UTC
Yossi, would you please verify that the draft of a workaround in suggested release note is correct? We'd like to attach it to 4.11 release notes, so people can get over the upgrade blocker.

Comment 4 Yossi Segev 2022-09-15 10:21:02 UTC
> Yossi, would you please verify that the draft of a workaround in suggested release note is correct? We'd like to attach it to 4.11 release notes, so people can get over the upgrade blocker.

I've tested, and adding the annotation does end in setting the Upgradeable condition to True.
However, it also results in adding a new status condition to the CNV HCO resource:
  {
    "lastTransitionTime": "2022-09-15T10:14:48Z",
    "message": "Unsupported feature was activated via an HCO annotation",
    "observedGeneration": 2,
    "reason": "UnsupportedFeatureAnnotation",
    "status": "True",
    "type": "TaintedConfiguration"
  }

Is this valid?

Comment 5 Dan Kenigsberg 2022-09-15 10:38:52 UTC
IMHO yes. This is the expected behavior. We should be very clear in documenting this workaround

- if you use NodeNetworkConfigurationPolicies, you must install the standalone kubernetes-nmstate before you upgrade to CNV-4.11
- if don't use NNCPs in your CNV-4.10 and don't plan to use them soon, do the patch of https://bugzilla.redhat.com/show_bug.cgi?id=2126537#c2. upgrade CNV and undo the patch. While the patch is applied, HCO would show TaintedConfiguration.

Comment 6 Petr Horáček 2022-09-15 10:55:33 UTC
Thanks Dan. I updated the suggested release note accordingly.

Comment 7 Shikha Jhala 2022-09-15 20:29:33 UTC
@ysegev I have added this known issue to the 4.11 release notes: https://github.com/openshift/openshift-docs/pull/50464. Please let me know if you have any comments from QE perspective. Thank you.

Comment 8 Yossi Segev 2022-09-18 09:26:51 UTC
Reviewed and left a comment.

Comment 9 Petr Horáček 2022-10-04 09:51:08 UTC
Waiting to get to errata

Comment 10 Yossi Segev 2022-10-19 13:33:31 UTC
Verified on 
OCP 4.11.0
CNV 4.10.6
knmstate v4.10.6-3
HCO v4.10.6-4
cluster-network-addons-operator v4.10.6-3

1.
Make sure standalone knmstate is not installed:
$ oc get ns | grep nmstate
$ 

2.
Make sure there is no NodeNetworkConfigurationPolicy (NNCP):
$ oc get nodenetworkconfigurationpolicy
No resources found

3.
Check the Upgradeable status of HCO:
$ oc get hco -n openshift-cnv kubevirt-hyperconverged -ojsonpath={.status.conditions} | jq
[
...
  {
    "lastTransitionTime": "2022-10-19T13:15:22Z",
    "message": "Reconcile completed successfully",
    "observedGeneration": 2,
    "reason": "ReconcileCompleted",
    "status": "True",
    "type": "Upgradeable"
  }
]

Upgrade is possible.

4. Create a basic NNCP:
$ cat << EOF | oc apply -f -
> apiVersion: nmstate.io/v1
> kind: NodeNetworkConfigurationPolicy
> metadata:
>   name: eth-nncp
> spec:
>   desiredState:
>     interfaces:
>     - name: ens3f1
>       state: down
>       type: ethernet
>   nodeSelector:
>     node-role.kubernetes.io/worker: "cnvqe-11.lab.eng.tlv2.redhat.com"
> EOF
nodenetworkconfigurationpolicy.nmstate.io/eth-nncp created

5
Verify NNCP exists:
$ oc get nncp
NAME       STATUS
eth-nncp   Available

6. Verify upgrade is now blocked (due to the existence of the NNCP):
 oc get hco -n openshift-cnv kubevirt-hyperconverged -ojsonpath={.status.conditions} | jq
[
...
  {
    "lastTransitionTime": "2022-10-19T13:28:47Z",
    "message": "NetworkAddonsConfig is not upgradeable: NMState deployment is not supported by CNAO anymore, please install Kubernetes NMState Operator",
    "observedGeneration": 2,
    "reason": "NetworkAddonsConfigNotUpgradeable",
    "status": "False",
    "type": "Upgradeable"
  }
]

7. Revert the setup of the NNCP, to avoid leaving a "dirty" cluster (in my case - setting the interface state back to UP):
]$ cat << EOF | oc apply -f -                                              
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
  name: eth-nncp
spec:
  desiredState:
    interfaces:
    - name: ens3f1
      state: up  
      type: ethernet
  nodeSelector:
    node-role.kubernetes.io/worker: "cnvqe-11.lab.eng.tlv2.redhat.com"
EOF

nodenetworkconfigurationpolicy.nmstate.io/eth-nncp configured

8.
Delete the NNCP, and verify there are no NNCPs left in the cluster:
$ oc delete nncp eth-nncp 
nodenetworkconfigurationpolicy.nmstate.io "eth-nncp" deleted

$ oc get nodenetworkconfigurationpolicy
No resources found

9.
Verify the cluster is upgardeable again:
$ oc get hco -n openshift-cnv kubevirt-hyperconverged -ojsonpath={.status.conditions} | jq
[
...
  {
    "lastTransitionTime": "2022-10-19T13:32:04Z",
    "message": "Reconcile completed successfully",
    "observedGeneration": 2,
    "reason": "ReconcileCompleted",
    "status": "True",
    "type": "Upgradeable"
  }
]

Comment 12 Petr Horáček 2023-01-30 14:01:23 UTC
4.10.6 has been shipped live a while back. Cleaning up.


Note You need to log in before you can comment on or make changes to this bug.