Documentation
¶
Overview ¶
Package cilium projects Cilium CNI state onto Kubernetes Pods and Nodes and normalizes Hubble flows into telemetry events. It does not model Cilium service mesh, Envoy configuration, or L7 policy.
Inputs ¶
The plugin opens no Kubernetes watch. It declares Pods and Nodes as required and CiliumNetworkPolicy, CiliumClusterwideNetworkPolicy, CiliumEndpoint, and CiliumNode as optional capabilities, consuming them through the Kubernetes plugin's per-GVR and resource-coverage collections.
Identity and graph output ¶
Cilium objects keep their Kubernetes identities (kubernetes.io/v1 Object, cluster authority, apiVersion/kind/UID key). CiliumEndpoint and CiliumNode enrich the Pod and Node with the same namespace and name, because Cilium references them by name, instead of creating competing identities; missing or ambiguous matches produce diagnostics and no facet. The "cni-semantics" contribution emits governed-by from selected Pods to Cilium policies and cilium-cni-policy and cilium-cni facets. Policies with L7 rules contribute no rule counts or relationships. Evidence IDs match the Kubernetes plugin's upsert event IDs.
Publication waits for both the object and coverage collections to reach a coherent generation. Unexpected subscription closure publishes a degraded replacement from the last coherent cache and returns an error.
Telemetry ¶
The unexported normalizeHubbleFlow maps one Hubble flow to a telemetry event with the original timestamp, a provider or content-derived retry-stable event ID, and Pod UID or network-destination endpoint claims, and ingestHubbleFlow submits it to the shared pipeline, which commits raw events before any graph rollup. No Hubble Relay transport or resumable cursor is included yet, so nothing calls them outside tests.
The package also implements the cilium-network-policy/v1 remediation action, which declares ingress isolation for a Pod with a CiliumNetworkPolicy.
Index ¶
- Constants
- func Descriptor() discovery.Descriptor
- func Project(clusterID, sourceID string, objects []*unstructured.Unstructured) (graph.Input, error)
- type CLIConfig
- type Config
- type Diagnostic
- type ObservedObject
- type Plugin
- func (plugin *Plugin) Descriptor() discovery.Descriptor
- func (p *Plugin) Execute(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan, ...) (remediation.ExecutionResult, error)
- func (plugin *Plugin) KubernetesResources() []kubernetesplugin.ResourceRequirement
- func (p *Plugin) Plan(ctx context.Context, proposal remediation.Proposal, actionID string) (remediation.Plan, error)
- func (p *Plugin) Prepare(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan) (remediation.Preparation, error)
- func (p *Plugin) RemediationDescriptor() remediation.Descriptor
- func (plugin *Plugin) Run(ctx context.Context, runtime discovery.Runtime) error
- func (plugin *Plugin) SourceID() string
- func (p *Plugin) Verify(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan, ...) (remediation.Verification, error)
- type ProjectionContext
- type ProjectionResult
Constants ¶
const CollectionProjection = "cilium/projection"
CollectionProjection signals readiness of the Cilium semantic contribution; its graph assertions are published separately through ReplaceContribution.
const PluginID = "cilium"
PluginID is the plugin and contribution owner ID.
Variables ¶
This section is empty.
Functions ¶
func Descriptor ¶
func Descriptor() discovery.Descriptor
Descriptor declares the consumed Kubernetes collections and the projection readiness collection. Cilium introduces no identity scheme of its own.
func Project ¶
func Project(clusterID, sourceID string, objects []*unstructured.Unstructured) (graph.Input, error)
Project projects bare objects, deriving evidence IDs from their identity and resource version. It exists for tests and offline evaluation; the plugin uses ProjectObserved with collection event IDs.
Types ¶
type Config ¶
type Config struct {
ClusterID string
SourceID string
Actions kubernetesplugin.WriteTransport
}
Config identifies the cluster and source shared with the Kubernetes plugin. Actions enables the remediation action; nil leaves it unadvertised.
type Diagnostic ¶
Diagnostic records an unresolved or unsupported provider object. It is not a graph fact and never implies policy absence.
type ObservedObject ¶
type ObservedObject = coherentcache.Object
ObservedObject is one cached Kubernetes observation with the event ID used as assertion evidence.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is the Cilium semantic projection and remediation plugin.
func (*Plugin) Descriptor ¶
func (plugin *Plugin) Descriptor() discovery.Descriptor
Descriptor implements discovery.Plugin; it returns the same value as the package-level Descriptor, which main also uses before construction.
func (*Plugin) Execute ¶
func (p *Plugin) Execute(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan, preparation remediation.Preparation) (remediation.ExecutionResult, error)
Execute re-derives the plan, requires the provider state recorded by Prepare to be unchanged, labels the Pod, rechecks for overlapping policy, and creates the policy. If a step after labeling fails, the label is rolled back.
func (*Plugin) KubernetesResources ¶
func (plugin *Plugin) KubernetesResources() []kubernetesplugin.ResourceRequirement
KubernetesResources lists the GVRs the Kubernetes plugin must watch for this plugin.
func (*Plugin) Plan ¶
func (p *Plugin) Plan(ctx context.Context, proposal remediation.Proposal, actionID string) (remediation.Plan, error)
Plan resolves the proposal's target Pod and derives the desired target label and CiliumNetworkPolicy, rejecting targets already selected by an overlapping policy. It writes nothing.
func (*Plugin) Prepare ¶
func (p *Plugin) Prepare(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan) (remediation.Preparation, error)
Prepare submits the desired Pod label and policy as server-side dry runs so admission can reject them before any change, and records the admitted state.
func (*Plugin) RemediationDescriptor ¶
func (p *Plugin) RemediationDescriptor() remediation.Descriptor
RemediationDescriptor advertises the cilium-network-policy/v1 ingress isolation action for Kubernetes Pods when an action transport is configured.
func (*Plugin) Run ¶
Run consumes the Kubernetes collections and replaces the cni-semantics contribution whenever both object and coverage collections reach a new coherent generation.
func (*Plugin) Verify ¶
func (p *Plugin) Verify(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan, result remediation.ExecutionResult) (remediation.Verification, error)
Verify reports satisfied only while the live Pod label and policy still match the digests recorded at execution. It checks declared configuration, not dataplane enforcement.
type ProjectionContext ¶
ProjectionContext scopes projection to one cluster and source.
type ProjectionResult ¶
type ProjectionResult struct {
Input graph.Input
Diagnostics []Diagnostic
}
ProjectionResult is the complete cni-semantics contribution input plus diagnostics for endpoints and nodes that could not be matched.
func ProjectObserved ¶
func ProjectObserved(scope ProjectionContext, observations []ObservedObject) (ProjectionResult, error)
ProjectObserved deterministically projects one coherent snapshot. The result is independent of observation order.