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: 7 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 decodes Kubernetes objects from their unstructured transport form into typed values for projection. Core and networking kinds use the upstream k8s.io/api types; Gateway API kinds use local subsets that decode only the fields projection interprets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedRoutes

type AllowedRoutes struct {
	Namespaces *RouteNamespaces `json:"namespaces,omitempty"`
}

AllowedRoutes limits which namespaces may attach routes to a listener.

type BackendReference

type BackendReference struct {
	Group     string            `json:"group,omitempty"`
	Kind      string            `json:"kind,omitempty"`
	Namespace string            `json:"namespace,omitempty"`
	Name      string            `json:"name"`
	Port      *int32            `json:"port,omitempty"`
	Weight    *int32            `json:"weight,omitempty"`
	Filters   []json.RawMessage `json:"filters,omitempty"`
}

BackendReference names one route backend, by default a Service.

type Decoded

type Decoded[T any] struct {
	Value    T
	SpecJSON json.RawMessage
}

Decoded wraps a typed object and, when present, its raw spec. The raw spec feeds configuration digests so fields the typed form omits still change the digest.

func Decode

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

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

func Deployment

func Deployment(object *unstructured.Unstructured) (Decoded[appsv1.Deployment], error)

Deployment decodes an apps/v1 Deployment.

func GatewayObject

func GatewayObject(object *unstructured.Unstructured) (Decoded[Gateway], error)

GatewayObject decodes a Gateway.

func HTTPRouteObject

func HTTPRouteObject(object *unstructured.Unstructured) (Decoded[HTTPRoute], error)

HTTPRouteObject decodes an HTTPRoute.

func Ingress

Ingress decodes a networking.k8s.io/v1 Ingress.

func NetworkPolicy

NetworkPolicy decodes a networking.k8s.io/v1 NetworkPolicy.

func Node

Node decodes a core/v1 Node.

func Pod

Pod decodes a core/v1 Pod.

func Service

func Service(object *unstructured.Unstructured) (Decoded[corev1.Service], error)

Service decodes a core/v1 Service.

type Gateway

type Gateway struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              GatewaySpec   `json:"spec,omitempty"`
	Status            GatewayStatus `json:"status,omitempty"`
}

Gateway is the decoded subset of a gateway.networking.k8s.io/v1 Gateway.

type GatewayListener

type GatewayListener struct {
	Name          string          `json:"name"`
	Port          int32           `json:"port"`
	Protocol      string          `json:"protocol"`
	AllowedRoutes *AllowedRoutes  `json:"allowedRoutes,omitempty"`
	TLS           json.RawMessage `json:"tls,omitempty"`
	Hostname      *string         `json:"hostname,omitempty"`
}

GatewayListener is one Gateway listener.

type GatewaySpec

type GatewaySpec struct {
	GatewayClassName string            `json:"gatewayClassName"`
	Addresses        []json.RawMessage `json:"addresses,omitempty"`
	Listeners        []GatewayListener `json:"listeners,omitempty"`
}

GatewaySpec decodes the class, listeners, and requested addresses.

type GatewayStatus

type GatewayStatus struct {
	Addresses  []json.RawMessage  `json:"addresses,omitempty"`
	Listeners  []json.RawMessage  `json:"listeners,omitempty"`
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

GatewayStatus holds controller-reported addresses and conditions. They are observed controller state, not proof of reachability.

type HTTPRoute

type HTTPRoute struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              HTTPRouteSpec   `json:"spec,omitempty"`
	Status            HTTPRouteStatus `json:"status,omitempty"`
}

HTTPRoute is the decoded subset of a gateway.networking.k8s.io/v1 HTTPRoute.

type HTTPRouteRule

type HTTPRouteRule struct {
	Matches     []json.RawMessage  `json:"matches,omitempty"`
	Filters     []json.RawMessage  `json:"filters,omitempty"`
	BackendRefs []BackendReference `json:"backendRefs,omitempty"`
}

HTTPRouteRule holds one rule's backends. Matches and filters stay raw for digests and are not interpreted.

type HTTPRouteSpec

type HTTPRouteSpec struct {
	Hostnames  []string          `json:"hostnames,omitempty"`
	ParentRefs []ParentReference `json:"parentRefs,omitempty"`
	Rules      []HTTPRouteRule   `json:"rules,omitempty"`
}

HTTPRouteSpec decodes hostnames, parent references, and backend rules.

type HTTPRouteStatus

type HTTPRouteStatus struct {
	Parents []json.RawMessage `json:"parents,omitempty"`
}

HTTPRouteStatus holds raw per-parent status entries.

type ParentReference

type ParentReference struct {
	Group       string `json:"group,omitempty"`
	Kind        string `json:"kind,omitempty"`
	Namespace   string `json:"namespace,omitempty"`
	Name        string `json:"name"`
	SectionName string `json:"sectionName,omitempty"`
	Port        *int32 `json:"port,omitempty"`
}

ParentReference names a Gateway or other parent a route attaches to.

type RouteNamespaces

type RouteNamespaces struct {
	From     string                `json:"from,omitempty"`
	Selector *metav1.LabelSelector `json:"selector,omitempty"`
}

RouteNamespaces is the namespace policy for route attachment.

Jump to

Keyboard shortcuts

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