Documentation
¶
Index ¶
- Constants
- Variables
- func AuthenticatedHTTPClient(authContext *auth.TestAuthContext) *http.Client
- func CallClusterManagerAPI(authContext *auth.TestAuthContext, method, endpoint string, body interface{}) (*http.Response, error)
- func CheckAllComponentsReady(output string) bool
- func CheckLostConnection(output string) bool
- func CreateCluster(namespace, nodeGUID, templateName string) error
- func CreateClusterAuthenticated(authContext *auth.TestAuthContext, namespace, nodeGUID, templateName string) error
- func DeleteAllTemplate(namespace string) error
- func DeleteCluster(namespace string) error
- func DeleteClusterAuthenticated(authContext *auth.TestAuthContext, namespace string) error
- func DeleteTemplate(namespace, templateName, templateVersion string) error
- func EnsureNamespaceExists(namespace string) error
- func EnsureTCPPortAvailable(port, purpose string) error
- func ExecOnEdgeNode(shellCommand string) ([]byte, error)
- func FetchMetrics() (io.ReadCloser, error)
- func GetClusterInfo(namespace, clusterName string) (*http.Response, error)
- func GetClusterInfoWithAuth(authContext *auth.TestAuthContext, namespace, clusterName string) (*http.Response, error)
- func GetClusterKubeconfigFromAPI(authContext *auth.TestAuthContext, namespace, clusterName string) (*http.Response, error)
- func GetClusterManagerEndpoint() string
- func GetClusterTemplate(namespace, templateName, templateVersion string) (*api.TemplateInfo, error)
- func GetClusterTemplatesWithFilter(namespace, filter string) (*api.TemplateInfoList, error)
- func GetDefaultTemplate(namespace string) (*api.DefaultTemplateInfo, error)
- func GetEdgeNodeProvider() string
- func GetEnv(key, defaultValue string) string
- func ImportClusterTemplate(namespace string, templateType string) error
- func ImportClusterTemplateAuthenticated(authContext *auth.TestAuthContext, namespace string, templateType string) error
- func IsClusterTemplateReady(namespace, templateName string) bool
- func LogCommandOutput(command string, args []string)
- func ParseMetrics(metrics io.Reader) (bool, error)
- func SetDefaultTemplate(namespace, name, version string) error
- func SetupTestAuthentication(subject string) (*auth.TestAuthContext, error)
- func TestClusterManagerAuthentication(authContext *auth.TestAuthContext) error
- func TestDownstreamClusterAccess(kubeconfigContent string) error
- func UnpauseCluster(namespace, clusterName string) error
- type AuthTransport
Constants ¶
const ( LocalGatewayAddress = "http://localhost:8081" ConnectGatewayInternalAddress = "https://connect-gateway.kind.internal:443" TempKubeconfigPattern = "kubeconfig-*.yaml" LocalKubeconfigPattern = "kubeconfig-local-*.yaml" ConnectGatewayPort = 8081 PortForwardStartupDelay = 2 * time.Second )
Constants for downstream cluster access
const ( DefaultNamespace = "53cd37b9-66b2-4cc8-b080-3722ed7af64a" DefaultNodeGUID = "12345678-1234-1234-1234-123456789012" NamespaceEnvVar = "NAMESPACE" NodeGUIDEnvVar = "NODEGUID" ClusterName = "demo-cluster" ClusterOrchFunctionalTest = "cluster-orch-functional-test" ClusterOrchSmokeTest = "cluster-orch-smoke-test" ClusterOrchRobustnessTest = "cluster-orch-robustness-test" ClusterOrchClusterApiAllTest = "cluster-orch-cluster-api-all-test" ClusterOrchClusterApiSmokeTest = "cluster-orch-cluster-api-smoke-test" ClusterOrchTemplateApiSmokeTest = "cluster-orch-template-api-smoke-test" ClusterOrchTemplateApiAllTest = "cluster-orch-template-api-all-test" PortForwardAddress = "0.0.0.0" PortForwardService = "svc/cluster-manager" PortForwardGatewayService = "svc/cluster-connect-gateway" PortForwardLocalPort = "8080" PortForwardRemotePort = "8080" PortForwardGatewayLocalPort = "8081" PortForwardGatewayRemotePort = "8080" K3sTemplateOnlyName = "baseline-k3s" K3sTemplateOnlyVersion = "v0.0.10" K3sTemplateName = "baseline-k3s-v0.0.10" ClusterTemplateURL = "http://127.0.0.1:8080/v2/templates" ClusterCreateURL = "http://127.0.0.1:8080/v2/clusters" ClusterConfigTemplatePath = "../../configs/cluster-config.json" BaselineClusterTemplatePathK3s = "../../configs/baseline-cluster-template-k3s.json" )
const ( // EdgeNodeProviderEnvVar selects which kind of edge node the tests operate against. // Supported value: // - "ven" (default): external VM reachable via SSH (see VEN_* env vars below) EdgeNodeProviderEnvVar = "EDGE_NODE_PROVIDER" EdgeNodeProviderVEN = "ven" VENSSHHostEnvVar = "VEN_SSH_HOST" VENSSHUserEnvVar = "VEN_SSH_USER" VENSSHPortEnvVar = "VEN_SSH_PORT" VENSSHKeyEnvVar = "VEN_SSH_KEY" // path to private key file )
const (
DefaultOIDCConfigFile = "oidc-mock-config-dynamic.yaml"
)
Constants for OIDC configuration
const (
TemplateTypeK3sBaseline = "k3s-baseline"
)
Variables ¶
var (
SkipDeleteCluster = os.Getenv("SKIP_DELETE_CLUSTER") == "true"
)
Functions ¶
func AuthenticatedHTTPClient ¶
func AuthenticatedHTTPClient(authContext *auth.TestAuthContext) *http.Client
AuthenticatedHTTPClient creates an HTTP client with JWT authentication
func CallClusterManagerAPI ¶
func CallClusterManagerAPI(authContext *auth.TestAuthContext, method, endpoint string, body interface{}) (*http.Response, error)
CallClusterManagerAPI makes an authenticated API call to cluster-manager
func CheckAllComponentsReady ¶
CheckAllComponentsReady verifies if all components in the cluster are ready. Compatible with clusterctl describe output from CAPI ≤v1.10 and v1.11+.
CAPI ≤v1.10: second field per row is "True"/"False" (the READY condition). CAPI v1.11+: STATUS column contains "ConditionName: True" or "ConditionName: False". The top-level Cluster row must show a True value before the cluster is considered ready.
func CheckLostConnection ¶
CheckLostConnection verifies if ControlPlane reports connection lost.
func CreateCluster ¶
CreateCluster creates a cluster using the provided configuration.
func CreateClusterAuthenticated ¶
func CreateClusterAuthenticated(authContext *auth.TestAuthContext, namespace, nodeGUID, templateName string) error
CreateClusterAuthenticated creates a cluster using JWT authentication
func DeleteAllTemplate ¶
func DeleteCluster ¶
DeleteCluster deletes a cluster by name.
func DeleteClusterAuthenticated ¶
func DeleteClusterAuthenticated(authContext *auth.TestAuthContext, namespace string) error
DeleteClusterAuthenticated deletes a cluster by name using JWT authentication.
func DeleteTemplate ¶
func EnsureNamespaceExists ¶
EnsureNamespaceExists ensures that the specified namespace exists in the cluster.
func EnsureTCPPortAvailable ¶
EnsureTCPPortAvailable fails fast if a local TCP port is already occupied. This guards against stale kubectl port-forward processes hijacking test traffic.
func ExecOnEdgeNode ¶
ExecOnEdgeNode runs a shell command on the edge node. vEN: ssh into the VM and run the command.
func FetchMetrics ¶
func FetchMetrics() (io.ReadCloser, error)
FetchMetrics fetches the metrics from the /metrics endpoint.
func GetClusterInfoWithAuth ¶
func GetClusterInfoWithAuth(authContext *auth.TestAuthContext, namespace, clusterName string) (*http.Response, error)
GetClusterInfoWithAuth retrieves cluster information using authenticated API call
func GetClusterKubeconfigFromAPI ¶
func GetClusterKubeconfigFromAPI(authContext *auth.TestAuthContext, namespace, clusterName string) (*http.Response, error)
GetClusterKubeconfigFromAPI retrieves kubeconfig from cluster-manager API
func GetClusterManagerEndpoint ¶
func GetClusterManagerEndpoint() string
GetClusterManagerEndpoint returns the cluster-manager API endpoint
func GetClusterTemplate ¶
func GetClusterTemplate(namespace, templateName, templateVersion string) (*api.TemplateInfo, error)
func GetClusterTemplatesWithFilter ¶
func GetClusterTemplatesWithFilter(namespace, filter string) (*api.TemplateInfoList, error)
func GetDefaultTemplate ¶
func GetDefaultTemplate(namespace string) (*api.DefaultTemplateInfo, error)
func GetEdgeNodeProvider ¶
func GetEdgeNodeProvider() string
GetEdgeNodeProvider returns the edge node provider selected via environment variable or the default if not set or invalid.
func GetEnv ¶
GetEnv retrieves the value of the environment variable or returns the default value if not set.
func ImportClusterTemplate ¶
ImportClusterTemplate imports a cluster template into the specified namespace.
func ImportClusterTemplateAuthenticated ¶
func ImportClusterTemplateAuthenticated(authContext *auth.TestAuthContext, namespace string, templateType string) error
ImportClusterTemplateAuthenticated imports a cluster template using JWT authentication
func IsClusterTemplateReady ¶
IsClusterTemplateReady checks if the cluster template is ready.
func LogCommandOutput ¶
func ParseMetrics ¶
ParseMetrics checks if the metric websocket_connections_total with status="succeeded" is 1.
func SetDefaultTemplate ¶
func SetupTestAuthentication ¶
func SetupTestAuthentication(subject string) (*auth.TestAuthContext, error)
SetupTestAuthentication initializes JWT generation and returns auth context
func TestClusterManagerAuthentication ¶
func TestClusterManagerAuthentication(authContext *auth.TestAuthContext) error
TestClusterManagerAuthentication tests if cluster-manager API accepts JWT authentication
func TestDownstreamClusterAccess ¶
TestDownstreamClusterAccess tests accessing the downstream cluster using the provided kubeconfig
func UnpauseCluster ¶
UnpauseCluster sets spec.paused=false for a CAPI Cluster.
Types ¶
type AuthTransport ¶
type AuthTransport struct {
Transport http.RoundTripper
Token string
}
AuthTransport adds JWT authentication to HTTP requests