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 ¶
- type AllowedRoutes
- type BackendReference
- type Decoded
- func Decode[T any](object *unstructured.Unstructured) (Decoded[T], error)
- func Deployment(object *unstructured.Unstructured) (Decoded[appsv1.Deployment], error)
- func GatewayObject(object *unstructured.Unstructured) (Decoded[Gateway], error)
- func HTTPRouteObject(object *unstructured.Unstructured) (Decoded[HTTPRoute], error)
- func Ingress(object *unstructured.Unstructured) (Decoded[networkingv1.Ingress], error)
- func NetworkPolicy(object *unstructured.Unstructured) (Decoded[networkingv1.NetworkPolicy], error)
- func Node(object *unstructured.Unstructured) (Decoded[corev1.Node], error)
- func Pod(object *unstructured.Unstructured) (Decoded[corev1.Pod], error)
- func Service(object *unstructured.Unstructured) (Decoded[corev1.Service], error)
- type Gateway
- type GatewayListener
- type GatewaySpec
- type GatewayStatus
- type HTTPRoute
- type HTTPRouteRule
- type HTTPRouteSpec
- type HTTPRouteStatus
- type ParentReference
- type RouteNamespaces
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 ¶
func Ingress(object *unstructured.Unstructured) (Decoded[networkingv1.Ingress], error)
Ingress decodes a networking.k8s.io/v1 Ingress.
func NetworkPolicy ¶
func NetworkPolicy(object *unstructured.Unstructured) (Decoded[networkingv1.NetworkPolicy], error)
NetworkPolicy decodes a networking.k8s.io/v1 NetworkPolicy.
func Node ¶
func Node(object *unstructured.Unstructured) (Decoded[corev1.Node], error)
Node decodes a core/v1 Node.
func Pod ¶
func Pod(object *unstructured.Unstructured) (Decoded[corev1.Pod], error)
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.