@@ -7,8 +7,16 @@ Off by default, because a NetworkPolicy on a cluster with no CNI that enforces o
77that silently does nothing, and on a cluster that does enforce one a wrong rule is an outage. A
88deployment that turns this on is saying it knows which of the two it has.
99
10- Egress deliberately allows DNS and the database, and nothing else without being asked : a Bot's
11- computer reaching the open internet is the computers' own policy, not the API's.
10+ Egress allows DNS, the database, the computers, and HTTP and HTTPS to everywhere that is not the
11+ cluster's own private network. THAT LAST ONE IS NOT A CONCESSION, it is what this pod does : sign-in
12+ goes to an identity provider, every conversation goes to Intelligence, and every run goes to a Bot
13+ at an address somebody registered. All three are hostnames rather than CIDRs, and a NetworkPolicy
14+ cannot match a hostname, so there is no narrower rule to write. Leaving it out did not fence the API
15+ off, it stopped the product working, and only in `computers.mode : sandbox` did a rule meant for the
16+ Kubernetes API server quietly cover for it.
17+
18+ The private ranges stay cut out by exception, the way the computers' policy does it, so this is
19+ still a pod that cannot address another pod, a node, or a cloud metadata endpoint.
1220*/}}
1321apiVersion : networking.k8s.io/v1
1422kind : NetworkPolicy
6270 - port : 4100
6371 protocol : TCP
6472 {{- end }}
73+ {{- /*
74+ Intelligence, the identity provider, and every Bot : all of them, and all outside the cluster.
75+
76+ Written as an exception list rather than as a destination list because the destinations are
77+ hostnames the deployment configures and a NetworkPolicy matches addresses. The same shape the
78+ computers' policy below already uses, for the same reason.
79+ */}}
80+ - to :
81+ - ipBlock :
82+ cidr : 0.0.0.0/0
83+ except :
84+ # The cluster and everything else on the private network, including the database.
85+ - 10.0.0.0/8
86+ - 172.16.0.0/12
87+ - 192.168.0.0/16
88+ # Link-local, which is where every cloud keeps the endpoint that hands out credentials.
89+ - 169.254.0.0/16
90+ ports :
91+ - port : 80
92+ protocol : TCP
93+ - port : 443
94+ protocol : TCP
6595 {{- if eq .Values.computers.mode "sandbox" }}
66- {{- /* The API server, which is where a per-Bot computer is asked for. */}}
67- - ports :
96+ {{- /*
97+ The Kubernetes API server, which is where a per-Bot computer is asked for.
98+
99+ Its own rule because it sits on the private network the rule above cuts out, so nothing else
100+ here reaches it. Unscoped unless a deployment says otherwise : the API server answers on a
101+ ClusterIP from the service range, and a chart cannot know that range at template time. Name it
102+ in `networkPolicy.kubernetesApiCidr` and this narrows to it.
103+ */}}
104+ - {{- with .Values.networkPolicy.kubernetesApiCidr }}
105+ to :
106+ - ipBlock :
107+ cidr : {{ . }}
108+ {{- end }}
109+ ports :
68110 - port : 443
69111 protocol : TCP
70112 - port : 6443
0 commit comments