Documentation
¶
Index ¶
- Variables
- func CreateRuntimeObject(ctx context.Context, client ctrlruntimeclient.Client, ...) error
- func CreateRuntimeObjectsFromYAMLFiles(params RuntimeYamlParams) error
- func DeleteRuntimeObject(ctx context.Context, client ctrlruntimeclient.Client, ...) error
- func DeleteRuntimeObjectsFromYAMLFiles(params RuntimeYamlParams) error
- func DerivePortMap(namespace string, templatePorts []int) map[int]int
- func ExportBackend(be *models.Backend)
- func ExportFrontend(fe *models.Frontend)
- func GetCRDFixturePath() string
- func GetIntTestNamespace(levelsUp int) (string, error)
- func RuntimeFromBytes(ctrlclient ctrlruntimeclient.Client, manifest []byte) (runtime.Object, *schema.GroupVersionKind, error)
- func SortListenerStatus(listeners []gatewayv1.ListenerStatus)
- func SubstitutePortsInContent(content []byte, portMap map[int]int) []byte
- func SubstitutePortsInString(s string, portMap map[int]int) string
- func WaitFor(ctx context.Context, interval time.Duration, timeout time.Duration, ...) bool
- type RuntimeYamlParams
Constants ¶
This section is empty.
Variables ¶
var TemplatePorts = []int{31445, 31444, 31081, 9090, 8443, 8088, 8081, 8080}
TemplatePorts lists every port number used in test gateway manifests. Sorted descending so substitution always replaces longer ports first (e.g. 31081 before 8081) and avoids partial-match corruption.
Functions ¶
func CreateRuntimeObject ¶
func CreateRuntimeObject(ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, waitForResult bool) error
func CreateRuntimeObjectsFromYAMLFiles ¶
func CreateRuntimeObjectsFromYAMLFiles(params RuntimeYamlParams) error
CreateRuntimeObjectsFromYAMLFiles reads YAML files, decodes them into Kubernetes objects, and creates them using the provided client. It handles multi-document YAML files (separated by "---").
func DeleteRuntimeObject ¶
func DeleteRuntimeObject(ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, waitForResult bool) error
func DeleteRuntimeObjectsFromYAMLFiles ¶
func DeleteRuntimeObjectsFromYAMLFiles(params RuntimeYamlParams) error
func DerivePortMap ¶ added in v1.0.3
DerivePortMap deterministically maps each template port to a unique unprivileged port derived from the test namespace name. Using a hash avoids any TOCTOU race: no listener is opened and immediately closed, so no other process can steal the port between allocation and the eventual HAProxy bind.
Port range: 20000–29999. This sits below Linux's default ephemeral range (32768–60999), above the IANA registered range, and is unlikely to be used by system services. With 5000 available base slots (one per 2 ports) and the small number of test packages, hash collisions between packages are astronomically unlikely.
func ExportBackend ¶ added in v1.0.3
func ExportFrontend ¶ added in v1.0.3
func GetCRDFixturePath ¶
func GetCRDFixturePath() string
func GetIntTestNamespace ¶
func RuntimeFromBytes ¶
func RuntimeFromBytes(ctrlclient ctrlruntimeclient.Client, manifest []byte) (runtime.Object, *schema.GroupVersionKind, error)
RuntimeFromBytes returns a list of Kubernetes runtime objects from their yaml templates.
func SortListenerStatus ¶ added in v1.0.0
func SortListenerStatus(listeners []gatewayv1.ListenerStatus)
func SubstitutePortsInContent ¶ added in v1.0.3
SubstitutePortsInContent replaces every template port number that appears in content with its actual counterpart from portMap. Ports are processed in descending order so that a longer port (e.g. 31081) is replaced before a shorter one it contains (e.g. 8081), preventing partial-match corruption.
func SubstitutePortsInString ¶ added in v1.0.3
SubstitutePortsInString is the string-valued variant of SubstitutePortsInContent.