Documentation
¶
Index ¶
- Variables
- func ConvertYAMLToObjects(scheme *runtime.Scheme, yamlData []byte) ([]client.Object, error)
- func DeepMergeMaps[keyT comparable, valT any](dst, src map[keyT]valT) map[keyT]valT
- func DeepMergeResourceRequirements(dst, src *corev1.ResourceRequirements) *corev1.ResourceRequirements
- func DefaultGatewayIRGetter(gw *gwv1.Gateway, agwCollections *agwplugins.AgwCollections) *collections.GatewayForDeployer
- func GatewayIRFrom(gw *gwv1.Gateway, controllerNameGuess string) *collections.GatewayForDeployer
- func GatewayReleaseNameAndNamespace(obj client.Object) (string, string)
- func GenerateListenerNameFromPort(port gwv1.PortNumber) string
- func GetCommonExemptFeatures() sets.Set[features.Feature]
- func GetLoadBalancerIPFromGatewayAddresses(gw *gwv1.Gateway) (*string, error)
- func GetSupportedFeaturesForAgentGateway() []gwv1.SupportedFeature
- func JsonConvert(in *HelmConfig, out any) error
- func LoadAgentgatewayChart() (*chartv2.Chart, error)
- func ResolveIstioIntegration(gtw *AgentgatewayHelmGateway, cols *agwplugins.AgwCollections)
- func SanitizePortName(name string) string
- func SetLoadBalancerIPFromGatewayForAgentgateway(gw *gwv1.Gateway, svc *AgentgatewayHelmService) error
- type AgentgatewayHelmGateway
- type AgentgatewayHelmService
- type AgentgatewayParametersApplier
- type ControlPlaneInfo
- type Deployer
- func (d *Deployer) DeployObjs(ctx context.Context, objs []client.Object) error
- func (d *Deployer) DeployObjsWithSource(ctx context.Context, objs []client.Object, sourceObj client.Object) error
- func (d *Deployer) GetGvksToWatch(ctx context.Context, vals map[string]any) ([]schema.GroupVersionKind, error)
- func (d *Deployer) GetObjsToDeploy(ctx context.Context, obj client.Object) ([]client.Object, error)
- func (d *Deployer) PruneRemovedResources(ctx context.Context, owner client.Object, desiredObjs []client.Object) error
- func (d *Deployer) RenderChartToObjects(ns, name string, vals map[string]any) ([]client.Object, error)
- func (d *Deployer) RenderManifest(ns, name string, vals map[string]any) ([]byte, error)
- func (d *Deployer) RenderToObjects(ns, name string, vals map[string]any) ([]client.Object, error)
- func (d *Deployer) SetNamespaceAndOwner(owner client.Object, objs []client.Object) []client.Objectdeprecated
- func (d *Deployer) SetNamespaceAndOwnerWithGVK(owner client.Object, ownerGVK schema.GroupVersionKind, objs []client.Object) []client.Object
- type GatewayClassInfo
- type GatewayParameters
- func (gp *GatewayParameters) GetAgentgatewayParametersClient() kclient.Client[*agentgateway.AgentgatewayParameters]
- func (gp *GatewayParameters) GetCacheSyncHandlers() []cache.InformerSynced
- func (gp *GatewayParameters) GetValues(ctx context.Context, obj client.Object) (map[string]any, error)
- func (gp *GatewayParameters) PostProcessObjects(ctx context.Context, obj client.Object, rendered []client.Object) ([]client.Object, error)
- func (gp *GatewayParameters) WithHelmValuesGeneratorOverride(generator HelmValuesGenerator) *GatewayParameters
- func (gp *GatewayParameters) WithSessionKeyGenerator(generator func() (string, error)) *GatewayParameters
- type HelmConfig
- type HelmEndpointPickerExtension
- type HelmInferenceExtension
- type HelmPort
- type HelmValuesGenerator
- type HelmXds
- type HelmXdsTls
- type ImageInfo
- type InMemoryGatewayParametersConfig
- type InferenceExtInfo
- type Inputs
- type ObjectPostProcessor
- type Option
- type Patcher
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMultipleAddresses is returned when multiple addresses are specified in Gateway.spec.addresses ErrMultipleAddresses = errors.New("multiple addresses given, only one address is supported") // ErrNoValidIPAddress is returned when no valid IP address is found in Gateway.spec.addresses ErrNoValidIPAddress = errors.New("IP address in Gateway.spec.addresses not valid") )
var ErrListenerPortOutOfRange = fmt.Errorf("port is out of range")
var ErrListenerPortReserved = fmt.Errorf("port is reserved")
var ( // ErrNoValidPorts is returned when no valid ports are found for the Gateway ErrNoValidPorts = errors.New("no valid ports") )
Functions ¶
func ConvertYAMLToObjects ¶
func DeepMergeMaps ¶ added in v1.1.0
func DeepMergeMaps[keyT comparable, valT any](dst, src map[keyT]valT) map[keyT]valT
DeepMergeMaps will use dst if src is nil, src if dest is nil, or add all entries from src into dst if neither are nil
func DeepMergeResourceRequirements ¶ added in v1.1.0
func DeepMergeResourceRequirements(dst, src *corev1.ResourceRequirements) *corev1.ResourceRequirements
func DefaultGatewayIRGetter ¶ added in v1.1.0
func DefaultGatewayIRGetter(gw *gwv1.Gateway, agwCollections *agwplugins.AgwCollections) *collections.GatewayForDeployer
func GatewayIRFrom ¶ added in v1.1.0
func GatewayIRFrom(gw *gwv1.Gateway, controllerNameGuess string) *collections.GatewayForDeployer
func GatewayReleaseNameAndNamespace ¶ added in v1.1.0
func GenerateListenerNameFromPort ¶
func GenerateListenerNameFromPort(port gwv1.PortNumber) string
func GetCommonExemptFeatures ¶
GetCommonExemptFeatures returns the set of features that are commonly unsupported across all gateway classes. Exported for use in the conformance test suite.
func GetLoadBalancerIPFromGatewayAddresses ¶
GetLoadBalancerIPFromGatewayAddresses extracts the IP address from Gateway.spec.addresses. Returns the IP address if exactly one valid IP address is found, nil if no addresses are specified, or an error if more than one address is specified or no valid IP address is found.
func GetSupportedFeaturesForAgentGateway ¶
func GetSupportedFeaturesForAgentGateway() []gwv1.SupportedFeature
GetSupportedFeaturesForAgentGateway returns the supported features for the agent Gateway class. Agent gateways support additional features beyond the standard gateway class.
func JsonConvert ¶
func JsonConvert(in *HelmConfig, out any) error
func LoadAgentgatewayChart ¶ added in v1.1.0
func ResolveIstioIntegration ¶ added in v1.3.0
func ResolveIstioIntegration(gtw *AgentgatewayHelmGateway, cols *agwplugins.AgwCollections)
ResolveIstioIntegration finalizes the gateway's Istio block. It runs after AGWP params are applied so per-gateway spec.istio values take precedence. When integration is enabled it seeds any unset control-plane mesh values (cluster ID, network, CA address) and infers the trust domain from mesh config; when disabled it clears the block so the deployment renders without Istio.
func SanitizePortName ¶
func SetLoadBalancerIPFromGatewayForAgentgateway ¶
func SetLoadBalancerIPFromGatewayForAgentgateway(gw *gwv1.Gateway, svc *AgentgatewayHelmService) error
SetLoadBalancerIPFromGatewayForAgentgateway extracts the IP address from Gateway.spec.addresses and sets it on the AgentgatewayHelmService. Only sets the IP if exactly one valid IP address is found in Gateway.spec.addresses. Returns an error if more than one address is specified or no valid IP address is found. Note: Agentgateway services are always LoadBalancer type, so no service type check is needed.
Types ¶
type AgentgatewayHelmGateway ¶
type AgentgatewayHelmGateway struct {
agentgateway.AgentgatewayParametersConfigs `json:",inline"`
// SessionKeySecretName is the Secret name used by the dataplane mount.
SessionKeySecretName *string `json:"sessionKeySecretName,omitempty"`
// naming
Name *string `json:"name,omitempty"`
GatewayClassName *string `json:"gatewayClassName,omitempty"`
GatewayAnnotations map[string]string `json:"gatewayAnnotations,omitempty"`
GatewayLabels map[string]string `json:"gatewayLabels,omitempty"`
// deployment/service values
Ports []HelmPort `json:"ports,omitempty"`
Service *AgentgatewayHelmService `json:"service,omitempty"`
// agentgateway xds values
Xds *HelmXds `json:"xds,omitempty"`
}
type AgentgatewayHelmService ¶
type AgentgatewayHelmService struct {
LoadBalancerIP *string `json:"loadBalancerIP,omitempty"`
}
type AgentgatewayParametersApplier ¶ added in v1.1.0
type AgentgatewayParametersApplier struct {
// contains filtered or unexported fields
}
AgentgatewayParametersApplier applies AgentgatewayParameters configurations and overlays.
func NewAgentgatewayParametersApplier ¶ added in v1.1.0
func NewAgentgatewayParametersApplier(params *agentgateway.AgentgatewayParameters) *AgentgatewayParametersApplier
NewAgentgatewayParametersApplier creates a new applier from the resolved parameters.
func (*AgentgatewayParametersApplier) ApplyOverlaysToObjects ¶ added in v1.1.0
func (a *AgentgatewayParametersApplier) ApplyOverlaysToObjects(objs []client.Object) ([]client.Object, error)
ApplyOverlaysToObjects applies the strategic-merge-patch overlays to rendered k8s objects. This is called after rendering the helm chart. It returns the (potentially modified) slice of objects, as new objects may be added (e.g., PodDisruptionBudget, HorizontalPodAutoscaler).
func (*AgentgatewayParametersApplier) ApplyToHelmValues ¶ added in v1.1.0
func (a *AgentgatewayParametersApplier) ApplyToHelmValues(vals *HelmConfig)
ApplyToHelmValues applies the AgentgatewayParameters configs to the helm values. This is called before rendering the helm chart. (We render a helm chart, but we do not use helm beyond that point.)
type ControlPlaneInfo ¶
type Deployer ¶
type Deployer struct {
// contains filtered or unexported fields
}
A Deployer is responsible for deploying proxies and inference extensions.
func NewDeployerWithMultipleCharts ¶
func NewDeployerWithMultipleCharts( agwControllerName, agwGatewayClassName string, scheme *runtime.Scheme, client apiclient.Client, agentgatewayChart *chartv2.Chart, hvg HelmValuesGenerator, helmReleaseNameAndNamespaceGenerator func(obj client.Object) (string, string), opts ...Option, ) *Deployer
NewDeployerWithMultipleCharts creates a new gateway deployer that supports both envoy and agentgateway charts
func NewGatewayDeployer ¶ added in v1.1.0
func (*Deployer) DeployObjs ¶
func (*Deployer) DeployObjsWithSource ¶
func (*Deployer) GetGvksToWatch ¶
func (*Deployer) GetObjsToDeploy ¶
GetObjsToDeploy does the following:
* uses HelmValuesGenerator to perform lookup/merging etc to get a final set of helm values
* use those helm values to render the helm chart the deployer was instantiated with into k8s objects
* sets ownerRefs on all generated objects
* returns the objects to be deployed by the caller
obj can currently be a pointer to a Gateway (https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1/gateway_types.go#L35) or
a pointer to an InferencePool (https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/api/v1alpha2/inferencepool_types.go#L30)
func (*Deployer) PruneRemovedResources ¶
func (d *Deployer) PruneRemovedResources(ctx context.Context, owner client.Object, desiredObjs []client.Object) error
PruneRemovedResources deletes generated resources associated with the owner when they are no longer in the desired set. This removes stale workloads after workload-kind switches and stale autoscaling or disruption resources after configuration changes.
func (*Deployer) RenderChartToObjects ¶
func (*Deployer) RenderManifest ¶
func (*Deployer) RenderToObjects ¶
RenderToObjects relies on a `helm install` to render the Chart with the injected values It returns the list of Objects that are rendered, and an optional error if rendering failed, or converting the rendered manifests to objects failed.
func (*Deployer) SetNamespaceAndOwner
deprecated
type GatewayClassInfo ¶
type GatewayClassInfo struct {
// Description is a human-readable description of the GatewayClass.
Description string
// Labels are the labels to be added to the GatewayClass.
Labels map[string]string
// Annotations are the annotations to be added to the GatewayClass.
Annotations map[string]string
// ParametersRef is the reference to the GatewayParameters object.
ParametersRef *gwv1.ParametersReference
// ControllerName is the name of the controller that is managing the GatewayClass.
ControllerName string
// SupportedFeatures is the list of Gateway API features supported by this GatewayClass.
// This will be populated in the GatewayClass status.supportedFeatures field.
SupportedFeatures []gwv1.SupportedFeature
}
GatewayClassInfo describes the desired configuration for a GatewayClass.
type GatewayParameters ¶ added in v1.1.0
type GatewayParameters struct {
// contains filtered or unexported fields
}
func NewGatewayParameters ¶ added in v1.1.0
func NewGatewayParameters(cli apiclient.Client, inputs *Inputs) *GatewayParameters
func (*GatewayParameters) GetAgentgatewayParametersClient ¶ added in v1.1.0
func (gp *GatewayParameters) GetAgentgatewayParametersClient() kclient.Client[*agentgateway.AgentgatewayParameters]
GetAgentgatewayParametersClient returns the AgentgatewayParameters client if Agentgateway is enabled, nil otherwise. This allows the reconciler to reuse the same client for watching changes.
func (*GatewayParameters) GetCacheSyncHandlers ¶ added in v1.1.0
func (gp *GatewayParameters) GetCacheSyncHandlers() []cache.InformerSynced
func (*GatewayParameters) PostProcessObjects ¶ added in v1.1.0
func (gp *GatewayParameters) PostProcessObjects(ctx context.Context, obj client.Object, rendered []client.Object) ([]client.Object, error)
PostProcessObjects implements deployer.ObjectPostProcessor. It applies GatewayParameters or AgentgatewayParameters overlays to the rendered objects. When both GatewayClass and Gateway have parameters, the overlays are applied in order: GatewayClass first, then Gateway on top.
func (*GatewayParameters) WithHelmValuesGeneratorOverride ¶ added in v1.1.0
func (gp *GatewayParameters) WithHelmValuesGeneratorOverride(generator HelmValuesGenerator) *GatewayParameters
func (*GatewayParameters) WithSessionKeyGenerator ¶ added in v1.1.0
func (gp *GatewayParameters) WithSessionKeyGenerator(generator func() (string, error)) *GatewayParameters
type HelmConfig ¶
type HelmConfig struct {
Agentgateway *AgentgatewayHelmGateway `json:"agentgateway,omitempty"`
InferenceExtension *HelmInferenceExtension `json:"inferenceExtension,omitempty"`
}
helmConfig stores the top-level helm values used by the deployer.
type HelmInferenceExtension ¶
type HelmInferenceExtension struct {
EndpointPicker *HelmEndpointPickerExtension `json:"endpointPicker,omitempty"`
}
type HelmPort ¶
type HelmPort struct {
Port *int32 `json:"port,omitempty"`
Protocol *string `json:"protocol,omitempty"`
Name *string `json:"name,omitempty"`
TargetPort *int32 `json:"targetPort,omitempty"`
NodePort *int32 `json:"nodePort,omitempty"`
}
helmPort represents a Gateway Listener port
func GetPortsValues ¶
func GetPortsValues(gw *collections.GatewayForDeployer, noListenersDummyPort int32) []HelmPort
Extract the listener ports from a Gateway and corresponding listener sets. These will be used to populate: 1. the ports exposed on the envoy container 2. the ports exposed on the proxy service
type HelmValuesGenerator ¶
type HelmValuesGenerator interface {
// GetValues returns the helm values used to render the dynamically provisioned resources
// for the given object (e.g. Gateway). If the values returned are nil, it indicates that
// the object is self-managed and no resources should be provisioned.
GetValues(ctx context.Context, obj client.Object) (map[string]any, error)
// GetCacheSyncHandlers returns the cache sync handlers for the HelmValuesGenerator controller
GetCacheSyncHandlers() []cache.InformerSynced
}
Deployer uses HelmValueGenerator implementation to generate a set of helm values when rendering a Helm chart
type HelmXds ¶
type HelmXds struct {
Host *string `json:"host,omitempty"`
Port *uint32 `json:"port,omitempty"`
Tls *HelmXdsTls `json:"tls,omitempty"`
}
helmXds represents the xds host and port to which envoy will connect to receive xds config updates
type HelmXdsTls ¶
type InMemoryGatewayParametersConfig ¶
type InMemoryGatewayParametersConfig struct {
ClassName string
ImageInfo *ImageInfo
AgwControllerName string
OmitDefaultSecurityContext bool
}
InMemoryGatewayParametersConfig holds the configuration for creating in-memory GatewayParameters.
type InferenceExtInfo ¶
type InferenceExtInfo struct{}
InferenceExtInfo defines the runtime state of Gateway API inference extensions.
type Inputs ¶
type Inputs struct {
ImageDefaults *agentgateway.Image
ControlPlane ControlPlaneInfo
NoListenersDummyPort uint16
AgwCollections *agwplugins.AgwCollections
AgentgatewayClassName string
AgentgatewayControllerName string
}
Inputs is the set of options used to configure gateway/inference pool deployment.
type ObjectPostProcessor ¶
type ObjectPostProcessor interface {
// PostProcessObjects applies any post-processing to the rendered objects.
// This is called after helm rendering but before deployment.
// It returns the (potentially modified) slice of objects, as new objects may be added
// (e.g., PodDisruptionBudget, HorizontalPodAutoscaler).
PostProcessObjects(ctx context.Context, obj client.Object, rendered []client.Object) ([]client.Object, error)
}
ObjectPostProcessor is an optional interface that can be implemented by HelmValuesGenerator to post-process rendered objects before they are deployed. This is used for applying strategic merge patch overlays from AgentgatewayParameters.
type Option ¶
type Option func(*Deployer)
func WithGVKToGVRMapper ¶
func WithGVKToGVRMapper(m map[schema.GroupVersionKind]schema.GroupVersionResource) Option