kind: Cilium
About 766 words
The catalog module adds one kind, Cilium, with apiVersion specht-labs.de/v1alpha1. Each entity is one of two types:
spec.type | Is |
|---|---|
policy | a cluster's network policy: the default deny, the endpoints and their flows, and where the manifests go |
rule | one allow the catalog's relations can't express, part of a policy |
metadata is the catalog's usual: name, namespace, title, description, annotations and so on. The plugin reads title and description for display.
Fields of every type
| Field | Type | Required | Meaning |
|---|---|---|---|
type | policy or rule | yes | |
owner | entity reference | yes | the owner, as on any catalog entity; the kind defaults to Group |
system | entity reference | no | the System it's part of |
spec.type: policy
apiVersion: specht-labs.de/v1alpha1
kind: Cilium
metadata:
name: prod
title: Production cluster
spec:
type: policy
owner: group:platform
cluster: resource:prod
catalogRules: true
allowWithin: true
l7Proxy: true
defaultDeny:
exclude: [kube-system]
dns:
namespace: kube-system
selector: k8s-app=kube-dns
metrics:
scraper: component:prometheus
tailnetEgress:
namespace: tailscale
selector: tailscale.com/parent-resource-type=svc
consumerNamespaceLabel: tailscale.com/parent-resource-ns
publish:
repo: acme/k8s-deployment
path: cilium/rendered/prod.yaml
flow: pullRequest| Field | Type | Default | Meaning |
|---|---|---|---|
cluster | entity reference | required | the cluster's Resource; the kind defaults to Resource. Its endpoints are the Components and Resources that dependsOn it |
catalogRules | boolean | true | make flows from relations, cilium-allow and the metrics scraper. With false, only rule entities and each endpoint's own pods |
allowWithin | boolean | true | let each endpoint's pods reach each other on every port |
l7Proxy | boolean | true | whether the cluster's Cilium runs its L7 proxy (Envoy and the DNS proxy). With false there are no toFQDNs rules: a DNS name destination is allowed as world on the same ports, the rule's comment says so, and the default deny's DNS rule doesn't ask for the proxy |
defaultDeny.exclude | list of namespaces | [] | namespaces left out of the default deny (Excluded namespaces) |
dns.namespace | namespace | kube-system | where the cluster DNS runs. Required when dns is set |
dns.selector | label selector | k8s-app=kube-dns when dns is unset; every pod in dns.namespace when dns is set without it | the cluster DNS pods every pod may query |
metrics.scraper | entity reference | unset | the metrics scraper, an endpoint of this policy; the kind defaults to Component (Ports and metrics) |
tailnetEgress.namespace | namespace | required in tailnetEgress | where the Tailscale operator's egress proxies run |
tailnetEgress.selector | label selector | every pod in the namespace | which pods there are egress proxies |
tailnetEgress.consumerNamespaceLabel | label key | unset | the proxy label that holds the consumer's namespace (Tailnet egress) |
publish.repo | owner/name | required in publish | the GitHub repository the manifests go to |
publish.path | path | required in publish | the file in it |
publish.flow | pullRequest or push | pullRequest | how (Publish to GitHub) |
publish.branch | branch | the repository's default branch | the branch the file lands on |
publish.pullRequestBranch | branch | backstage/cilium-<metadata.name> | for pullRequest, the branch Backstage owns and force-pushes |
A namespace is a Kubernetes namespace name: lowercase letters, digits and -, starting and ending with a letter or digit. A label selector takes the Kubernetes syntax.
One policy per cluster. Every policy renders a CiliumClusterwideNetworkPolicy named default-deny, so two policies applied to the same cluster would overwrite each other's.
metadata.title is the policy's name in the console and in backstage-cilium-render's first line; metadata.name is what ?policy= and --policy take.
spec.type: rule
apiVersion: specht-labs.de/v1alpha1
kind: Cilium
metadata:
name: cnpg-manages-instances
title: The CloudNativePG operator reaches its database instances
spec:
type: rule
target: cilium:prod
owner: group:platform
from: [component:cnpg-operator]
to: [resource:shop-db]
ports: [tcp:8000]| Field | Type | Required | Meaning |
|---|---|---|---|
target | entity reference | yes | the policy; the kind defaults to Cilium, the namespace to the rule's |
from | list of peers | yes, at least one | the sources: catalog references, entity:, cidr:, * |
to | list of peers | yes, at least one | the destinations: the same, and fqdn: |
ports | list of ports | no | every port if unset |
Rule entities explains how from and to resolve. metadata.title and description show in the console's Rules and on the rule's card.
Validation
The catalog module checks the shape of every Cilium entity when the catalog processes it, and refuses the entity with every problem it finds. It doesn't check references: whether the cluster exists, or a rule's peers have pods, shows up as a diagnostic when the policy renders. Diagnostics lists the validation messages.
