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")
)
Append adds an item to corresponding list in podnetworkchaos
type Append struct {
Item interface{}
}
func (a *Append) Apply(chaos *v1alpha1.PodIoChaos) error
Apply runs this action
Clear removes all resources with the same source
type Clear struct {
Source string
}
func (s *Clear) Apply(chaos *v1alpha1.PodIoChaos) error
Apply runs this action
CommitResponse is a tuple (Key, Err)
type CommitResponse struct {
Key types.NamespacedName
Err error
}
PodIoManager will save all the related podiochaos
type PodIoManager struct {
Source string
Log logr.Logger
client.Client
Modifications map[types.NamespacedName]*PodIoTransaction
}
func New(source string, logger logr.Logger, client client.Client) *PodIoManager
New creates a new PodIoMap
func (m *PodIoManager) Commit(ctx context.Context) []CommitResponse
Commit will update all modifications to the cluster
func (m *PodIoManager) WithInit(key types.NamespacedName) *PodIoTransaction
WithInit will get a transaction or start a transaction with initially clear
PodIoTransaction represents a modification on podnetwork
type PodIoTransaction struct {
Steps []Step
}
func (t *PodIoTransaction) Append(item interface{}) error
Append adds an item to corresponding list in podnetworkchaos
func (t *PodIoTransaction) Apply(chaos *v1alpha1.PodIoChaos) error
Apply runs every step on the chaos
func (t *PodIoTransaction) Clear(source string)
Clear will clear all related items in podnetworkchaos
func (t *PodIoTransaction) SetVolumePath(path string) error
SetVolumePath sets the volumePath field of podiochaos
SetVolumePath sets the volumePath field of podiochaos
type SetVolumePath struct {
Path string
}
func (s *SetVolumePath) Apply(chaos *v1alpha1.PodIoChaos) error
Apply runs this action
Step represents a step of PodIoTransaction
type Step interface {
// Apply will apply an action on podnetworkchaos
Apply(chaos *v1alpha1.PodIoChaos) error
}