Flows from relations
consumesApi and dependsOn become allows, in the direction the traffic goes. A Gateway reaches the workloads that depend on it, not the other way round.
The catalog already says which Component consumes which API and which Resources an app depends on. Backstage turns that into a default deny and one CiliumClusterwideNetworkPolicy per workload, each rule commented with the catalog fact behind it, and keeps a pull request open with the manifests.

Four npm packages for the new backend and frontend systems of Backstage.
The same cluster, kept two ways.
Written once, rarely revisited
Rendered from entities, reviewed as a pull request
A Component consumes an API. Another Component provides it, and both run on the cluster. Backstage allows the flow on both ends.
Say where the pods are, and on which port the API is reached
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: shop
annotations:
backstage.io/kubernetes-namespace: shop
backstage.io/kubernetes-label-selector: app=shop
spec:
type: service
lifecycle: production
owner: group:shop
consumesApis: [orders-api]
dependsOn: [resource:prod]
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: orders
annotations:
backstage.io/kubernetes-namespace: orders
backstage.io/kubernetes-label-selector: app=orders
spec:
type: service
lifecycle: production
owner: group:orders
providesApis: [orders-api]
dependsOn: [resource:prod]
---
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: orders-api
annotations:
specht-labs.de/cilium-ports: tcp:9000
spec:
type: grpc
lifecycle: production
owner: group:orders
definition: 'syntax = "proto3";'Name the cluster in a policy entity
apiVersion: specht-labs.de/v1alpha1
kind: Cilium
metadata:
name: prod
spec:
type: policy
owner: group:platform
cluster: resource:prodBackstage renders the allow on the provider's side (and the matching egress on the consumer's)
apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
name: allow-component-orders
# ...
spec:
endpointSelector:
matchLabels:
io.kubernetes.pod.namespace: orders
app: orders
enableDefaultDeny:
ingress: false
egress: false
ingress:
# from component:shop
# component:shop consumes api:orders-api
- fromEndpoints:
- matchLabels:
io.kubernetes.pod.namespace: shop
app: shop
toPorts:
- ports:
- port: "9000"
protocol: TCPYour first policy builds this example in full, and Flows from relations covers every relation the plugin reads.
Not affiliated with Isovalent or Cisco
This is a community plugin by SpechtLabs. It is not made, endorsed or supported by Isovalent or Cisco. "Cilium" is a trademark of its owners.