podiochaosmanager

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPodNotFound means operate pod may be deleted(almostly)
	ErrPodNotFound = errors.New("pod not found")

	// ErrPodNotRunning means operate pod may be not working
	// and it's non-sense to make changes on it.
	ErrPodNotRunning = errors.New("pod not running")
)

Functions

This section is empty.

Types

type Append

type Append struct {
	Item interface{}
}

Append adds an item to corresponding list in podnetworkchaos

func (*Append) Apply

func (a *Append) Apply(chaos *v1alpha1.PodIoChaos) error

Apply runs this action

type Clear

type Clear struct {
	Source string
}

Clear removes all resources with the same source

func (*Clear) Apply

func (s *Clear) Apply(chaos *v1alpha1.PodIoChaos) error

Apply runs this action

type CommitResponse added in v1.0.3

type CommitResponse struct {
	Key types.NamespacedName
	Err error
}

CommitResponse is a tuple (Key, Err)

type PodIoManager

type PodIoManager struct {
	Source string
	Log    logr.Logger
	client.Client

	Modifications map[types.NamespacedName]*PodIoTransaction
}

PodIoManager will save all the related podiochaos

func New

func New(source string, logger logr.Logger, client client.Client) *PodIoManager

New creates a new PodIoMap

func (*PodIoManager) Commit

func (m *PodIoManager) Commit(ctx context.Context) []CommitResponse

Commit will update all modifications to the cluster

func (*PodIoManager) WithInit

WithInit will get a transaction or start a transaction with initially clear

type PodIoTransaction

type PodIoTransaction struct {
	Steps []Step
}

PodIoTransaction represents a modification on podnetwork

func (*PodIoTransaction) Append

func (t *PodIoTransaction) Append(item interface{}) error

Append adds an item to corresponding list in podnetworkchaos

func (*PodIoTransaction) Apply

func (t *PodIoTransaction) Apply(chaos *v1alpha1.PodIoChaos) error

Apply runs every step on the chaos

func (*PodIoTransaction) Clear

func (t *PodIoTransaction) Clear(source string)

Clear will clear all related items in podnetworkchaos

func (*PodIoTransaction) SetContainer added in v1.1.0

func (t *PodIoTransaction) SetContainer(container string) error

func (*PodIoTransaction) SetVolumePath

func (t *PodIoTransaction) SetVolumePath(path string) error

SetVolumePath sets the volumePath field of podiochaos

type SetContainer added in v1.1.0

type SetContainer struct {
	Container string
}

SetContainer sets the container field of podiochaos

func (*SetContainer) Apply added in v1.1.0

func (s *SetContainer) Apply(chaos *v1alpha1.PodIoChaos) error

Apply runs this action

type SetVolumePath

type SetVolumePath struct {
	Path string
}

SetVolumePath sets the volumePath field of podiochaos

func (*SetVolumePath) Apply

func (s *SetVolumePath) Apply(chaos *v1alpha1.PodIoChaos) error

Apply runs this action

type Step

type Step interface {
	// Apply will apply an action on podnetworkchaos
	Apply(chaos *v1alpha1.PodIoChaos) error
}

Step represents a step of PodIoTransaction

Jump to

Keyboard shortcuts

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