oc export networkpolicy produces semantically incorrect output

Solution Verified - Updated -

Issue

# oc export networkpolicy <name>
apiVersion: v1
items:
- Spec:
    Ingress:
    - From:
      - NamespaceSelector:
          matchLabels:
            pod.network.openshift.io/legacy-netid: "0"
        PodSelector: null
      Ports: null
    PodSelector: {}
  creationTimestamp: null
  generation: 1
  name: allow-from-global-namespaces
- Spec:
    Ingress:
    - From:
      - NamespaceSelector: null
        PodSelector: {}
      Ports: null
    PodSelector: {}
  creationTimestamp: null
  generation: 1
  name: allow-from-self
- Spec:
    Ingress: null
    PodSelector: {}
  creationTimestamp: null
  generation: 1
  name: default-deny
kind: List
metadata: {}
# oc export networkpolicy allow-from-self
Spec:
  Ingress:
  - From:
    - NamespaceSelector: null
      PodSelector: {}
    Ports: null
  PodSelector: {}
creationTimestamp: null
generation: 1
name: allow-from-self
  • Both apiVersion and kind are missing from the output.

Environment

  • Openshift Container Platform
    • 3.7.9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content