Documentation ¶
Index ¶
- Constants
- Variables
- type AsyncRunner
- type ClusterLink
- func (c *ClusterLink) AccessService(clientFn func(*KindCluster, *Service) (string, error), service *Service, ...) (string, error)
- func (c *ClusterLink) Client() *client.Client
- func (c *ClusterLink) Cluster() *KindCluster
- func (c *ClusterLink) CreateExport(service *Service) error
- func (c *ClusterLink) CreateImport(service *Service, peer *ClusterLink, exportName string) error
- func (c *ClusterLink) CreatePeer(peer *ClusterLink) error
- func (c *ClusterLink) CreatePolicy(policy *v1alpha1.AccessPolicy) error
- func (c *ClusterLink) CreateService(service *Service) error
- func (c *ClusterLink) DeleteExport(name string) error
- func (c *ClusterLink) DeleteImport(name string) error
- func (c *ClusterLink) DeletePeer(peer *ClusterLink) error
- func (c *ClusterLink) DeletePolicy(name string) error
- func (c *ClusterLink) DeleteService(name string) error
- func (c *ClusterLink) GetAllExports() (*[]v1alpha1.Export, error)
- func (c *ClusterLink) GetAllImports() (*[]v1alpha1.Import, error)
- func (c *ClusterLink) GetAllPeers() (*[]v1alpha1.Peer, error)
- func (c *ClusterLink) GetAllPolicies() (*[]v1alpha1.AccessPolicy, error)
- func (c *ClusterLink) GetExport(name string) (*v1alpha1.Export, error)
- func (c *ClusterLink) GetImport(name string) (*v1alpha1.Import, error)
- func (c *ClusterLink) GetPeer(peer *ClusterLink) (*v1alpha1.Peer, error)
- func (c *ClusterLink) GetPolicy(name string) (*v1alpha1.AccessPolicy, error)
- func (c *ClusterLink) IP() string
- func (c *ClusterLink) Name() string
- func (c *ClusterLink) Namespace() string
- func (c *ClusterLink) Port() uint16
- func (c *ClusterLink) RestartControlplane() error
- func (c *ClusterLink) RestartDataplane() error
- func (c *ClusterLink) ScaleControlplane(replicas int32) error
- func (c *ClusterLink) ScaleDataplane(replicas int32) error
- func (c *ClusterLink) UpdateExport(name string, service *Service) error
- func (c *ClusterLink) UpdateImport(service *Service, peer *ClusterLink, exportName string) error
- func (c *ClusterLink) UpdatePeer(peer *ClusterLink) error
- func (c *ClusterLink) UpdatePolicy(policy *v1alpha1.AccessPolicy) error
- func (c *ClusterLink) WaitForControlplaneAPI() error
- func (c *ClusterLink) WaitForExportCondition(export *v1alpha1.Export, conditionType string, expectedConditionStatus bool) error
- func (c *ClusterLink) WaitForImportCondition(imp *v1alpha1.Import, conditionType string, expectedConditionStatus bool) error
- func (c *ClusterLink) WaitForPeerCondition(peer *v1alpha1.Peer, conditionType string, expectedConditionStatus bool) error
- type Fabric
- func (f *Fabric) CreatePeer(cluster *KindCluster)
- func (f *Fabric) DeployClusterlinks(peerCount uint8, cfg *PeerConfig) ([]*ClusterLink, error)
- func (f *Fabric) Namespace() string
- func (f *Fabric) PeerKindCluster(num int) *KindCluster
- func (f *Fabric) SwitchToNewNamespace(name string, appendName bool) error
- type KindCluster
- func (c *KindCluster) CreateFromPath(folder string) error
- func (c *KindCluster) CreateFromYAML(yaml, namespace string) error
- func (c *KindCluster) CreateNamespace(name string) error
- func (c *KindCluster) CreatePodAndService(podAndService *PodAndService) error
- func (c *KindCluster) DeleteNamespace(name string) error
- func (c *KindCluster) Destroy() error
- func (c *KindCluster) ExportLogs() error
- func (c *KindCluster) ExposeNodeport(service *Service) (uint16, error)
- func (c *KindCluster) IP() string
- func (c *KindCluster) LoadImage(name string)
- func (c *KindCluster) Name() string
- func (c *KindCluster) Resources() *resources.Resources
- func (c *KindCluster) RunPod(podSpec *Pod) (string, error)
- func (c *KindCluster) ScaleDeployment(name, namespace string, replicas int32) error
- func (c *KindCluster) Start()
- func (c *KindCluster) WaitFor(obj k8s.Object, statusConditions *[]metav1.Condition, conditionType string, ...) error
- func (c *KindCluster) WaitForDeletion(obj k8s.Object) error
- type PeerConfig
- type Pod
- type PodAndService
- type Service
- type StatusObject
Constants ¶
const (
// ExportedLogsPath is the path where test logs will be exported.
ExportedLogsPath = "/tmp/clusterlink-k8s-tests"
)
Variables ¶
var PolicyAllowAll = &v1alpha1.AccessPolicy{ ObjectMeta: metav1.ObjectMeta{ Name: "allow-all", }, Spec: v1alpha1.AccessPolicySpec{ Action: v1alpha1.AccessPolicyActionAllow, From: v1alpha1.WorkloadSetOrSelectorList{{ WorkloadSelector: &metav1.LabelSelector{}, }}, To: v1alpha1.WorkloadSetOrSelectorList{{ WorkloadSelector: &metav1.LabelSelector{}, }}, }, }
Functions ¶
This section is empty.
Types ¶
type AsyncRunner ¶
type AsyncRunner struct {
// contains filtered or unexported fields
}
AsyncRunner allows asynchronous running of functions with error tracking.
func (*AsyncRunner) Error ¶
func (r *AsyncRunner) Error() error
Error returns the (combined) errors collected.
func (*AsyncRunner) Run ¶
func (r *AsyncRunner) Run(f func() error)
Error returns the (combined) errors collected.
func (*AsyncRunner) SetError ¶
func (r *AsyncRunner) SetError(err error)
SetError collects a new error.
type ClusterLink ¶
type ClusterLink struct {
// contains filtered or unexported fields
}
ClusterLink represents a clusterlink instance.
func (*ClusterLink) AccessService ¶
func (c *ClusterLink) AccessService( clientFn func(*KindCluster, *Service) (string, error), service *Service, allowRetry bool, expectedError error, ) (string, error)
Access a cluster service.
func (*ClusterLink) Client ¶
func (c *ClusterLink) Client() *client.Client
Client returns a controlplane API client for this cluster.
func (*ClusterLink) Cluster ¶
func (c *ClusterLink) Cluster() *KindCluster
Cluster returns the backing kind cluster.
func (*ClusterLink) CreateExport ¶
func (c *ClusterLink) CreateExport(service *Service) error
func (*ClusterLink) CreateImport ¶
func (c *ClusterLink) CreateImport(service *Service, peer *ClusterLink, exportName string) error
func (*ClusterLink) CreatePeer ¶
func (c *ClusterLink) CreatePeer(peer *ClusterLink) error
func (*ClusterLink) CreatePolicy ¶
func (c *ClusterLink) CreatePolicy(policy *v1alpha1.AccessPolicy) error
func (*ClusterLink) CreateService ¶
func (c *ClusterLink) CreateService(service *Service) error
func (*ClusterLink) DeleteExport ¶
func (c *ClusterLink) DeleteExport(name string) error
func (*ClusterLink) DeleteImport ¶
func (c *ClusterLink) DeleteImport(name string) error
func (*ClusterLink) DeletePeer ¶
func (c *ClusterLink) DeletePeer(peer *ClusterLink) error
func (*ClusterLink) DeletePolicy ¶
func (c *ClusterLink) DeletePolicy(name string) error
func (*ClusterLink) DeleteService ¶ added in v0.1.0
func (c *ClusterLink) DeleteService(name string) error
func (*ClusterLink) GetAllExports ¶
func (c *ClusterLink) GetAllExports() (*[]v1alpha1.Export, error)
func (*ClusterLink) GetAllImports ¶
func (c *ClusterLink) GetAllImports() (*[]v1alpha1.Import, error)
func (*ClusterLink) GetAllPeers ¶
func (c *ClusterLink) GetAllPeers() (*[]v1alpha1.Peer, error)
func (*ClusterLink) GetAllPolicies ¶
func (c *ClusterLink) GetAllPolicies() (*[]v1alpha1.AccessPolicy, error)
func (*ClusterLink) GetExport ¶
func (c *ClusterLink) GetExport(name string) (*v1alpha1.Export, error)
func (*ClusterLink) GetImport ¶
func (c *ClusterLink) GetImport(name string) (*v1alpha1.Import, error)
func (*ClusterLink) GetPeer ¶
func (c *ClusterLink) GetPeer(peer *ClusterLink) (*v1alpha1.Peer, error)
func (*ClusterLink) GetPolicy ¶
func (c *ClusterLink) GetPolicy(name string) (*v1alpha1.AccessPolicy, error)
func (*ClusterLink) Namespace ¶
func (c *ClusterLink) Namespace() string
Namespace returns the clusterlink kubernetes namespace.
func (*ClusterLink) RestartControlplane ¶
func (c *ClusterLink) RestartControlplane() error
RestartControlplane restarts the controlplane.
func (*ClusterLink) RestartDataplane ¶
func (c *ClusterLink) RestartDataplane() error
RestartDataplane restarts the dataplane.
func (*ClusterLink) ScaleControlplane ¶
func (c *ClusterLink) ScaleControlplane(replicas int32) error
ScaleControlplane scales the controlplane deployment.
func (*ClusterLink) ScaleDataplane ¶
func (c *ClusterLink) ScaleDataplane(replicas int32) error
ScaleDataplane scales the dataplane deployment.
func (*ClusterLink) UpdateExport ¶
func (c *ClusterLink) UpdateExport(name string, service *Service) error
func (*ClusterLink) UpdateImport ¶
func (c *ClusterLink) UpdateImport(service *Service, peer *ClusterLink, exportName string) error
func (*ClusterLink) UpdatePeer ¶
func (c *ClusterLink) UpdatePeer(peer *ClusterLink) error
func (*ClusterLink) UpdatePolicy ¶
func (c *ClusterLink) UpdatePolicy(policy *v1alpha1.AccessPolicy) error
func (*ClusterLink) WaitForControlplaneAPI ¶
func (c *ClusterLink) WaitForControlplaneAPI() error
WaitForControlplaneAPI waits until the controlplane API server is up.
func (*ClusterLink) WaitForExportCondition ¶ added in v0.1.0
func (*ClusterLink) WaitForImportCondition ¶ added in v0.1.0
func (*ClusterLink) WaitForPeerCondition ¶ added in v0.1.0
type Fabric ¶
type Fabric struct { AsyncRunner // contains filtered or unexported fields }
Fabric represents a collection of clusterlinks.
func (*Fabric) CreatePeer ¶
func (f *Fabric) CreatePeer(cluster *KindCluster)
CreatePeer creates certificates for a new peer on a given kind cluster.
func (*Fabric) DeployClusterlinks ¶
func (f *Fabric) DeployClusterlinks(peerCount uint8, cfg *PeerConfig) ([]*ClusterLink, error)
DeployClusterlinks deploys clusterlink to <peerCount> clusters.
func (*Fabric) PeerKindCluster ¶
func (f *Fabric) PeerKindCluster(num int) *KindCluster
PeerKindCluster returns the peer kind cluster.
type KindCluster ¶
type KindCluster struct { AsyncRunner // contains filtered or unexported fields }
KindCluster represents a kind kubernetes cluster.
func NewKindCluster ¶
func NewKindCluster(name string) *KindCluster
NewKindCluster returns a new yet to be running kind cluster.
func (*KindCluster) CreateFromPath ¶
func (c *KindCluster) CreateFromPath(folder string) error
CreateFromPath creates k8s objects from a yaml in a folder.
func (*KindCluster) CreateFromYAML ¶
func (c *KindCluster) CreateFromYAML(yaml, namespace string) error
CreateFromYAML creates k8s objects from a yaml string, in a given namespace.
func (*KindCluster) CreateNamespace ¶
func (c *KindCluster) CreateNamespace(name string) error
CreateNamespace creates a namespace.
func (*KindCluster) CreatePodAndService ¶
func (c *KindCluster) CreatePodAndService(podAndService *PodAndService) error
CreatePodAndService creates a pod exposed by a service.
func (*KindCluster) DeleteNamespace ¶
func (c *KindCluster) DeleteNamespace(name string) error
DeleteNamespace deletes a namespace.
func (*KindCluster) ExportLogs ¶
func (c *KindCluster) ExportLogs() error
ExportLogs exports cluster logs to files.
func (*KindCluster) ExposeNodeport ¶
func (c *KindCluster) ExposeNodeport(service *Service) (uint16, error)
ExposeNodeport returns a nodeport (uint16) for accessing a given k8s service. The returned nodeport service is cached across subsequent calls.
func (*KindCluster) LoadImage ¶
func (c *KindCluster) LoadImage(name string)
LoadImage loads a docker image to the cluster. Assumes Start was already called.
func (*KindCluster) Resources ¶
func (c *KindCluster) Resources() *resources.Resources
Resources returns the cluster resources.
func (*KindCluster) RunPod ¶
func (c *KindCluster) RunPod(podSpec *Pod) (string, error)
RunPod runs a pod, wait for its completion, and return its standard output.
func (*KindCluster) ScaleDeployment ¶
func (c *KindCluster) ScaleDeployment(name, namespace string, replicas int32) error
ScaleDeployment updates the number of deployment replicas, and waits for this update to complete.
func (*KindCluster) Start ¶
func (c *KindCluster) Start()
Start the kind cluster. Should be called only once.
func (*KindCluster) WaitFor ¶ added in v0.1.0
func (c *KindCluster) WaitFor( obj k8s.Object, statusConditions *[]metav1.Condition, conditionType string, expectedConditionStatus bool, ) error
WaitFor waits for a condition to be set on an object.
func (*KindCluster) WaitForDeletion ¶ added in v0.1.0
func (c *KindCluster) WaitForDeletion(obj k8s.Object) error
WaitFor waits for a condition to be set on an object.
type PeerConfig ¶
type PeerConfig struct { // CRUDMode indicates a CRUD-based controlplane (i.e. not CRD mode). CRUDMode bool // DataplaneType is the dataplane type (envoy / go). DataplaneType string // Dataplanes is the number of dataplane instances. Dataplanes uint16 // ControlplanePersistency should be true if controlplane should use persistent storage. ControlplanePersistency bool // ExpectLargeDataplaneTraffic hints that a large amount of dataplane traffic is expected. ExpectLargeDataplaneTraffic bool // DeployWithOperator deploys clusterlink using an operator. DeployWithOperator bool }
PeerConfig is a peer configuration.
type Pod ¶
type Pod struct { // Name is the pod name. Name string // Namespace is the pod namespace. Namespace string // Image is the container image. Image string // Args are the container command line arguments. Args []string }
Pod represents a kubernetes pod.
type PodAndService ¶
type PodAndService struct { Service // Image is the container image. Image string // Args are the container command line arguments. Args []string }
PodAndService represents a kubernetes service and a backing pod.