cilium
Renders Cilium network policies, LB-IPAM pools and L2 announcement policies from inventory parameters.
- Latest
- 1.0.3 ·
- License
- Apache-2.0
- Owners
- Moep90
- Source
- github.com/kadet-hub/generators · 0 repo stars, shared by 35 generators
- Thumbs up
- 👍 0 on GitHub Discussions
- Popularity
- 18 · 543 pulls
Request a feature Report a problem
Badge
Show the latest listed version in your README. shields.io draws the badge from this page's badge.json, which every catalog build updates; once no version is listed, it reads "not listed".
[](https://kadet-hub.org/generators/cilium/)
Cilium Generator
Published on kadet-hub: pin a released version by digest from its catalog page.
Kapitan kadet generator for Cilium policy and load balancer resources. Built for Cilium 1.20.3.
- CiliumNetworkPolicy (
cilium.io/v2): namespaced L3-L7 policy - CiliumClusterwideNetworkPolicy (
cilium.io/v2): cluster-scoped L3-L7 policy, also for nodes (host policies) - CiliumLoadBalancerIPPool (
cilium.io/v2): IP pool for LB-IPAM - CiliumL2AnnouncementPolicy (
cilium.io/v2alpha1): which nodes answer ARP/NDP for which Service IPs
Each kind is emitted in its storage version at Cilium 1.20.3. CiliumLoadBalancerIPPool v2alpha1 is still served but deprecated; CiliumL2AnnouncementPolicy exists only as v2alpha1. The Cilium install belongs in the helm input with the upstream cilium chart.
Usage
Kapitan Configuration
parameters:
kapitan:
dependencies:
- type: oci
source: ghcr.io/kadet-hub/cilium@sha256:<digest>
output_path: lib/cilium
compile:
- output_path: manifests/cilium/
input_type: kadet
output_type: yml
input_paths:
- lib/ciliumInventory Contract
All keys live under parameters.generators.cilium.
| Key | Kind | Output key |
|---|---|---|
namespace |
Default namespace. Falls back to parameters.namespace, then default. |
|
network_policies.<name> |
CiliumNetworkPolicy | <namespace>/<name>-cnp |
clusterwide_policies.<name> |
CiliumClusterwideNetworkPolicy | <name>-ccnp |
lb_ip_pools.<name> |
CiliumLoadBalancerIPPool | <name>-lbippool |
l2_announcement_policies.<name> |
CiliumL2AnnouncementPolicy | <name>-l2ap |
Every resource accepts labels, annotations and spec, and gets the label name: <name>; CiliumNetworkPolicy also accepts namespace. Precedence is generator defaults < spec < flat keys and shorthands: a flat key that overrides the same field in spec wins and logs a warning.
| Kind | Flat key | Renders to |
|---|---|---|
| both policies | endpoint_selector |
spec.endpointSelector |
| CiliumClusterwideNetworkPolicy | node_selector |
spec.nodeSelector |
| both policies | ingress, egress |
spec.ingress, spec.egress, rules verbatim apart from ports |
| both policies | description |
spec.description |
| both policies | enable_default_deny |
spec.enableDefaultDeny |
| both policies | allow_dns |
an extra spec.egress rule, see below |
| CiliumLoadBalancerIPPool | blocks, alias cidrs |
spec.blocks |
| CiliumLoadBalancerIPPool | disabled |
spec.disabled |
| CiliumL2AnnouncementPolicy | node_selector, service_selector |
spec.nodeSelector, spec.serviceSelector |
| CiliumL2AnnouncementPolicy | interfaces |
spec.interfaces |
| CiliumL2AnnouncementPolicy | external_ips, load_balancer_ips |
spec.externalIPs, spec.loadBalancerIPs |
Selectors accept match_labels and match_expressions as well as the camelCase keys. A CiliumNetworkPolicy needs endpoint_selector (or spec.endpointSelector), a CiliumClusterwideNetworkPolicy endpoint_selector or node_selector; the compile fails otherwise. endpoint_selector: {} selects every endpoint. node_selector on a CiliumNetworkPolicy is dropped with a warning. Other fields, such as ingressDeny, egressDeny or the pool’s serviceSelector, go into spec.
Shorthands and defaults
| Input | Result |
|---|---|
rule ports: [8080, 53/UDP, http] in ingress, egress, ingressDeny or egressDeny (also in spec) |
one more toPorts entry: {ports: [{port: "8080"}, {port: "53", protocol: UDP}, {port: http}]} |
allow_dns: true |
egress rule to kube-dns on port 53 with the L7 DNS rule matchPattern: "*" |
allow_dns: [<pattern>, ...] |
the same rule, allowing only lookups that match the patterns |
pool block "192.0.2.0/28" |
{cidr: 192.0.2.0/28} |
pool block "198.51.100.10-198.51.100.20" |
{start: 198.51.100.10, stop: 198.51.100.20} |
L2 policy without external_ips, load_balancer_ips or the same fields in spec |
loadBalancerIPs: true |
The CRD types port as a string, so an unquoted port: 53 in a hand-written toPorts fails validation; the shorthand converts numbers. A missing protocol is not emitted, Cilium reads it as ANY (PortProtocol).
toFQDNs rules only learn IPs from DNS answers that pass Cilium’s DNS proxy, which needs an L7 DNS rule on the DNS traffic (DNS based). allow_dns renders the rule from the upstream FQDN example: toEndpoints with k8s:io.kubernetes.pod.namespace: kube-system and k8s:k8s-app: kube-dns. It is opt-in because it adds allowed egress, and the DNS rule may already live in another policy for the same endpoints. Clusters whose DNS pods carry other labels write the rule in egress instead. Like every egress rule it turns on default deny for egress unless enable_default_deny.egress is false.
Both L2 announcement flags default to false upstream, so a policy without either announces nothing (IP types). The generator sets loadBalancerIPs: true, the IPs that LB-IPAM assigns; externalIPs also needs the externalIPs.enable Helm value and stays off unless set. Pool block notation follows LB-IPAM.
enable_default_deny is not defaulted; Cilium enables default deny for each direction that has rules.
Example
parameters:
generators:
cilium:
namespace: shop
network_policies:
web:
endpoint_selector:
match_labels:
app: web
ingress:
- fromEndpoints:
- matchLabels:
k8s:io.kubernetes.pod.namespace: ingress-nginx
app.kubernetes.io/name: ingress-nginx
ports: [8080]
egress:
- toEndpoints:
- matchLabels:
app: api
ports: [3000/TCP]
allow_dns: true
payments-egress:
namespace: payments
endpoint_selector:
match_labels:
app: payments
egress:
- toFQDNs:
- matchName: api.payments.example.com
ports: [443/TCP]
allow_dns: [api.payments.example.com]
clusterwide_policies:
node-health-check:
node_selector:
match_labels:
kubernetes.io/os: linux
ingress:
- fromEntities: [health]
lb_ip_pools:
public-pool:
blocks:
- 192.0.2.0/28
- 198.51.100.10-198.51.100.20
l2_announcement_policies:
workers:
node_selector:
match_expressions:
- key: node-role.kubernetes.io/control-plane
operator: DoesNotExist
interfaces: ["^eth[0-9]+"]This renders shop/web-cnp, payments/payments-egress-cnp, node-health-check-ccnp, public-pool-lbippool and workers-l2ap. Both namespaced policies get the kube-dns egress rule; payments-egress allows only lookups of api.payments.example.com, and workers announces LoadBalancer IPs from every worker node.
Schemas
schemas/cilium.io/ holds the closed JSON Schemas of the four kinds from the Cilium 1.20.3 CRDs (Apache-2.0). The policy schemas restrict spec.log.value with the pattern ^\PC*$, which Python’s re cannot compile; validate output that sets log with a validator that supports Unicode property classes.
Versions
Add a version's inventory entry, then compile with the consumer workflow, which verifies the artifact and runs Kapitan in the sandbox.
Free of charge, as is and on a best-effort basis: use at your own risk, and review the compiled output before you apply it. Terms
This catalog was built from index serial 47. Set index_serial: 47 in .kapitan-sandbox.yaml and the consumer workflow refuses any older index, so a rolled-back index cannot bring back a yanked version.
Checks find known patterns; they do not prove a generator safe. What a listing covers
| Version | Built for (schema-checked) |
|---|---|
| 1.0.3 | Cilium 1.20.3 |
| 1.0.2 | Cilium 1.20.2 |
| 1.0.1 | Cilium 1.20.2 |
| 1.0.0 | Cilium 1.20.2 |
1.0.3#
Inventory
parameters:
kapitan:
dependencies:
- type: oci
source: ghcr.io/kadet-hub/cilium:1.0.3@sha256:8cee8be098798642199063b8afa5e5bbf8d717b0426df280dd718d998e116635
output_path: lib/cilium
Verify
gh attestation verify \
oci://ghcr.io/kadet-hub/cilium@sha256:8cee8be098798642199063b8afa5e5bbf8d717b0426df280dd718d998e116635 \
--owner kadet-hub \
--cert-identity https://github.com/kadet-hub/registry/.github/workflows/release.yml@refs/heads/main
Transparency log: Rekor entry 3274775591, in Sigstore's public, append-only log, so the attestation stays checkable independent of this site.
- Kapitan declared
- >=0.36.3,<0.37
- Kapitan checked
- 0.36.3
- Backends checked
- reclass-rs, omegaconf
- With --cache
- passed
- krab
- compatible
- Built for (schema-checked)
- Cilium 1.20.3
- Source
- cilium-v1.0.3 ·
ae0254b7569cb5022440d777b0953790c5696293· cilium - Binaries
- none
- Output capabilities
- none
- Digest
sha256:8cee8be098798642199063b8afa5e5bbf8d717b0426df280dd718d998e116635
Checks
Checked by the release run on , gate at 44c10edf85ef.
- Secrets gitleaks 8.30.1
No secret matched the marketplace's gitleaks rules. - Malware ClamAV 1.5.4
No file matched a ClamAV signature. - Malicious package heuristics GuardDog 3.2.0
No GuardDog threat rule matched. - Dangerous code Semgrep 1.180.0
No marketplace Semgrep rule matched, such as eval, subprocess or network calls. - Python errors Ruff 0.17.0
No syntax error or undefined name (Ruff, error rules only). - File tree tree_check.py
No symlink, executable or banned file; imports within the allowlist. - Sandboxed compile gVisor 20261005, Kapitan 0.36.3
The fixture compiled without network, with decoy credentials; no undeclared program ran, no decoy was read. - Output capabilities Conftest 0.71.1
The compiled output uses only the capabilities the manifest declares. - CI detection Kapitan 0.36.3
The output is the same with CI variables set.
Output diff
Fixture output against 1.0.2: 0 files, 0 hunks.
1.0.2#
Inventory
parameters:
kapitan:
dependencies:
- type: oci
source: ghcr.io/kadet-hub/cilium:1.0.2@sha256:f270d4b12b8d418594577ee32c14ea3864ad1ea7e18f3e92468b1d0546fce80c
output_path: lib/cilium
Verify
gh attestation verify \
oci://ghcr.io/kadet-hub/cilium@sha256:f270d4b12b8d418594577ee32c14ea3864ad1ea7e18f3e92468b1d0546fce80c \
--owner kadet-hub \
--cert-identity https://github.com/kadet-hub/registry/.github/workflows/release.yml@refs/heads/main
Transparency log: Rekor entry 3249980790, in Sigstore's public, append-only log, so the attestation stays checkable independent of this site.
- Kapitan declared
- >=0.36.3,<0.37
- Kapitan checked
- 0.36.3
- Backends checked
- not recorded
- With --cache
- not recorded
- krab
- compatible
- Built for (schema-checked)
- Cilium 1.20.2
- Source
- cilium-v1.0.2 ·
e4891e8fd85ca0a19ebf361e8b54fd6473fd8a2f· cilium - Binaries
- none
- Output capabilities
- none
- Digest
sha256:f270d4b12b8d418594577ee32c14ea3864ad1ea7e18f3e92468b1d0546fce80c
Checks
Checked by the release run on , gate at 6f0242aa6a3c.
- Secrets gitleaks 8.30.1
No secret matched the marketplace's gitleaks rules. - Malware ClamAV 1.5.4
No file matched a ClamAV signature. - Malicious package heuristics GuardDog 3.2.0
No GuardDog threat rule matched. - Dangerous code Semgrep 1.180.0
No marketplace Semgrep rule matched, such as eval, subprocess or network calls. - Python errors Ruff 0.17.0
No syntax error or undefined name (Ruff, error rules only). - File tree tree_check.py
No symlink, executable or banned file; imports within the allowlist. - Sandboxed compile gVisor 20261005, Kapitan 0.36.3
The fixture compiled without network, with decoy credentials; no undeclared program ran, no decoy was read. - Output capabilities Conftest 0.71.1
The compiled output uses only the capabilities the manifest declares. - CI detection Kapitan 0.36.3
The output is the same with CI variables set.
Output diff
No output diff recorded: this version was published before the release run recorded one.
1.0.1#
Inventory
parameters:
kapitan:
dependencies:
- type: oci
source: ghcr.io/kadet-hub/cilium:1.0.1@sha256:740dce070a820d821f337de0a9cb643a9532e921633ba9ae7cc402478a8c8cbe
output_path: lib/cilium
Verify
gh attestation verify \
oci://ghcr.io/kadet-hub/cilium@sha256:740dce070a820d821f337de0a9cb643a9532e921633ba9ae7cc402478a8c8cbe \
--owner kadet-hub \
--cert-identity https://github.com/kadet-hub/registry/.github/workflows/release.yml@refs/heads/main
Transparency log: Rekor entry 3244062785, in Sigstore's public, append-only log, so the attestation stays checkable independent of this site.
- Kapitan declared
- >=0.36.3,<0.37
- Kapitan checked
- 0.36.3
- Backends checked
- not recorded
- With --cache
- not recorded
- krab
- compatible
- Built for (schema-checked)
- Cilium 1.20.2
- Source
- cilium-v1.0.1 ·
9166cb30e0ae4874bc8f229c6a6823eff7451d04· cilium - Binaries
- none
- Output capabilities
- none
- Digest
sha256:740dce070a820d821f337de0a9cb643a9532e921633ba9ae7cc402478a8c8cbe
Checks
Checked by the release run on , gate at cc653998a763.
- Secrets gitleaks 8.30.1
No secret matched the marketplace's gitleaks rules. - Malware ClamAV 1.5.4
No file matched a ClamAV signature. - Malicious package heuristics GuardDog 3.2.0
No GuardDog threat rule matched. - Dangerous code Semgrep 1.180.0
No marketplace Semgrep rule matched, such as eval, subprocess or network calls. - Python errors Ruff 0.17.0
No syntax error or undefined name (Ruff, error rules only). - File tree tree_check.py
No symlink, executable or banned file; imports within the allowlist. - Sandboxed compile gVisor 20261005, Kapitan 0.36.3
The fixture compiled without network, with decoy credentials; no undeclared program ran, no decoy was read. - Output capabilities Conftest 0.71.1
The compiled output uses only the capabilities the manifest declares. - CI detection Kapitan 0.36.3
The output is the same with CI variables set.
Output diff
No output diff recorded: this version was published before the release run recorded one.
1.0.0#
Inventory
parameters:
kapitan:
dependencies:
- type: oci
source: ghcr.io/kadet-hub/cilium:1.0.0@sha256:5b5e8b1a7dcc296782daa5997f2175bdf851d4a924377c212f51af1eee1cb5ef
output_path: lib/cilium
Verify
gh attestation verify \
oci://ghcr.io/kadet-hub/cilium@sha256:5b5e8b1a7dcc296782daa5997f2175bdf851d4a924377c212f51af1eee1cb5ef \
--owner kadet-hub \
--cert-identity https://github.com/kadet-hub/registry/.github/workflows/release.yml@refs/heads/main
Transparency log: Rekor entry 3212106754, in Sigstore's public, append-only log, so the attestation stays checkable independent of this site.
- Kapitan declared
- >=0.36.3,<0.37
- Kapitan checked
- 0.36.3
- Backends checked
- not recorded
- With --cache
- not recorded
- krab
- compatible
- Built for (schema-checked)
- Cilium 1.20.2
- Source
- cilium-v1.0.0 ·
c3fd859273b2e76315c54f56052dc743669ac318· cilium - Binaries
- none
- Output capabilities
- none
- Digest
sha256:5b5e8b1a7dcc296782daa5997f2175bdf851d4a924377c212f51af1eee1cb5ef
Checks
Checked by the release run on , gate at 4f27fde613c7.
- Secrets gitleaks 8.30.1
No secret matched the marketplace's gitleaks rules. - Malware ClamAV 1.5.4
No file matched a ClamAV signature. - Malicious package heuristics GuardDog 3.2.0
No GuardDog threat rule matched. - Dangerous code Semgrep 1.180.0
No marketplace Semgrep rule matched, such as eval, subprocess or network calls. - Python errors Ruff 0.17.0
No syntax error or undefined name (Ruff, error rules only). - File tree tree_check.py
No symlink, executable or banned file; imports within the allowlist. - Sandboxed compile gVisor 20261005, Kapitan 0.36.3
The fixture compiled without network, with decoy credentials; no undeclared program ran, no decoy was read. - Output capabilities Conftest 0.71.1
The compiled output uses only the capabilities the manifest declares. - CI detection Kapitan 0.36.3
The output is the same with CI variables set.
Output diff
No output diff recorded: this version was published before the release run recorded one.