Documentation ¶
Index ¶
- func EnablePlugin(mode meta.PluginMode, schemeFunc func(context.Context) meta.Scheme)
- func FindTestBin() (string, error)
- func LoadPlugins(ctx context.Context, loader *plugins.PluginLoader, mode meta.PluginMode) int
- func NewApiExtensionTestPlugin(srv apiextensions.ManagementAPIExtensionServer, svcDesc *grpc.ServiceDesc, ...) *plugin.ClientConfig
- func RandomName(seed int64) string
- type EnvClientOption
- type EnvClientOptions
- type Environment
- func (e *Environment) Context() context.Context
- func (e *Environment) CortexTLSConfig() *tls.Config
- func (e *Environment) EtcdClient() (*clientv3.Client, error)
- func (e *Environment) EtcdConfig() *v1beta1.EtcdStorageSpec
- func (e *Environment) GatewayConfig() *v1beta1.GatewayConfig
- func (e *Environment) GatewayTLSConfig() *tls.Config
- func (e *Environment) GenerateNewTempDirectory(prefix string) string
- func (e *Environment) GetAgent(id string) RunningAgent
- func (e *Environment) GetAlertingManagementWebhookEndpoint() string
- func (e *Environment) GetPorts() ServicePorts
- func (e *Environment) GetTempDirectory() string
- func (e *Environment) JetStreamConfig() *v1beta1.JetStreamStorageSpec
- func (e *Environment) ManagementClientConn() grpc.ClientConnInterface
- func (e *Environment) NewAlertConditionsClient() alertingv1.AlertConditionsClient
- func (e *Environment) NewAlertEndpointsClient() alertingv1.AlertEndpointsClient
- func (e *Environment) NewAlertNotificationsClient() alertingv1.AlertNotificationsClient
- func (e *Environment) NewGatewayConfig() *v1beta1.GatewayConfig
- func (e *Environment) NewManagementClient(opts ...EnvClientOption) managementv1.ManagementClient
- func (e *Environment) PrometheusAPIEndpoint() string
- func (e *Environment) PutTestData(inputPath string, data []byte) string
- func (e *Environment) SetPrometheusNodeConfigOverride(agentId string, override *OverridePrometheusConfig)
- func (e *Environment) SimulateKubeObject(kPort int)
- func (e *Environment) Start(opts ...EnvironmentOption) error
- func (e *Environment) StartAgent(id string, token *corev1.BootstrapToken, pins []string, ...) (int, <-chan error)
- func (e *Environment) StartAgentDisconnectServer()
- func (e *Environment) StartCortex(ctx context.Context)
- func (e *Environment) StartEmbeddedAlertManager(ctx context.Context, configFilePath string, opniPort *int) (webPort int)
- func (e *Environment) StartEmbeddedJetstream() (*nats.Conn, error)
- func (e *Environment) StartGrafana(extraDockerArgs ...string)
- func (e *Environment) StartInstrumentationServer() (int, chan struct{})
- func (e *Environment) StartMockKubernetesMetricServer() (port int)
- func (e *Environment) StartNodeExporter()
- func (e *Environment) StartOTELCollectorContext(parentCtx waitctx.PermissiveContext, opniAgentId string, spec *otel.OTELSpec)
- func (e *Environment) StartPrometheus(opniAgentId string, override ...*OverridePrometheusConfig) int
- func (e *Environment) StartPrometheusContext(ctx waitctx.PermissiveContext, opniAgentId string, ...) int
- func (e *Environment) Stop() error
- func (e *Environment) WriteGrafanaConfig()
- type EnvironmentOption
- func WithDefaultAgentOpts(opts ...StartAgentOption) EnvironmentOption
- func WithEnableDisconnectServer(enable bool) EnvironmentOption
- func WithEnableEtcd(enable bool) EnvironmentOption
- func WithEnableGateway(enable bool) EnvironmentOption
- func WithEnableJetstream(enable bool) EnvironmentOption
- func WithEnableNodeExporter(enable bool) EnvironmentOption
- func WithStorageBackend(backend v1beta1.StorageType) EnvironmentOption
- type EnvironmentOptions
- type OverridePrometheusConfig
- type PrometheusJob
- type RunningAgent
- type ServicePorts
- type StartAgentOption
- type StartAgentOptions
- type TestAggregatorConfig
- type TestNodeConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnablePlugin ¶ added in v0.9.2
Adds the calling plugin to the list of plugins that will be loaded in the test environment. The plugin metadata is inferred from the caller's package. This will apply to all test environments in a suite.
Must be called from init() in a package of the form github.com/rancher/opni/plugins/<name>/test
func FindTestBin ¶ added in v0.9.2
func LoadPlugins ¶ added in v0.4.1
func LoadPlugins(ctx context.Context, loader *plugins.PluginLoader, mode meta.PluginMode) int
func NewApiExtensionTestPlugin ¶ added in v0.4.1
func NewApiExtensionTestPlugin( srv apiextensions.ManagementAPIExtensionServer, svcDesc *grpc.ServiceDesc, impl interface{}, ) *plugin.ClientConfig
func RandomName ¶ added in v0.6.0
Types ¶
type EnvClientOption ¶ added in v0.9.2
type EnvClientOption func(o *EnvClientOptions)
func WithClientCaching ¶ added in v0.9.2
func WithClientCaching(memoryLimitBytes int64, _ time.Duration) EnvClientOption
type EnvClientOptions ¶ added in v0.9.2
type EnvClientOptions struct {
// contains filtered or unexported fields
}
type Environment ¶ added in v0.4.1
type Environment struct { EnvironmentOptions TestBin string Logger *zap.SugaredLogger CRDDirectoryPaths []string // contains filtered or unexported fields }
func EnvFromContext ¶ added in v0.9.2
func EnvFromContext(ctx context.Context) *Environment
func (*Environment) Context ¶ added in v0.6.0
func (e *Environment) Context() context.Context
func (*Environment) CortexTLSConfig ¶ added in v0.6.0
func (e *Environment) CortexTLSConfig() *tls.Config
func (*Environment) EtcdClient ¶ added in v0.4.1
func (e *Environment) EtcdClient() (*clientv3.Client, error)
func (*Environment) EtcdConfig ¶ added in v0.4.1
func (e *Environment) EtcdConfig() *v1beta1.EtcdStorageSpec
func (*Environment) GatewayConfig ¶ added in v0.4.1
func (e *Environment) GatewayConfig() *v1beta1.GatewayConfig
func (*Environment) GatewayTLSConfig ¶ added in v0.4.1
func (e *Environment) GatewayTLSConfig() *tls.Config
func (*Environment) GenerateNewTempDirectory ¶ added in v0.8.0
func (e *Environment) GenerateNewTempDirectory(prefix string) string
func (*Environment) GetAgent ¶ added in v0.4.1
func (e *Environment) GetAgent(id string) RunningAgent
func (*Environment) GetAlertingManagementWebhookEndpoint ¶ added in v0.6.0
func (e *Environment) GetAlertingManagementWebhookEndpoint() string
func (*Environment) GetPorts ¶ added in v0.9.2
func (e *Environment) GetPorts() ServicePorts
func (*Environment) GetTempDirectory ¶ added in v0.9.1
func (e *Environment) GetTempDirectory() string
func (*Environment) JetStreamConfig ¶ added in v0.6.2
func (e *Environment) JetStreamConfig() *v1beta1.JetStreamStorageSpec
func (*Environment) ManagementClientConn ¶ added in v0.5.4
func (e *Environment) ManagementClientConn() grpc.ClientConnInterface
func (*Environment) NewAlertConditionsClient ¶ added in v0.8.2
func (e *Environment) NewAlertConditionsClient() alertingv1.AlertConditionsClient
func (*Environment) NewAlertEndpointsClient ¶ added in v0.8.2
func (e *Environment) NewAlertEndpointsClient() alertingv1.AlertEndpointsClient
func (*Environment) NewAlertNotificationsClient ¶ added in v0.8.3
func (e *Environment) NewAlertNotificationsClient() alertingv1.AlertNotificationsClient
func (*Environment) NewGatewayConfig ¶ added in v0.8.0
func (e *Environment) NewGatewayConfig() *v1beta1.GatewayConfig
func (*Environment) NewManagementClient ¶ added in v0.4.1
func (e *Environment) NewManagementClient(opts ...EnvClientOption) managementv1.ManagementClient
func (*Environment) PrometheusAPIEndpoint ¶ added in v0.4.1
func (e *Environment) PrometheusAPIEndpoint() string
func (*Environment) PutTestData ¶ added in v0.8.0
func (e *Environment) PutTestData(inputPath string, data []byte) string
func (*Environment) SetPrometheusNodeConfigOverride ¶ added in v0.9.2
func (e *Environment) SetPrometheusNodeConfigOverride(agentId string, override *OverridePrometheusConfig)
func (*Environment) SimulateKubeObject ¶ added in v0.9.2
func (e *Environment) SimulateKubeObject(kPort int)
func (*Environment) Start ¶ added in v0.4.1
func (e *Environment) Start(opts ...EnvironmentOption) error
func (*Environment) StartAgent ¶ added in v0.4.1
func (e *Environment) StartAgent(id string, token *corev1.BootstrapToken, pins []string, opts ...StartAgentOption) (int, <-chan error)
func (*Environment) StartAgentDisconnectServer ¶ added in v0.6.1
func (e *Environment) StartAgentDisconnectServer()
func (*Environment) StartCortex ¶ added in v0.6.0
func (e *Environment) StartCortex(ctx context.Context)
func (*Environment) StartEmbeddedAlertManager ¶ added in v0.8.2
func (*Environment) StartEmbeddedJetstream ¶ added in v0.8.2
func (e *Environment) StartEmbeddedJetstream() (*nats.Conn, error)
func (*Environment) StartGrafana ¶ added in v0.9.1
func (e *Environment) StartGrafana(extraDockerArgs ...string)
func (*Environment) StartInstrumentationServer ¶ added in v0.5.4
func (e *Environment) StartInstrumentationServer() (int, chan struct{})
Starts a server that exposes Prometheus metrics
Returns port number of the server & a channel that shutdowns the server
func (*Environment) StartMockKubernetesMetricServer ¶ added in v0.6.0
func (e *Environment) StartMockKubernetesMetricServer() (port int)
func (*Environment) StartNodeExporter ¶ added in v0.6.1
func (e *Environment) StartNodeExporter()
func (*Environment) StartOTELCollectorContext ¶ added in v0.9.2
func (e *Environment) StartOTELCollectorContext(parentCtx waitctx.PermissiveContext, opniAgentId string, spec *otel.OTELSpec)
func (*Environment) StartPrometheus ¶ added in v0.4.1
func (e *Environment) StartPrometheus(opniAgentId string, override ...*OverridePrometheusConfig) int
func (*Environment) StartPrometheusContext ¶ added in v0.9.2
func (e *Environment) StartPrometheusContext(ctx waitctx.PermissiveContext, opniAgentId string, override ...*OverridePrometheusConfig) int
`prometheus/config.yaml` is the default monitoring config. `slo/prometheus/config.yaml` is the default SLO config.
func (*Environment) Stop ¶ added in v0.4.1
func (e *Environment) Stop() error
func (*Environment) WriteGrafanaConfig ¶ added in v0.9.1
func (e *Environment) WriteGrafanaConfig()
type EnvironmentOption ¶ added in v0.4.1
type EnvironmentOption func(*EnvironmentOptions)
func WithDefaultAgentOpts ¶ added in v0.5.4
func WithDefaultAgentOpts(opts ...StartAgentOption) EnvironmentOption
func WithEnableDisconnectServer ¶ added in v0.6.1
func WithEnableDisconnectServer(enable bool) EnvironmentOption
func WithEnableEtcd ¶ added in v0.4.1
func WithEnableEtcd(enable bool) EnvironmentOption
func WithEnableGateway ¶ added in v0.4.1
func WithEnableGateway(enable bool) EnvironmentOption
func WithEnableJetstream ¶ added in v0.6.0
func WithEnableJetstream(enable bool) EnvironmentOption
func WithEnableNodeExporter ¶ added in v0.6.1
func WithEnableNodeExporter(enable bool) EnvironmentOption
func WithStorageBackend ¶ added in v0.6.2
func WithStorageBackend(backend v1beta1.StorageType) EnvironmentOption
type EnvironmentOptions ¶ added in v0.4.1
type EnvironmentOptions struct {
// contains filtered or unexported fields
}
type OverridePrometheusConfig ¶ added in v0.9.2
type OverridePrometheusConfig struct {
// contains filtered or unexported fields
}
func NewOverridePrometheusConfig ¶ added in v0.5.4
func NewOverridePrometheusConfig(configPath string, jobs []PrometheusJob) *OverridePrometheusConfig
type PrometheusJob ¶ added in v0.5.4
type RunningAgent ¶ added in v0.4.1
type RunningAgent struct { Agent agent.AgentInterface *sync.Mutex }
type ServicePorts ¶ added in v0.9.2
type ServicePorts struct { Etcd int `env:"ETCD_PORT"` Jetstream int `env:"JETSTREAM_PORT"` GatewayGRPC int `env:"OPNI_GATEWAY_GRPC_PORT"` GatewayHTTP int `env:"OPNI_GATEWAY_HTTP_PORT"` GatewayMetrics int `env:"OPNI_GATEWAY_METRICS_PORT"` ManagementGRPC int `env:"OPNI_MANAGEMENT_GRPC_PORT"` ManagementHTTP int `env:"OPNI_MANAGEMENT_HTTP_PORT"` ManagementWeb int `env:"OPNI_MANAGEMENT_WEB_PORT"` CortexGRPC int `env:"CORTEX_GRPC_PORT"` CortexHTTP int `env:"CORTEX_HTTP_PORT"` TestEnvironment int `env:"TEST_ENV_API_PORT"` DisconnectPort int `env:"AGENT_DISCONNECT_PORT"` NodeExporterPort int `env:"NODE_EXPORTER_PORT"` }
type StartAgentOption ¶ added in v0.4.1
type StartAgentOption func(*StartAgentOptions)
func WithAgentVersion ¶ added in v0.6.0
func WithAgentVersion(version string) StartAgentOption
func WithContext ¶ added in v0.4.1
func WithContext(ctx context.Context) StartAgentOption
func WithListenPort ¶ added in v0.9.2
func WithListenPort(port int) StartAgentOption
func WithLocalAgent ¶ added in v0.9.0
func WithLocalAgent() StartAgentOption
func WithRemoteGatewayAddress ¶ added in v0.5.4
func WithRemoteGatewayAddress(addr string) StartAgentOption
type StartAgentOptions ¶ added in v0.4.1
type StartAgentOptions struct {
// contains filtered or unexported fields
}
type TestAggregatorConfig ¶ added in v0.9.2
type TestAggregatorConfig struct { AggregatorAddress string AgentEndpoint string LogsEnabled bool Metrics otel.MetricsConfig Containerized bool }
func (TestAggregatorConfig) MetricReceivers ¶ added in v0.9.2
func (t TestAggregatorConfig) MetricReceivers() []string
type TestNodeConfig ¶ added in v0.9.2
type TestNodeConfig struct { AggregatorAddress string ReceiverFile string Instance string Logs otel.LoggingConfig Metrics otel.MetricsConfig Containerized bool }
func (TestNodeConfig) MetricReceivers ¶ added in v0.9.2
func (t TestNodeConfig) MetricReceivers() []string
Directories ¶
Path | Synopsis |
---|---|
mock
|
|
apiextensions
Package mock_apiextensions is a generated GoMock package.
|
Package mock_apiextensions is a generated GoMock package. |
capability
Package mock_v1 is a generated GoMock package.
|
Package mock_v1 is a generated GoMock package. |
ext
Package mock_ext is a generated GoMock package.
|
Package mock_ext is a generated GoMock package. |
grpc
Package mock_grpc is a generated GoMock package.
|
Package mock_grpc is a generated GoMock package. |
ident
Package mock_ident is a generated GoMock package.
|
Package mock_ident is a generated GoMock package. |
notifier
Package mock_notifier is a generated GoMock package.
|
Package mock_notifier is a generated GoMock package. |
rbac
Package mock_rbac is a generated GoMock package.
|
Package mock_rbac is a generated GoMock package. |
rules
Package mock_rules is a generated GoMock package.
|
Package mock_rules is a generated GoMock package. |
storage
Package mock_storage is a generated GoMock package.
|
Package mock_storage is a generated GoMock package. |
streams
Package mock_streams is a generated GoMock package.
|
Package mock_streams is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.