Documentation ¶
Overview ¶
Package cluster cointains the base setup for the test environment. This is:
- Deployment manifests for a base cluster: Loki, permissions, flowlogs-processor and the local version of the agent. As well as the cluster configuration for ports exposure.
- Utility classes to programmatically manage the Kind cluster and some of its components (e.g. Loki)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeployID ¶
type DeployID string
DeployID is an optional identifier for a deployment. It is used to override/replace default base deployments with a different file (e.g. override the default flowlogs-pipeline with a different configuration).
type DeployOrder ¶
type DeployOrder int
DeployOrder specifies the order in which a Deployment must be executed, from lower to higher priority
const ( // AfterAgent DeployOrder would deploy related manifests after the NetObserv agent has been // deployed AfterAgent DeployOrder = iota // WithAgent DeployOrder would deploy related manifests with the NetObserv agent, after the // rest of NetObservServices have been deployed. WithAgent // NetObservServices DeployOrder would deploy related manifests after all the external services // have been deployed, and before deploying the Agent. NetObservServices // ExternalServices DeployOrder is aimed for external services (e.g. Loki, Kafka...), which will // be deployed before the rest of NetObservServices. ExternalServices // Preconditions DeployOrder is aimed to these Resources that define a given cluster status // before tests start (e.g. namespaces, permissions, etc...). Preconditions )
type Deployment ¶
type Deployment struct { // Order of the deployment. Deployments with the same order will be executed by alphabetical // order of its manifest file Order DeployOrder // ManifestFile path to the kubectl-like YAML manifest file ManifestFile string // ReadyFunction is an optional function that returns error if the deployment is not ready. // Used when it's needed to wait before starting tests or deploying later components. ReadyFunction func(*envconf.Config) error }
Deployment of components. Not only K8s deployments but also Pods, Services, DaemonSets, ...
type Kind ¶
type Kind struct {
// contains filtered or unexported fields
}
Kind cluster deployed by each TestMain function, prepared for a given test scenario.
func NewKind ¶
NewKind creates a kind cluster given a name and set of Option instances. The base dir must point to the folder where the logs are going to be stored and, in case your docker backend doesn't provide access to the local images, where the ebpf-agent.tar container image is located. Usually it will be the project root.
func (*Kind) TestEnv ¶
func (k *Kind) TestEnv() env.Environment
type Option ¶
type Option func(k *Kind)
Option that can be passed to the NewKind function in order to change the configuration of the test cluster
func Deploy ¶
func Deploy(def Deployment) Option
Deploy can be passed to NewKind to deploy extra components, in addition to the base deployment.
func Override ¶
func Override(id DeployID, def Deployment) Option
Override can be passed to NewKind to override some components of the base deployment (identified by the passed DeployID instance).