apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: restapi
  namespace: restapi
spec:
  podSelector:
    matchLabels:
      app: restapi
  policyTypes:
  - Ingress
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          name: nginx
    ports:
    - protocol: TCP
      port: 8080
