deployframework

package
v0.0.0-...-27fb5c3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServiceAccountToken

func GetServiceAccountToken(client kubernetes.Interface, initialDelay, timeoutPeriod time.Duration, namespace, serviceAccountName string) (string, error)

GetServiceAccountToken queries the namespace for the service account and attempts to find the secret that contains the serviceAccount token and return it.

Types

type DeployFramework

type DeployFramework struct {
	RunLocal          bool
	RunDevSetup       bool
	KubeConfigPath    string
	RepoDir           string
	OperatorResources *deploy.OperatorResources
	Logger            logrus.FieldLogger
	Config            *rest.Config
	Client            kubernetes.Interface
	APIExtClient      apiextclientv1beta1.CustomResourceDefinitionsGetter
	MeteringClient    meteringclient.MeteringV1Interface
	OLMV1Client       olmclientv1.OperatorsV1Interface
	OLMV1Alpha1Client olmclientv1alpha1.OperatorsV1alpha1Interface
}

DeployFramework contains all the information necessary to deploy different metering instances and run tests against them

func New

func New(logger logrus.FieldLogger, runLocal, runDevSetup bool, nsPrefix, repoDir, kubeconfig string) (*DeployFramework, error)

New is the constructor function that creates and returns a new DeployFramework object

func (*DeployFramework) NewDeployerConfig

func (df *DeployFramework) NewDeployerConfig(
	namespace,
	meteringOperatorImageRepo,
	meteringOperatorImageTag,
	reportingOperatorImageRepo,
	reportingOperatorImageTag string,
	spec metering.MeteringConfigSpec,
) (*deploy.Config, error)

NewDeployerConfig handles the process of validating inputs before returning an initialized Deploy.Config object, or an error if there is any.

func (*DeployFramework) NewDeployerCtx

func (df *DeployFramework) NewDeployerCtx(
	namespace,
	meteringOperatorImageRepo,
	meteringOperatorImageTag,
	reportingOperatorImageRepo,
	reportingOperatorImageTag,
	outputPath string,
	extraLocalEnvVars []string,
	spec metering.MeteringConfigSpec,
) (*DeployerCtx, error)

NewDeployerCtx constructs and returns a new DeployerCtx object

type DeployerCtx

type DeployerCtx struct {
	TargetPodsCount           int
	Namespace                 string
	KubeConfigPath            string
	TestCaseOutputPath        string
	HackScriptPath            string
	MeteringOperatorImageRepo string
	MeteringOperatorImageTag  string
	RunTestLocal              bool
	RunDevSetup               bool
	ExtraLocalEnvVars         []string
	LocalCtx                  *LocalCtx
	Deployer                  *deploy.Deployer
	Logger                    logrus.FieldLogger
	Config                    *rest.Config
	Client                    kubernetes.Interface
	APIExtClient              apiextclientv1beta1.CustomResourceDefinitionsGetter
	MeteringClient            meteringclient.MeteringV1Interface
	OLMV1Client               olmclientv1.OperatorsV1Interface
	OLMV1Alpha1Client         olmclientv1alpha1.OperatorsV1alpha1Interface
}

DeployerCtx contains all the information needed to manage the full lifecycle of a single metering deployment

func (*DeployerCtx) NewLocalCtx

func (ctx *DeployerCtx) NewLocalCtx() *LocalCtx

NewLocalCtx returns a new LocalCtx object

func (*DeployerCtx) Setup

func (ctx *DeployerCtx) Setup(expectInstallErr bool) (*reportingframework.ReportingFramework, error)

Setup handles the process of deploying metering, and waiting for all the necessary resources to become ready in order to proceeed with running the reporting tests. This returns an initialized reportingframework object, or an error if there is any.

func (*DeployerCtx) Teardown

func (ctx *DeployerCtx) Teardown() error

Teardown is a method that creates the resource and container logging directories, then populates those directories by executing the cleanup bash script, while streaming the script output to stdout. Once the cleanup script has finished execution, we can uninstall the metering stack and return an error if there is any.

type LocalCtx

type LocalCtx struct {
	Namespace                      string
	BasePath                       string
	KubeConfigPath                 string
	HackScriptPath                 string
	MeteringOperatorImage          string
	ReportingAPIURL                string
	RunReportingOperatorScriptPath string
	ExtraReportingOperatorEnvVars  []string
	CmdArr                         []exec.Cmd
	Logger                         logrus.FieldLogger
}

LocalCtx holds all the necessary information to run e2e tests locally

func (*LocalCtx) CleanupLocal

func (lc *LocalCtx) CleanupLocal() error

CleanupLocal removes all resources that were created while running e2e locally

func (*LocalCtx) RunMeteringOperatorLocal

func (lc *LocalCtx) RunMeteringOperatorLocal() error

RunMeteringOperatorLocal is a method that runs the metering-operator locally

func (*LocalCtx) RunReportingOperatorLocal

func (lc *LocalCtx) RunReportingOperatorLocal(apiListenPort, metricsListenPort, pprofListenPort int, token string) error

RunReportingOperatorLocal is a method that runs the reporting-operator locally

type PodWaiter

type PodWaiter struct {
	InitialDelay  time.Duration
	TimeoutPeriod time.Duration
	Logger        logrus.FieldLogger
	Client        kubernetes.Interface
}

func (*PodWaiter) WaitForPods

func (pw *PodWaiter) WaitForPods(namespace string, targetPodsCount int) error

WaitForPods periodically polls the list of pods in the namespace and ensures the metering pods created are considered ready. In order to exit the polling loop, the number of pods listed must match the expected number of targetPodsCount, and all pod containers listed must report a ready status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL