Documentation
¶
Index ¶
- func CreateNamespace(name string) error
- func DeleteNamespace(name string, timeout string) error
- func GetNamespace(name string) (*corev1.Namespace, error)
- func ValidateJSONPath(jsonPath string) error
- func ValidateLabelSelector(selector string) error
- func ValidateNamespace(namespace string) error
- func ValidateResourceName(name string) error
- func ValidateResourceType(resourceType string) error
- func ValidateTimeout(timeout string) error
- type Client
- func (c *Client) Apply(yamlContent string) error
- func (c *Client) ApplyWithoutNamespaceOverride(yamlContent string) error
- func (c *Client) Delete(resourceType, name string) error
- func (c *Client) DeleteClusterScoped(resourceType, name string) error
- func (c *Client) DeleteFromYAML(yamlContent string) error
- func (c *Client) Get(resourceType, name string) ([]byte, error)
- func (c *Client) GetAll(resourceType string, labelSelector string) (string, error)
- func (c *Client) GetPodLogs(podName string) (string, error)
- func (c *Client) GetPodLogsSince(podName string, since string) (string, error)
- func (c *Client) GetPodLogsSinceTime(podName string, since time.Time, tailLines int) (string, error)
- func (c *Client) GetPodLogsTail(podName string, lines int) (string, error)
- func (c *Client) GetPodsByLabel(labelSelector string) ([]string, error)
- func (c *Client) GetWithJsonPath(resourceType, name, jsonPath string) (string, error)
- func (c *Client) Wait(resourceType, name, condition string, timeout string) error
- func (c *Client) WaitForDeploymentReady(name string)
- func (c *Client) WaitForPipelineInvalid(name string)
- func (c *Client) WaitForPipelineValid(name string)
- func (c *Client) WaitForPodReady(podName string, timeout string) error
- func (c *Client) WaitForServiceCount(labelSelector string, expectedCount int, timeout time.Duration)
- func (c *Client) WaitForServiceExists(name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteNamespace ¶
DeleteNamespace deletes a namespace with retry and force delete fallback Handles CRD resources with finalizers to prevent stuck namespaces
func GetNamespace ¶
GetNamespace retrieves namespace information
func ValidateJSONPath ¶
ValidateJSONPath validates JSONPath expressions used with kubectl. This is a basic validation to prevent obvious injection attempts.
func ValidateLabelSelector ¶
ValidateLabelSelector validates Kubernetes label selectors. Label selectors have specific syntax requirements for keys and values.
func ValidateNamespace ¶
ValidateNamespace validates namespace against RFC 1123 DNS Label requirements. A valid namespace must: - Be 1-63 characters long - Contain only lowercase alphanumeric characters or '-' - Start with an alphanumeric character - End with an alphanumeric character Empty namespace is allowed for cluster-scoped resources
func ValidateResourceName ¶
ValidateResourceName validates Kubernetes resource names against RFC 1123 DNS Subdomain requirements. A valid resource name must: - Be 1-253 characters long - Contain only lowercase alphanumeric characters, '-', or '.' - Start with an alphanumeric character - End with an alphanumeric character
func ValidateResourceType ¶
ValidateResourceType validates Kubernetes resource type names. These are typically lowercase and may contain '.' for API groups.
func ValidateTimeout ¶
ValidateTimeout validates timeout strings used with kubectl commands. Valid formats: "30s", "5m", "1h", "2m0s", "1h30m", "1h30m45s" Accepts both simple format (5m) and Go duration format (5m0s)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides convenient kubectl operations
func (*Client) Apply ¶
Apply applies YAML content to the cluster with explicit namespace override This ensures resources are created in the correct test namespace
func (*Client) ApplyWithoutNamespaceOverride ¶
ApplyWithoutNamespaceOverride applies YAML content without forcing namespace Use this when the YAML already contains the correct namespace field
func (*Client) DeleteClusterScoped ¶
DeleteClusterScoped deletes a cluster-scoped resource (no namespace)
func (*Client) DeleteFromYAML ¶
DeleteFromYAML deletes resources from YAML content
func (*Client) GetPodLogs ¶
GetPodLogs retrieves logs from a pod
func (*Client) GetPodLogsSince ¶
GetPodLogsSince retrieves logs from a pod since a specific time
func (*Client) GetPodLogsSinceTime ¶
func (c *Client) GetPodLogsSinceTime(podName string, since time.Time, tailLines int) (string, error)
GetPodLogsSinceTime retrieves logs from a pod since a specific time with line limit Uses --since-time for temporal filtering and --tail as a safety limit
func (*Client) GetPodLogsTail ¶
GetPodLogsTail retrieves the last N lines of logs from a pod
func (*Client) GetPodsByLabel ¶
GetPodsByLabel retrieves pod names matching a label selector
func (*Client) GetWithJsonPath ¶
GetWithJsonPath retrieves a specific field from a resource If name is empty, retrieves from all resources of the given type
func (*Client) WaitForDeploymentReady ¶
WaitForDeploymentReady waits for a deployment to be created and ready
func (*Client) WaitForPipelineInvalid ¶
WaitForPipelineInvalid waits for a VectorPipeline to become invalid (for negative tests)
func (*Client) WaitForPipelineValid ¶
WaitForPipelineValid waits for a VectorPipeline to become valid
func (*Client) WaitForPodReady ¶
WaitForPodReady waits for a pod to become ready
func (*Client) WaitForServiceCount ¶
func (c *Client) WaitForServiceCount(labelSelector string, expectedCount int, timeout time.Duration)
WaitForServiceCount waits for a specific number of services matching filter
func (*Client) WaitForServiceExists ¶
WaitForServiceExists waits for a service to be created