podnetworkchaosmanager

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 13 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.PodNetworkChaos) error

Apply runs this action

type Builder

type Builder struct {
	Log logr.Logger
	client.Client
	client.Reader
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(params Params) *Builder

func (*Builder) Build

func (b *Builder) Build(source string, key types.NamespacedName) *PodNetworkManager

func (*Builder) WithInit

func (b *Builder) WithInit(source string, key types.NamespacedName) *PodNetworkManager

type Clear

type Clear struct {
	Source string
}

Clear removes all resources with the same source

func (*Clear) Apply

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

Apply runs this action

type CommitResponse

type CommitResponse struct {
	Key types.NamespacedName
	Err error
}

CommitResponse is a tuple (Key, Err)

type Params

type Params struct {
	fx.In

	Logger logr.Logger
	Client client.Client
	Reader client.Reader `name:"no-cache"`
	Scheme *runtime.Scheme
}

type PodNetworkManager

type PodNetworkManager struct {
	Source string

	Log logr.Logger
	client.Client
	client.Reader

	Key types.NamespacedName
	T   *PodNetworkTransaction
	// contains filtered or unexported fields
}

PodNetworkManager will save all the related podnetworkchaos

func (*PodNetworkManager) Commit

func (m *PodNetworkManager) Commit(ctx context.Context, owner *v1alpha1.NetworkChaos) (int64, error)

Commit will update all modifications to the cluster

func (*PodNetworkManager) CreateNewPodNetworkChaos

func (m *PodNetworkManager) CreateNewPodNetworkChaos(ctx context.Context) error

type PodNetworkTransaction

type PodNetworkTransaction struct {
	Steps []Step
}

PodNetworkTransaction represents a modification on podnetwork

func (*PodNetworkTransaction) Append

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

Append adds an item to corresponding list in podnetworkchaos

func (*PodNetworkTransaction) Apply

Apply runs every step on the chaos

func (*PodNetworkTransaction) Clear

func (t *PodNetworkTransaction) Clear(source string)

Clear will clear all related items in podnetworkchaos

type Step

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

Step represents a step of PodNetworkTransaction

Jump to

Keyboard shortcuts

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