Documentation
¶
Index ¶
- Variables
- func ConvertYAMLToObjects(scheme *runtime.Scheme, yamlData []byte) ([]client.Object, error)
- 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 SanitizePortName(name string) string
- func SetLoadBalancerIPFromGatewayForAgentgateway(gw *gwv1.Gateway, svc *AgentgatewayHelmService) error
- type AgentgatewayHelmGateway
- type AgentgatewayHelmService
- 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 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 ( GatewayParametersError = errors.New("could not retrieve GatewayParameters") GetGatewayParametersForGatewayError = func(err error, gwpNamespace, gwpName, gwNamespace, gwName, resourceType string) error { return fmt.Errorf("(%s.%s) for %s (%s.%s): %w", gwpNamespace, gwpName, resourceType, gwNamespace, gwName, fmt.Errorf("%s: %w", GatewayParametersError.Error(), err)) } GetGatewayParametersForGatewayClassError = func(err error, gwpNamespace, gwpName, gwcName, resourceType string) error { return fmt.Errorf("(%s.%s) for %s (%s): %w", gwpNamespace, gwpName, resourceType, gwcName, fmt.Errorf("%s: %w", GatewayParametersError.Error(), err)) } NilDeployerInputsErr = errors.New("nil inputs to NewDeployer") )
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 ComponentLogLevelEmptyError = func(key string, value string) error { return fmt.Errorf("an empty key or value was provided in componentLogLevels: key=%s, value=%s", key, value) }
var ErrListenerPortOutOfRange = fmt.Errorf("port is out of range")
var ErrListenerPortReserved = fmt.Errorf("port is reserved")
Functions ¶
func ConvertYAMLToObjects ¶
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 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 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 *chart.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 (*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 PDB/HPA/VPA resources that are owned by the owner but are no longer in the desired set of objects. This prevents stale autoscaling resources from persisting when 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 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 {
Dev bool
ImageDefaults *agentgateway.Image
ControlPlane ControlPlaneInfo
NoListenersDummyPort uint16
ImageInfo *ImageInfo
CommonCollections *collections.CommonCollections
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