apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  labels:
    app: jupyterhub
    chart: jupyterhub-1.2.0
    component: proxy
    heritage: Helm
    release: RELEASE-NAME
  name: proxy
spec:
  egress:
  - ports:
    - port: 8081
    to:
    - podSelector:
        matchLabels:
          app: jupyterhub
          component: hub
          release: RELEASE-NAME
  - ports:
    - port: 8888
    to:
    - podSelector:
        matchLabels:
          app: jupyterhub
          component: singleuser-server
          release: RELEASE-NAME
  - ports:
    - port: 53
      protocol: UDP
    - port: 53
      protocol: TCP
  - to:
    - ipBlock:
        cidr: 0.0.0.0/0
  ingress:
  - ports:
    - port: http
    - port: https
  - from:
    - podSelector:
        matchLabels:
          hub.jupyter.org/network-access-proxy-http: "true"
    ports:
    - port: http
  - from:
    - podSelector:
        matchLabels:
          hub.jupyter.org/network-access-proxy-api: "true"
    ports:
    - port: api
  podSelector:
    matchLabels:
      app: jupyterhub
      component: proxy
      release: RELEASE-NAME
  policyTypes:
  - Ingress
  - Egress
