Documentation
¶
Index ¶
- Constants
- Variables
- func CleanupKindCluster(testsFailed bool, clusterName string)
- func EnvoyGatewaySupportsLimitFromMetadata() bool
- func EnvoyGatewayVersion() string
- func InstallOrUpgradeAIGateway(ctx context.Context, aigw AIGatewayHelmOption) (err error)
- func Kubectl(ctx context.Context, args ...string) *exec.Cmd
- func KubectlApplyManifest(ctx context.Context, manifest string) (err error)
- func KubectlApplyManifestStdin(ctx context.Context, manifest string) (err error)
- func KubectlDeleteManifest(ctx context.Context, manifest string) (err error)
- func KubectlDeleteManifestStdin(ctx context.Context, manifest string) (err error)
- func KubectlRestartDeployment(ctx context.Context, namespace, deployment string) error
- func RequireGatewayListenerAddressViaMetalLB(t *testing.T, namespace, name string) (addr string)
- func RequireWaitForGatewayPodReady(t *testing.T, selector string)
- func RequireWaitForPodReady(t *testing.T, namespace, selector string)
- func SetupAll(ctx context.Context, clusterName string, aigwOpts AIGatewayHelmOption, ...) error
- func TestMain(m *testing.M, aigwOpts AIGatewayHelmOption, ...)
- type AIGatewayHelmOption
- type PortForwarder
Constants ¶
const ( // EnvoyGatewayNamespace is the namespace where the Envoy Gateway is installed. EnvoyGatewayNamespace = "envoy-gateway-system" // EnvoyGatewayDefaultServicePort is the default service port for the Envoy Gateway. EnvoyGatewayDefaultServicePort = 80 // EnvoyGatewayLatestVersion is the Envoy Gateway main build, installed by default. It has // features that aren't in a tagged release yet. EnvoyGatewayLatestVersion = "v0.0.0-latest" )
Variables ¶
var KeepCluster = func() bool { v, _ := os.LookupEnv("TEST_KEEP_CLUSTER") return v == "true" }()
By default, kind logs are collected when the e2e tests fail. The TEST_KEEP_CLUSTER environment variable can be set to "true" to preserve the logs and the kind cluster even if the tests pass.
Functions ¶
func CleanupKindCluster ¶ added in v0.4.0
CleanupKindCluster cleans up the kind cluster if the test succeeds and the TEST_KEEP_CLUSTER environment variable is not set to "true".
Also, if the tests failed or TEST_KEEP_CLUSTER is "true", it collects the kind logs into the ./logs directory.
func EnvoyGatewaySupportsLimitFromMetadata ¶ added in v1.1.0
func EnvoyGatewaySupportsLimitFromMetadata() bool
EnvoyGatewaySupportsLimitFromMetadata reports whether the installed Envoy Gateway has BackendTrafficPolicy limit.fromMetadata (envoyproxy/gateway#9216), which only landed on main.
TODO: this only recognizes the "latest" main build. Relax it to a version comparison once a tagged EG release includes envoyproxy/gateway#9216, otherwise it will keep skipping on that release.
func EnvoyGatewayVersion ¶ added in v1.1.0
func EnvoyGatewayVersion() string
EnvoyGatewayVersion is the Envoy Gateway version the e2e suite installs (EG_VERSION, else latest).
func InstallOrUpgradeAIGateway ¶ added in v0.4.0
func InstallOrUpgradeAIGateway(ctx context.Context, aigw AIGatewayHelmOption) (err error)
InstallOrUpgradeAIGateway installs or upgrades the AI Gateway using Helm.
func KubectlApplyManifest ¶
func KubectlApplyManifestStdin ¶
KubectlApplyManifestStdin applies the given manifest using kubectl, reading from stdin.
func KubectlDeleteManifest ¶
KubectlDeleteManifest deletes the given manifest using kubectl.
func KubectlDeleteManifestStdin ¶ added in v1.1.0
func KubectlRestartDeployment ¶ added in v0.4.0
func RequireGatewayListenerAddressViaMetalLB ¶ added in v0.4.0
RequireGatewayListenerAddressViaMetalLB gets the external IP address of the Gateway via MetalLB.
func RequireWaitForGatewayPodReady ¶
RequireWaitForGatewayPodReady waits for the Envoy Gateway pod with the given selector to be ready.
func RequireWaitForPodReady ¶
RequireWaitForPodReady waits for the pod with the given selector to be ready.
func SetupAll ¶ added in v0.4.0
func SetupAll(ctx context.Context, clusterName string, aigwOpts AIGatewayHelmOption, inferenceExtension, needPrometheus bool) error
SetupAll sets up the kind cluster, installs the Envoy Gateway, and installs the AI Gateway.
func TestMain ¶
func TestMain(m *testing.M, aigwOpts AIGatewayHelmOption, inferenceExtension, needPrometheus bool)
TestMain is the entry point for the e2e tests. It sets up the kind cluster, installs the Envoy Gateway, and installs the AI Gateway. It can be called with additional flags for the AI Gateway Helm chart.
When the inferenceExtension flag is set to true, it also installs the Inference Extension and the Inference Pool resources, and the Envoy Gateway configuration which are required for the tests.
Types ¶
type AIGatewayHelmOption ¶ added in v0.4.0
type AIGatewayHelmOption struct {
// ChartVersion is the version of the AI Gateway Helm chart to install. If empty, the locally built chart is used.
// Otherwise, it should be a valid semver version string and the chart will be pulled from the Docker Hub OCI registry.
//
// For example, giving "v0.3.0" here will result in install oci://docker.io/envoyproxy/ai-gateway-helm --version v0.3.0.
ChartVersion string
// AdditionalArgs are additional arguments to pass to the Helm install/upgrade command.
AdditionalArgs []string
// Namespace where the AI Gateway will be installed. Default is "envoy-ai-gateway-system".
Namespace string
}
AIGatewayHelmOption contains options for installing the AI Gateway Helm chart.
func (*AIGatewayHelmOption) GetNamespace ¶ added in v0.4.0
func (a *AIGatewayHelmOption) GetNamespace() string
type PortForwarder ¶
type PortForwarder interface {
// Post sends an HTTP POST request and returns the response body.
// Automatically retries on stale connections during serviceURL rollouts.
Post(ctx context.Context, path, body string) ([]byte, error)
// Kill terminates the port-forward process.
Kill()
// Address returns the local address (e.g., "http://127.0.0.1:12345").
Address() string
}
PortForwarder provides HTTP access to services in a Kubernetes cluster via kubectl port-forward. Thread-safe for concurrent use. Automatically recovers from connection failures during pod rolling updates.
func RequireNewHTTPPortForwarder ¶
func RequireNewHTTPPortForwarder(t *testing.T, namespace string, selector string, servicePort int) PortForwarder
RequireNewHTTPPortForwarder creates a new port forwarder for the given namespace and selector. Returns a PortForwarder that automatically handles connection recovery during pod rolling updates.