Documentation ¶
Overview ¶
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Index ¶
- Constants
- Variables
- func CheckContainerRestart(ctx context.Context, clientset *kubernetes.Clientset, ...) error
- func CreateNamespaceFn(kubeconfigpath, namespace string) error
- func CreateResource(ctx context.Context, obj runtime.Object, clientset *kubernetes.Clientset) error
- func DeleteResource(ctx context.Context, obj runtime.Object, clientset *kubernetes.Clientset) error
- func ExecPod(ctx context.Context, clientset *kubernetes.Clientset, config *rest.Config, ...) ([]byte, error)
- func GetPodIP(kubeConfigFilePath, namespace, podName string) (string, error)
- func PrintPodLogs(ctx context.Context, clientset *kubernetes.Clientset, ...)
- func TypeString(resourceType ResourceType) string
- func WaitForPodReady(ctx context.Context, clientset *kubernetes.Clientset, ...) error
- type CreateAgnhostStatefulSet
- type CreateDenyAllNetworkPolicy
- type CreateKapingerDeployment
- func (c *CreateKapingerDeployment) GetKapingerClusterRole() *rbacv1.ClusterRole
- func (c *CreateKapingerDeployment) GetKapingerClusterRoleBinding() *rbacv1.ClusterRoleBinding
- func (c *CreateKapingerDeployment) GetKapingerDeployment() *appsv1.Deployment
- func (c *CreateKapingerDeployment) GetKapingerService() *v1.Service
- func (c *CreateKapingerDeployment) GetKapingerServiceAccount() *v1.ServiceAccount
- func (c *CreateKapingerDeployment) Prevalidate() error
- func (c *CreateKapingerDeployment) Run() error
- func (c *CreateKapingerDeployment) Stop() error
- type CreateNamespace
- type DeleteDenyAllNetworkPolicy
- type DeleteKubernetesResource
- type DeleteNamespace
- type EnsureStableComponent
- type ExecInPod
- type GetPodLogs
- type InstallHelmChart
- type PortForward
- type PortForwarder
- type PortForwardingOpts
- type ResourceType
- type UpgradeRetinaHelmChart
- type WaitPodsReady
Constants ¶
const ( RetryTimeoutPodsReady = 5 * time.Minute RetryIntervalPodsReady = 5 * time.Second )
const ( AgnhostHTTPPort = 80 AgnhostReplicas = 1 )
const ( KapingerHTTPPort = 8080 KapingerTCPPort = 8085 KapingerUDPPort = 8086 MaxAffinityWeight = 100 )
const ( Egress = "egress" Ingress = "ingress" )
const ExecSubResources = "exec"
Variables ¶
var ( ErrUnknownResourceType = fmt.Errorf("unknown resource type") ErrCreateNilResource = fmt.Errorf("cannot create nil resource") )
var ErrDeleteNilResource = fmt.Errorf("cannot create nil resource")
var ErrLabelMissingFromPod = fmt.Errorf("label missing from pod")
var (
ErrNoPodWithLabelFound = fmt.Errorf("no pod with label found with matching pod affinity")
)
var ErrPodCrashed = fmt.Errorf("pod has crashes")
Functions ¶
func CheckContainerRestart ¶ added in v0.0.17
func CreateNamespaceFn ¶ added in v0.0.18
func CreateResource ¶
func DeleteResource ¶
func PrintPodLogs ¶
func PrintPodLogs(ctx context.Context, clientset *kubernetes.Clientset, namespace, labelSelector string)
func TypeString ¶
func TypeString(resourceType ResourceType) string
Parameters can only be strings, heres to help add guardrails
func WaitForPodReady ¶
Types ¶
type CreateAgnhostStatefulSet ¶
type CreateAgnhostStatefulSet struct { AgnhostName string AgnhostNamespace string ScheduleOnSameNode bool KubeConfigFilePath string }
func (*CreateAgnhostStatefulSet) Prevalidate ¶
func (c *CreateAgnhostStatefulSet) Prevalidate() error
func (*CreateAgnhostStatefulSet) Run ¶
func (c *CreateAgnhostStatefulSet) Run() error
func (*CreateAgnhostStatefulSet) Stop ¶
func (c *CreateAgnhostStatefulSet) Stop() error
type CreateDenyAllNetworkPolicy ¶
type CreateDenyAllNetworkPolicy struct { NetworkPolicyNamespace string KubeConfigFilePath string DenyAllLabelSelector string }
func (*CreateDenyAllNetworkPolicy) Prevalidate ¶
func (c *CreateDenyAllNetworkPolicy) Prevalidate() error
func (*CreateDenyAllNetworkPolicy) Run ¶
func (c *CreateDenyAllNetworkPolicy) Run() error
func (*CreateDenyAllNetworkPolicy) Stop ¶
func (c *CreateDenyAllNetworkPolicy) Stop() error
type CreateKapingerDeployment ¶
type CreateKapingerDeployment struct { KapingerNamespace string KapingerReplicas string KubeConfigFilePath string }
func (*CreateKapingerDeployment) GetKapingerClusterRole ¶
func (c *CreateKapingerDeployment) GetKapingerClusterRole() *rbacv1.ClusterRole
func (*CreateKapingerDeployment) GetKapingerClusterRoleBinding ¶
func (c *CreateKapingerDeployment) GetKapingerClusterRoleBinding() *rbacv1.ClusterRoleBinding
func (*CreateKapingerDeployment) GetKapingerDeployment ¶
func (c *CreateKapingerDeployment) GetKapingerDeployment() *appsv1.Deployment
func (*CreateKapingerDeployment) GetKapingerService ¶
func (c *CreateKapingerDeployment) GetKapingerService() *v1.Service
func (*CreateKapingerDeployment) GetKapingerServiceAccount ¶
func (c *CreateKapingerDeployment) GetKapingerServiceAccount() *v1.ServiceAccount
func (*CreateKapingerDeployment) Prevalidate ¶
func (c *CreateKapingerDeployment) Prevalidate() error
func (*CreateKapingerDeployment) Run ¶
func (c *CreateKapingerDeployment) Run() error
func (*CreateKapingerDeployment) Stop ¶
func (c *CreateKapingerDeployment) Stop() error
type CreateNamespace ¶ added in v0.0.17
func (*CreateNamespace) Prevalidate ¶ added in v0.0.18
func (c *CreateNamespace) Prevalidate() error
func (*CreateNamespace) Run ¶ added in v0.0.18
func (c *CreateNamespace) Run() error
func (*CreateNamespace) Stop ¶ added in v0.0.18
func (c *CreateNamespace) Stop() error
type DeleteDenyAllNetworkPolicy ¶
type DeleteDenyAllNetworkPolicy struct { NetworkPolicyNamespace string KubeConfigFilePath string DenyAllLabelSelector string }
func (*DeleteDenyAllNetworkPolicy) Prevalidate ¶
func (d *DeleteDenyAllNetworkPolicy) Prevalidate() error
func (*DeleteDenyAllNetworkPolicy) Run ¶
func (d *DeleteDenyAllNetworkPolicy) Run() error
type DeleteKubernetesResource ¶
type DeleteKubernetesResource struct { ResourceType string // can't use enum, breaks parameter parsing, all must be strings ResourceName string ResourceNamespace string KubeConfigFilePath string }
func (*DeleteKubernetesResource) Prevalidate ¶
func (d *DeleteKubernetesResource) Prevalidate() error
func (*DeleteKubernetesResource) Run ¶
func (d *DeleteKubernetesResource) Run() error
func (*DeleteKubernetesResource) Stop ¶
func (d *DeleteKubernetesResource) Stop() error
type DeleteNamespace ¶ added in v0.0.18
func (*DeleteNamespace) Prevalidate ¶ added in v0.0.18
func (d *DeleteNamespace) Prevalidate() error
func (*DeleteNamespace) Run ¶ added in v0.0.18
func (d *DeleteNamespace) Run() error
func (*DeleteNamespace) Stop ¶ added in v0.0.18
func (d *DeleteNamespace) Stop() error
type EnsureStableComponent ¶ added in v0.0.17
type EnsureStableComponent struct { LabelSelector string PodNamespace string KubeConfigFilePath string // Container restarts can occur for various reason, they do not necessarily mean the entire cluster // is unstable or needs to be recreated. In some cases, container restarts are expected and acceptable. // This flag should be set to true only in those cases and provide additional why restart restarts are acceptable. IgnoreContainerRestart bool }
func (*EnsureStableComponent) Prevalidate ¶ added in v0.0.17
func (n *EnsureStableComponent) Prevalidate() error
func (*EnsureStableComponent) Run ¶ added in v0.0.17
func (n *EnsureStableComponent) Run() error
func (*EnsureStableComponent) Stop ¶ added in v0.0.17
func (n *EnsureStableComponent) Stop() error
type ExecInPod ¶
type ExecInPod struct { PodNamespace string KubeConfigFilePath string PodName string Command string }
func (*ExecInPod) Prevalidate ¶
type GetPodLogs ¶ added in v0.0.17
func (*GetPodLogs) Run ¶ added in v0.0.17
func (p *GetPodLogs) Run() error
type InstallHelmChart ¶
type InstallHelmChart struct { Namespace string ReleaseName string KubeConfigFilePath string ChartPath string TagEnv string }
func (*InstallHelmChart) Prevalidate ¶
func (i *InstallHelmChart) Prevalidate() error
func (*InstallHelmChart) Run ¶
func (i *InstallHelmChart) Run() error
func (*InstallHelmChart) Stop ¶
func (i *InstallHelmChart) Stop() error
type PortForward ¶
type PortForward struct { Namespace string LabelSelector string LocalPort string RemotePort string Endpoint string KubeConfigFilePath string OptionalLabelAffinity string // contains filtered or unexported fields }
func (*PortForward) Prevalidate ¶
func (p *PortForward) Prevalidate() error
func (*PortForward) Run ¶
func (p *PortForward) Run() error
func (*PortForward) Stop ¶
func (p *PortForward) Stop() error
type PortForwarder ¶
type PortForwarder struct {
// contains filtered or unexported fields
}
PortForwarder can manage a port forwarding session.
func NewPortForwarder ¶
func NewPortForwarder(restConfig *rest.Config, logger logger, opts PortForwardingOpts) (*PortForwarder, error)
NewPortForwarder creates a PortForwarder.
func (*PortForwarder) Address ¶
func (p *PortForwarder) Address() string
Address returns an address for communicating with a port-forwarded pod.
func (*PortForwarder) KeepAlive ¶
func (p *PortForwarder) KeepAlive(ctx context.Context)
KeepAlive can be used to restart the port forwarding session in the background.
func (*PortForwarder) Stop ¶
func (p *PortForwarder) Stop()
Stop terminates a port forwarding session.
type PortForwardingOpts ¶
type ResourceType ¶
type ResourceType string
const ( DaemonSet ResourceType = "DaemonSet" Deployment ResourceType = "Deployment" StatefulSet ResourceType = "StatefulSet" Service ResourceType = "Service" ServiceAccount ResourceType = "ServiceAccount" Role ResourceType = "Role" RoleBinding ResourceType = "RoleBinding" ClusterRole ResourceType = "ClusterRole" ClusterRoleBinding ResourceType = "ClusterRoleBinding" ConfigMap ResourceType = "ConfigMap" NetworkPolicy ResourceType = "NetworkPolicy" Secret ResourceType = "Secret" Unknown ResourceType = "Unknown" )
type UpgradeRetinaHelmChart ¶ added in v0.0.12
type UpgradeRetinaHelmChart struct { Namespace string ReleaseName string KubeConfigFilePath string ChartPath string TagEnv string ValuesFile string }
func (*UpgradeRetinaHelmChart) Prevalidate ¶ added in v0.0.12
func (u *UpgradeRetinaHelmChart) Prevalidate() error
func (*UpgradeRetinaHelmChart) Run ¶ added in v0.0.12
func (u *UpgradeRetinaHelmChart) Run() error
func (*UpgradeRetinaHelmChart) Stop ¶ added in v0.0.12
func (u *UpgradeRetinaHelmChart) Stop() error
type WaitPodsReady ¶ added in v0.0.18
func (*WaitPodsReady) Prevalidate ¶ added in v0.0.18
func (w *WaitPodsReady) Prevalidate() error
Useful when wanting to do parameter checking, for example if a parameter length is known to be required less than 80 characters, do this here so we don't find out later on when we run the step when possible, try to avoid making external calls, this should be fast and simple
func (*WaitPodsReady) Run ¶ added in v0.0.18
func (w *WaitPodsReady) Run() error
Primary step where test logic is executed Returning an error will cause the test to fail
func (*WaitPodsReady) Stop ¶ added in v0.0.18
func (w *WaitPodsReady) Stop() error
Require for background steps
Source Files ¶
- check-pod-status.go
- create-agnhost-statefulset.go
- create-kapinger-deployment.go
- create-namespace.go
- create-network-policy.go
- create-resource.go
- delete-namespace.go
- delete-resource.go
- exec-pod.go
- get-external-crd.go
- get-logs.go
- get-pod-ip.go
- install-retina-helm.go
- no-crashes.go
- port-forward.go
- portforward.go
- upgrade-retina-helm.go