resolve

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package resolve implements resolution for the Route CR.

The Route CR stores its spec as a raw JSON contract (spec.contract). ResolveRoute decodes this into a fully typed ResolvedRoute — the authoritative runtime representation consumed by all downstream domain and application logic.

Route declares the intent to expose a ServiceUnit at a host and path. The controller materializes the route through the selected runtime (Kubernetes Ingress, Knative DomainMapping, or Gateway API HTTPRoute). Owned by an Environment CR via ownerReference (cascade delete).

Workload resolution:

Route.spec.serviceUnitRef names the ServiceUnit in the same namespace.
The controller derives the ksvc/K8s service name by convention:
  ksvc name == ServiceUnit name
No ServiceUnit status lookup is required during resolution.

All failures surface as errors. Resolution never panics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResolvedRoute

type ResolvedRoute struct {
	Route *networksv1alpha1.Route
	Spec  *ResolvedRouteSpec
}

ResolvedRoute pairs the original Kubernetes Route object with its fully decoded and validated spec.

func ResolveRoute

func ResolveRoute(route *networksv1alpha1.Route) (*ResolvedRoute, error)

ResolveRoute decodes and validates the raw JSON contract from the Route CR spec into a ResolvedRoute. Returns an error if the CR is nil, the contract is absent, or any required field is missing or malformed.

type ResolvedRouteSpec

type ResolvedRouteSpec struct {
	// Host is the fully qualified domain name to serve.
	// e.g. app.dev.blanketops.online
	Host string

	// Enabled controls whether the route is active. Defaults to true.
	// Disabled routes are removed from the runtime but the CR is retained.
	Enabled bool

	// Path is the HTTP path prefix to match.
	// e.g. /, /v1, /api. Defaults to "/" when absent.
	Path string

	// TLSEnabled controls whether TLS termination is enforced.
	// Certificate provisioning is delegated to cert-manager via the platform
	// issuer (DNS01 wildcard or namespaced HTTP01). Defaults to true.
	TLSEnabled bool

	// Runtime is the serving backend responsible for materializing this route.
	// Mandatory — backend selection in pkg/routes/application/ branches on this.
	Runtime *Runtime

	// ServiceUnitRef identifies the ServiceUnit this Route exposes.
	// Mandatory — a Route without a workload binding is invalid.
	// The controller derives the ksvc/K8s service name by convention:
	//   ksvc name == ServiceUnitRef.Name
	// No ServiceUnit status lookup is required.
	ServiceUnitRef *ResolvedServiceUnitRef
}

ResolvedRouteSpec is the decoded and validated Route spec. Fields mirror the proto RouteSpec — consumers must not re-read from the raw CR.

type ResolvedServiceUnitRef

type ResolvedServiceUnitRef struct {
	// Name is the ServiceUnit CR name in the same namespace as this Route.
	Name string
}

ResolvedServiceUnitRef is the decoded reference to a ServiceUnit CR. Mirrors proto ServiceUnitRef — name only; namespace is always this Route's namespace.

type Runtime

type Runtime string

Runtime identifies the serving backend that materializes this Route. Corresponds to blanketops.common.v1.RouteRuntime in the proto contract.

const (
	// RuntimeKnativeService materializes the route as a Knative DomainMapping
	// via Kourier. Covers both "knative-service" and "knative" contract values.
	RuntimeKnativeService Runtime = "knative-service"

	// RuntimeKubernetesContainer materializes the route as a standard Kubernetes
	// Ingress resource. Covers "kubernetes-container" contract values.
	RuntimeKubernetesContainer Runtime = "kubernetes-container"

	// RuntimeGatewayAPI materializes the route as a Gateway API HTTPRoute.
	// Future — not yet supported by any backend provider.
	RuntimeGatewayAPI Runtime = "gateway-api"
)

Jump to

Keyboard shortcuts

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