quorate/vendor/platform/zitadel/network-policies.yaml

357 lines
9.5 KiB
YAML
Raw Permalink Normal View History

---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: zitadel
namespace: zitadel
spec:
endpointSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- zitadel
- zitadel-login
ingress:
# zitadel-login pod needs ingress to zitadel pods for the init wait and API communication
- fromEndpoints:
- matchLabels:
app.kubernetes.io/name: zitadel-login
toPorts:
- ports:
- port: "8080"
protocol: TCP
# Some Gateway/LB backend flows are sourced from the node host path.
- fromEntities:
- host
toPorts:
- ports:
- port: "8080"
protocol: TCP
- port: "3000"
protocol: TCP
- fromEntities:
- ingress
toPorts:
- ports:
- port: "8080"
protocol: TCP
- port: "3000"
protocol: TCP
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: kube-system
gateway.networking.k8s.io/gateway-name: gateway-relay
toPorts:
- ports:
- port: "8080"
protocol: TCP
- port: "3000"
protocol: TCP
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: zitadel
app.kubernetes.io/name: zitadel-oidc-internal
app.kubernetes.io/instance: zitadel
toPorts:
- ports:
- port: "8080"
protocol: TCP
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: postgres
cnpg.io/cluster: main
toPorts:
- ports:
- port: "5432"
protocol: TCP
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: kube-system
k8s-app: kube-dns
toPorts:
- ports:
- port: "53"
protocol: UDP
- port: "53"
protocol: TCP
# zitadel-login needs to talk to the zitadel API
- toEndpoints:
- matchLabels:
app.kubernetes.io/name: zitadel
toPorts:
- ports:
- port: "8080"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: zitadel-stalwart-submission
namespace: zitadel
spec:
endpointSelector:
matchLabels:
app.kubernetes.io/name: zitadel
app.kubernetes.io/instance: zitadel
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: stalwart
app.kubernetes.io/name: stalwart
app.kubernetes.io/instance: stalwart
toPorts:
- ports:
- port: "587"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: zitadel-oidc-internal
namespace: zitadel
spec:
endpointSelector:
matchLabels:
app.kubernetes.io/name: zitadel-oidc-internal
app.kubernetes.io/instance: zitadel
ingress:
- fromEntities:
- host
toPorts:
- ports:
- port: "8080"
protocol: TCP
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: longhorn
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: longhorn
toPorts:
- ports:
- port: "8080"
protocol: TCP
- port: "8443"
protocol: TCP
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: frigate
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: frigate
toPorts:
- ports:
- port: "8080"
protocol: TCP
- port: "8443"
protocol: TCP
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: stalwart
app.kubernetes.io/instance: stalwart
- matchLabels:
k8s:io.kubernetes.pod.namespace: quay
app.kubernetes.io/name: quay
app.kubernetes.io/instance: quay-registry
- matchLabels:
k8s:io.kubernetes.pod.namespace: forgejo
app.kubernetes.io/name: forgejo
app.kubernetes.io/instance: forgejo
- matchLabels:
k8s:io.kubernetes.pod.namespace: forgejo-public
app.kubernetes.io/name: forgejo
app.kubernetes.io/instance: forge-git
- matchLabels:
k8s:io.kubernetes.pod.namespace: grafana
app.kubernetes.io/name: grafana
app.kubernetes.io/instance: grafana
toPorts:
- ports:
- port: "8443"
protocol: TCP
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: zitadel
app.kubernetes.io/name: zitadel
toPorts:
- ports:
- port: "8080"
protocol: TCP
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: kube-system
k8s-app: kube-dns
toPorts:
- ports:
- port: "53"
protocol: UDP
- port: "53"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: oidc-relay-client
spec:
endpointSelector:
matchLabels:
quorate.dev/zitadel-relay: "true"
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: zitadel
app.kubernetes.io/name: zitadel-oidc-internal
app.kubernetes.io/instance: zitadel
toPorts:
- ports:
- port: "8443"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: host-egress-zitadel-oidc-internal
spec:
nodeSelector: {}
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: zitadel
app.kubernetes.io/name: zitadel-oidc-internal
toPorts:
- ports:
- port: "8080"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: gateway-relay-egress-zitadel
spec:
endpointSelector:
matchLabels:
"reserved:ingress": ""
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: zitadel
app.kubernetes.io/name: zitadel
toPorts:
- ports:
- port: "8080"
protocol: TCP
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: zitadel
app.kubernetes.io/name: zitadel-login
toPorts:
- ports:
- port: "3000"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: host-egress-zitadel
spec:
nodeSelector: {}
egress:
- toEndpoints:
- matchExpressions:
- key: k8s:io.kubernetes.pod.namespace
operator: In
values: ["zitadel"]
- key: app.kubernetes.io/name
operator: In
values: ["zitadel", "zitadel-login"]
toPorts:
- ports:
- port: "8080"
protocol: TCP
- port: "3000"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: gateway-client-to-zitadel
spec:
endpointSelector:
matchLabels:
gateway.quorate.internal/allow-gateway-client: "true"
egress:
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: zitadel
app.kubernetes.io/name: zitadel
toPorts:
- ports:
- port: "8080"
protocol: TCP
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: zitadel
app.kubernetes.io/name: zitadel-login
toPorts:
- ports:
- port: "3000"
protocol: TCP
- toEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: kube-system
k8s-app: kube-dns
toPorts:
- ports:
- port: "53"
protocol: UDP
- port: "53"
protocol: TCP
---
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: zitadel-ingress-gateway-clients
spec:
endpointSelector:
matchExpressions:
- key: k8s:io.kubernetes.pod.namespace
operator: In
values: ["zitadel"]
- key: app.kubernetes.io/name
operator: In
values: ["zitadel", "zitadel-login"]
ingress:
- fromEndpoints:
- matchLabels:
gateway.quorate.internal/allow-gateway-client: "true"
toPorts:
- ports:
- port: "8080"
protocol: TCP
- port: "3000"
protocol: TCP
---
# Same-node Gateway/LB backend selections can return to node-local ephemeral
# source ports via the host path. Keep this with Zitadel even though the policy
# kind is clusterwide, because the exception exists only for this app path.
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: host-ingress-zitadel-replies
spec:
nodeSelector: {}
ingress:
- fromEndpoints:
- matchExpressions:
- key: k8s:io.kubernetes.pod.namespace
operator: In
values: ["zitadel"]
- key: app.kubernetes.io/name
operator: In
values: ["zitadel", "zitadel-login"]
toPorts:
- ports:
- port: "32768"
endPort: 60999
protocol: TCP