api

package
v0.0.1-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api holds typed subsets of the cilium.io/v2 resources the Cilium projector reads. Types decode only the fields projection interprets; field meaning follows the upstream Cilium API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoded

type Decoded[T any] struct {
	Value T
}

Decoded wraps a typed provider object decoded from its unstructured form.

func Decode

func Decode[T any](object *unstructured.Unstructured) (Decoded[T], error)

Decode round-trips object through JSON into T. Unknown fields are ignored; a field with the wrong JSON type is an error.

func EndpointObject

func EndpointObject(object *unstructured.Unstructured) (Decoded[Endpoint], error)

EndpointObject decodes a CiliumEndpoint.

func NodeObject

func NodeObject(object *unstructured.Unstructured) (Decoded[Node], error)

NodeObject decodes a CiliumNode.

func PolicyObject

func PolicyObject(object *unstructured.Unstructured) (Decoded[Policy], error)

PolicyObject decodes a Cilium policy object.

type EgressRule

type EgressRule struct {
	ToPorts []PortRule `json:"toPorts,omitempty"`
}

EgressRule holds the port rules of one egress section.

type Endpoint

type Endpoint struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Status            EndpointStatus `json:"status,omitempty"`
}

Endpoint is a CiliumEndpoint, named after the Pod it represents.

type EndpointIdentity

type EndpointIdentity struct {
	ID int64 `json:"id,omitempty"`
}

EndpointIdentity is the numeric Cilium security identity.

type EndpointPolicy

type EndpointPolicy struct {
	Realized EndpointRealizedPolicy `json:"realized,omitempty"`
}

EndpointPolicy holds the policy state the agent realized.

type EndpointRealizedPolicy

type EndpointRealizedPolicy struct {
	PolicyEnabled string `json:"policy-enabled,omitempty"`
}

EndpointRealizedPolicy reports the agent's realized policy-enabled mode. It is recorded verbatim, not interpreted as proof of enforcement.

type EndpointStatus

type EndpointStatus struct {
	ID       int64            `json:"id,omitempty"`
	State    string           `json:"state,omitempty"`
	Identity EndpointIdentity `json:"identity,omitempty"`
	Policy   EndpointPolicy   `json:"policy,omitempty"`
}

EndpointStatus is the agent-reported endpoint state.

type IngressRule

type IngressRule struct {
	ToPorts []PortRule `json:"toPorts,omitempty"`
}

IngressRule holds the port rules of one ingress section.

type Node

type Node struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              NodeSpec `json:"spec,omitempty"`
}

Node is a CiliumNode, named after the Kubernetes Node it represents.

type NodeAddress

type NodeAddress struct {
	Type string `json:"type,omitempty"`
	IP   string `json:"ip,omitempty"`
}

NodeAddress is one typed node address.

type NodeIPAM

type NodeIPAM struct {
	PodCIDRs []string `json:"podCIDRs,omitempty"`
}

NodeIPAM holds the Pod CIDRs allocated to the node.

type NodeSpec

type NodeSpec struct {
	Addresses []NodeAddress `json:"addresses,omitempty"`
	IPAM      NodeIPAM      `json:"ipam,omitempty"`
}

NodeSpec holds node addresses and IPAM allocation.

type Policy

type Policy struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              *Rule  `json:"spec,omitempty"`
	Specs             []Rule `json:"specs,omitempty"`
}

Policy is a CiliumNetworkPolicy or CiliumClusterwideNetworkPolicy.

func (Policy) Rules

func (policy Policy) Rules() []Rule

Rules returns the specs list followed by the single spec, matching how Cilium combines them.

type PortProtocol

type PortProtocol struct {
	Port     string `json:"port"`
	Protocol string `json:"protocol,omitempty"`
}

PortProtocol is one port and optional protocol. Port may be a number, range, or name.

type PortRule

type PortRule struct {
	Ports []PortProtocol  `json:"ports,omitempty"`
	Rules json.RawMessage `json:"rules,omitempty"`
}

PortRule is one toPorts entry. Rules is kept raw only to detect L7 rules; its contents are never interpreted or copied to the graph.

type Rule

type Rule struct {
	EndpointSelector metav1.LabelSelector `json:"endpointSelector"`
	Ingress          []IngressRule        `json:"ingress,omitempty"`
	Egress           []EgressRule         `json:"egress,omitempty"`
}

Rule is one policy rule. Only selectors and port-level structure are decoded; peer selectors are not interpreted.

func (Rule) HasL7Rules

func (rule Rule) HasL7Rules() bool

HasL7Rules reports whether any port rule carries a non-empty L7 section. Such rules are excluded from CNI summaries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL