feat(tenant): allow tenant egress to the observability proxy

The observability proxy's Ingress is served by the ingress controller
in the publishing tenant, and tenant egress is denied except for the
allow-to-* policies. Without one for the proxy namespace, every request
through the Ingress and every HTTP-01 challenge for its certificate
times out at the controller.

The policy matches the whole namespace because cert-manager runs the
HTTP-01 solver pods there, next to the proxy.

Assisted-by: LLM
Signed-off-by: Maxim Belyy <maximbel2003@gmail.com>
This commit is contained in:
Maxim Belyy authored and ZverGuy committed 2026-11-10 18:27:09 +07:00
1 parent 77acd23bdd
commit 773a3a96d3
2 files changed
+78

No files matched your search

@@ -259,6 +259,20 @@ spec:
- ports:
- port: "8443"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
# The whole namespace, as for linstor-gui: the ingress controller also
# has to reach the ACME HTTP-01 solver pods cert-manager starts there.
name: allow-to-observability-proxy
namespace: {{ include "tenant.name" . }}
spec:
endpointSelector: {}
egress:
- toEndpoints:
- matchLabels:
"k8s:io.kubernetes.pod.namespace": cozy-observability-proxy
{{- if .Values.monitoring }}
---
apiVersion: cilium.io/v2
@@ -0,0 +1,64 @@
suite: tenant egress to the observability proxy
# The observability-proxy Ingress in cozy-observability-proxy is served by
# the ingress controller running in tenant-root. Tenant egress is
# default-deny plus explicit allow-to-* policies, so without this one the
# controller reaches neither the proxy nor the ACME HTTP-01 solver pod that
# cert-manager starts in the same namespace; hence the whole namespace, as
# allow-to-linstor-gui does.
templates:
- templates/networkpolicy.yaml
tests:
- it: lets every pod of the root tenant reach the proxy namespace
release:
name: tenant-root
namespace: tenant-root
asserts:
- documentSelector:
path: metadata.name
value: allow-to-observability-proxy
isKind:
of: CiliumNetworkPolicy
- documentSelector:
path: metadata.name
value: allow-to-observability-proxy
equal:
path: metadata.namespace
value: tenant-root
- documentSelector:
path: metadata.name
value: allow-to-observability-proxy
equal:
path: spec
value:
endpointSelector: {}
egress:
- toEndpoints:
- matchLabels:
"k8s:io.kubernetes.pod.namespace": cozy-observability-proxy
- it: renders in a nested tenant with every module off
release:
name: tenant-bar
namespace: tenant-foo
set:
monitoring: false
ingress: false
etcd: false
asserts:
- documentSelector:
path: metadata.name
value: allow-to-observability-proxy
equal:
path: metadata.namespace
value: tenant-foo-bar
- it: renders nothing where the tenant Cilium policies are off
release:
name: tenant-root
namespace: tenant-root
set:
_cluster:
bundle-name: isp-hosted
asserts:
- hasDocuments:
count: 0