Bug 2071614 - Updating EgressNetworkPolicy rejecting with error UnsupportedMediaType
Summary: Updating EgressNetworkPolicy rejecting with error UnsupportedMediaType
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.8
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.11.0
Assignee: Arda Guclu
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks: 2080151
TreeView+ depends on / blocked
 
Reported: 2022-04-04 11:14 UTC by aharchin
Modified: 2022-08-10 11:03 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Users can not apply EgressNetworkPolicy resource types Consequence: Users can not use EgressNetworkPolicy in their clusters via oc CLI Fix: Users will be able to create/update/delete EgressNetworkPolicy resources. Result:
Clone Of:
Environment:
Last Closed: 2022-08-10 11:03:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 1110 0 None open Bug 2071614: Remove network CRDs scheme registration 2022-04-14 06:14:05 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 11:03:46 UTC

Description aharchin 2022-04-04 11:14:04 UTC
Description of problem:

When we create an EgressNetworkPolicy resource with `oc apply` and try to update the same with 'oc apply' it gives an error as below.

~~~
Error from server (UnsupportedMediaType): the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml
~~~ 

Version-Release number of selected component (if applicable): 

OCP - 4.8

How reproducible: Every time


Steps to Reproduce:
1. Create an `EgressNetworkPolicy` resource (oc apply -f <yaml>)
2. update the newly created resource`EgressNetworkPolicy` resource (oc apply -f <yaml>)
3. While updating it should give an error

Actual results: `EgressNetworkPolicy` resource is not updating


Expected results: `EgressNetworkPolicy` resource should update with any issue


Additional info: we are able to update the resource with oc replace -f <yaml>

Comment 6 zhou ying 2022-04-27 01:53:58 UTC
reproduced with older version :
./oc apply -f /tmp/vv1.yaml 
egressnetworkpolicy.network.openshift.io/default-egress-egressnetworkpolicy created
[root@localhost ~]# ./oc apply -f /tmp/vv2.yaml 
Error from server (UnsupportedMediaType): error when applying patch:
{"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"network.openshift.io/v1\",\"kind\":\"EgressNetworkPolicy\",\"metadata\":{\"annotations\":{},\"name\":\"default-egress-egressnetworkpolicy\",\"namespace\":\"zhouyt\"},\"spec\":{\"egress\":[{\"to\":{\"cidrSelector\":\"10.148.184.38/32\"},\"type\":\"Allow\"},{\"to\":{\"cidrSelector\":\"0.0.0.0/0\"},\"type\":\"Deny\"}]}}\n"}},"spec":{"egress":[{"to":{"cidrSelector":"10.148.184.38/32"},"type":"Allow"},{"to":{"cidrSelector":"0.0.0.0/0"},"type":"Deny"}]}}
to:
Resource: "network.openshift.io/v1, Resource=egressnetworkpolicies", GroupVersionKind: "network.openshift.io/v1, Kind=EgressNetworkPolicy"
Name: "default-egress-egressnetworkpolicy", Namespace: "zhouyt"
for: "/tmp/vv2.yaml": the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml
[root@localhost ~]# ./oc version --client
Client Version: 4.11.0-0.nightly-2022-04-06-000911


but fixed with latest oc :
oc version --client
Client Version: 4.11.0-202204260818.p0.g5c77c00.assembly.stream-5c77c00
Kustomize Version: v4.5.4

oc apply -f /tmp/vv1.yaml 
egressnetworkpolicy.network.openshift.io/default-egress-egressnetworkpolicy created
[root@localhost ~]# vi /tmp/vv2.yaml
[root@localhost ~]# oc apply -f /tmp/vv2.yaml 
egressnetworkpolicy.network.openshift.io/default-egress-egressnetworkpolicy configured

Comment 12 errata-xmlrpc 2022-08-10 11:03:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5069


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