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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.