services

package
v0.0.0-...-51bb0a0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChaosPodAllowedErrors

type ChaosPodAllowedErrors map[string]struct{}

type ChaosPodService

type ChaosPodService interface {
	// GetChaosPodsOfDisruption retrieves a list chaos pods of a disruption for the given labels.
	GetChaosPodsOfDisruption(ctx context.Context, instance *chaosv1beta1.Disruption, ls labels.Set) ([]corev1.Pod, error)

	// HandleChaosPodTermination handles the termination of a chaos pod during a disruption event.
	HandleChaosPodTermination(ctx context.Context, disruption *chaosv1beta1.Disruption, pod *corev1.Pod) (stuckOnRemoval bool, err error)

	// DeletePod deletes a pod from the Kubernetes cluster.
	DeletePod(ctx context.Context, pod corev1.Pod) bool

	// GenerateChaosPodOfDisruption generates a pod for the disruption.
	GenerateChaosPodOfDisruption(disruption *chaosv1beta1.Disruption, targetName, targetNodeName string, args []string, kind chaostypes.DisruptionKindName) corev1.Pod

	// GenerateChaosPodsOfDisruption generates a list of chaos pods for the disruption.
	GenerateChaosPodsOfDisruption(instance *chaosv1beta1.Disruption, targetName, targetNodeName string, targetContainers map[string]string, targetPodIP string) ([]corev1.Pod, error)

	// GetPodInjectorArgs retrieves arguments to inject into a pod.
	GetPodInjectorArgs(pod corev1.Pod) []string

	// CreatePod creates a pod in the Kubernetes cluster.
	CreatePod(ctx context.Context, pod *corev1.Pod) error

	// WaitForPodCreation waits for a pod to be created in the Kubernetes cluster.
	WaitForPodCreation(ctx context.Context, pod corev1.Pod) error

	// HandleOrphanedChaosPods handles orphaned chaos pods based on a controller request.
	HandleOrphanedChaosPods(ctx context.Context, req ctrl.Request) error
}

ChaosPodService is an interface that defines methods for managing chaos pods of a disruption on Kubernetes pods.

func NewChaosPodService

func NewChaosPodService(config ChaosPodServiceConfig) (ChaosPodService, error)

NewChaosPodService create a new chaos pod service instance with the provided configuration.

type ChaosPodServiceConfig

type ChaosPodServiceConfig struct {
	Client           client.Client                 // Kubernetes client for interacting with the API server.
	Log              *zap.SugaredLogger            // Logger for logging.
	ChaosNamespace   string                        // Namespace where chaos-related resources are located.
	TargetSelector   targetselector.TargetSelector // Target selector for selecting target pods.
	Injector         ChaosPodServiceInjectorConfig // Configuration options for the injector.
	ImagePullSecrets string                        // Image pull secrets for the chaosPodService.
	MetricsSink      metrics.Sink                  // Sink for exporting metrics.
}

ChaosPodServiceConfig contains configuration options for the chaosPodService.

type ChaosPodServiceInjectorConfig

type ChaosPodServiceInjectorConfig struct {
	ServiceAccount                string              // Service account to be used by the injector.
	Image                         string              // Image to be used for the injector.
	Annotations, Labels           map[string]string   // Annotations and labels to be applied to injected pods.
	NetworkDisruptionAllowedHosts []string            // List of hosts allowed during network disruption.
	DNSDisruptionDNSServer        string              // DNS server to be used for DNS disruption.
	DNSDisruptionKubeDNS          string              // KubeDNS server to be used for DNS disruption.
	ImagePullSecrets              string              // Image pull secrets for the injector.
	Tolerations                   []config.Toleration // Tolerations to be applied to injected pods.
	LogLevel                      string
}

ChaosPodServiceInjectorConfig contains configuration options for the injector.

Jump to

Keyboard shortcuts

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