Documentation
¶
Overview ¶
Package driver enables interaction with experiment resources. It provides drivers for local and Kubernetes experiments.
Index ¶
- Constants
- func ResultFromBytes(b []byte) (*base.ExperimentResult, error)
- func SpecFromBytes(b []byte) (base.ExperimentSpec, error)
- func UpdateChartDependencies(chartDir string, settings *cli.EnvSettings) error
- type FileDriver
- type KubeDriver
- func (driver *KubeDriver) Delete() error
- func (driver *KubeDriver) GetExperimentLogs() (string, error)
- func (driver *KubeDriver) Init() error
- func (driver *KubeDriver) Install(chartDir string, valueOpts values.Options, group string, dry bool) error
- func (driver *KubeDriver) ReadResult() (*base.ExperimentResult, error)
- func (driver *KubeDriver) ReadSpec() (base.ExperimentSpec, error)
- func (driver *KubeDriver) Upgrade(chartDir string, valueOpts values.Options, group string, dry bool) error
- func (driver *KubeDriver) WriteResult(r *base.ExperimentResult) error
- type PayloadValue
Constants ¶
const (
// ExperimentSpecPath is the name of the experiment spec file
ExperimentSpecPath = "experiment.yaml"
// ExperimentSpecPath is the name of the experiment result file
ExperimentResultPath = "result.yaml"
// ExperimentSpecPath is the name of the official Iter8 experiment chart repo
DefaultIter8RepoURL = "https://iter8-tools.github.io/hub"
// ExperimentSpecPath is the name of the default experiment chart
DefaultExperimentGroup = "default"
)
Variables ¶
This section is empty.
Functions ¶
func ResultFromBytes ¶
func ResultFromBytes(b []byte) (*base.ExperimentResult, error)
ResultFromBytes reads experiment result from bytes
func SpecFromBytes ¶
func SpecFromBytes(b []byte) (base.ExperimentSpec, error)
SpecFromBytes reads experiment spec from bytes
func UpdateChartDependencies ¶ added in v0.10.0
func UpdateChartDependencies(chartDir string, settings *cli.EnvSettings) error
UpdateChartDependencies for an Iter8 experiment chart for now this function has one purpose ... bring iter8lib dependency into other experiment charts like load-test-http
Types ¶
type FileDriver ¶
type FileDriver struct {
// RunDir is the directory where the experiment.yaml file is to be found
RunDir string
}
FileDriver enables reading and writing experiment spec and result files
func (*FileDriver) ReadResult ¶
func (f *FileDriver) ReadResult() (*base.ExperimentResult, error)
ReadResult reads experiment result from file
func (*FileDriver) ReadSpec ¶
func (f *FileDriver) ReadSpec() (base.ExperimentSpec, error)
ReadSpec reads experiment spec from file
func (*FileDriver) WriteResult ¶
func (f *FileDriver) WriteResult(res *base.ExperimentResult) error
WriteResult writes experiment result to file
type KubeDriver ¶
type KubeDriver struct {
// EnvSettings provides generic Kubernetes and Helm options
*cli.EnvSettings
// Clientset enables interaction with a Kubernetes cluster
Clientset kubernetes.Interface
// Configuration enables Helm-based interaction with a Kubernetes cluster
*action.Configuration
// Group is the experiment group
Group string
// Revision is the revision of the experiment
Revision int
}
KubeDriver embeds Helm and Kube configuration, and enables interaction with a Kubernetes cluster through Kube APIs and Helm APIs
func NewFakeKubeDriver ¶
func NewFakeKubeDriver(s *cli.EnvSettings, objects ...runtime.Object) *KubeDriver
NewFakeKubeDriver creates and returns a new KubeDriver with fake clients
func NewKubeDriver ¶
func NewKubeDriver(s *cli.EnvSettings) *KubeDriver
NewKubeDriver creates and returns a new KubeDriver
func (*KubeDriver) Delete ¶ added in v0.10.0
func (driver *KubeDriver) Delete() error
Delete a Kubernetes experiment group
func (*KubeDriver) GetExperimentLogs ¶
func (driver *KubeDriver) GetExperimentLogs() (string, error)
GetExperimentLogs gets logs for a Kubernetes experiment
func (*KubeDriver) Install ¶
func (driver *KubeDriver) Install(chartDir string, valueOpts values.Options, group string, dry bool) error
Install a Kubernetes experiment Credit: the logic for this function is sourced from Helm https://github.com/helm/helm/blob/8ab18f7567cedffdfa5ba4d7f6abfb58efc313f8/cmd/helm/install.go#L177
func (*KubeDriver) ReadResult ¶
func (driver *KubeDriver) ReadResult() (*base.ExperimentResult, error)
ReadResult creates an ExperimentResult struct for a Kubernetes experiment
func (*KubeDriver) ReadSpec ¶
func (driver *KubeDriver) ReadSpec() (base.ExperimentSpec, error)
ReadSpec creates an ExperimentSpec struct for a Kubernetes experiment
func (*KubeDriver) Upgrade ¶
func (driver *KubeDriver) Upgrade(chartDir string, valueOpts values.Options, group string, dry bool) error
Credit: the logic for this function is sourced from Helm https://github.com/helm/helm/blob/8ab18f7567cedffdfa5ba4d7f6abfb58efc313f8/cmd/helm/upgrade.go#L69 Upgrade a Kubernetes experiment to the next release
func (*KubeDriver) WriteResult ¶
func (driver *KubeDriver) WriteResult(r *base.ExperimentResult) error
WriteResult writes results for a Kubernetes experiment
type PayloadValue ¶
type PayloadValue struct {
// Op indicates the type of patch
Op string `json:"op"`
// Path is the JSON field path
Path string `json:"path"`
// Value is the value of the field
Value string `json:"value"`
}
PayloadValue is used to patch Kubernetes resources