Documentation ¶
Overview ¶
Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.
Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.
Index ¶
- Constants
- Variables
- func CheckTargetResourceExists(ctx context.Context, cl client.Client, ...) (bool, error)
- func CreateDisruptionFromTemplate(ctx context.Context, cl client.Client, scheme *runtime.Scheme, ...) (*chaosv1beta1.Disruption, error)
- func GetChildDisruptions(ctx context.Context, cl client.Client, log *zap.SugaredLogger, ...) (*chaosv1beta1.DisruptionList, error)
- func GetMostRecentScheduleTime(log *zap.SugaredLogger, disruptions *chaosv1beta1.DisruptionList) time.Time
- func GetSelectors(ctx context.Context, cl client.Client, ...) (labels *metav1.LabelSelector, err error)
- func GetTargetResource(ctx context.Context, cl client.Client, ...) (client.Object, error)
- type CtxTuple
- type DisruptionCronReconciler
- type DisruptionReconciler
- func (r *DisruptionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
- func (r *DisruptionReconciler) ReportMetrics(ctx context.Context)
- func (r *DisruptionReconciler) SetupWithManager(mgr ctrl.Manager, kubeInformerFactory kubeinformers.SharedInformerFactory) (controller.Controller, error)
- type DisruptionRolloutReconciler
Constants ¶
const ( DisruptionCronNameLabel = chaosv1beta1.GroupName + "/disruption-cron-name" DisruptionRolloutNameLabel = chaosv1beta1.GroupName + "/disruption-rollout-name" TargetResourceMissingThreshold = time.Hour * 24 )
const TargetsCountLogLimit = 50
Variables ¶
var DisruptionCronTags = []string{}
var DisruptionRolloutTags = []string{}
Functions ¶
func CheckTargetResourceExists ¶
func CheckTargetResourceExists(ctx context.Context, cl client.Client, targetResource *chaosv1beta1.TargetResourceSpec, namespace string) (bool, error)
CheckTargetResourceExists determines if the target resource exists. Returns a boolean indicating presence and an error if one occurs.
func CreateDisruptionFromTemplate ¶
func CreateDisruptionFromTemplate(ctx context.Context, cl client.Client, scheme *runtime.Scheme, owner metav1.Object, targetResource *chaosv1beta1.TargetResourceSpec, disruptionSpec *chaosv1beta1.DisruptionSpec, scheduledTime time.Time, log *zap.SugaredLogger) (*chaosv1beta1.Disruption, error)
CreateDisruptionFromTemplate constructs a Disruption object based on the provided owner, disruptionSpec, and targetResource. The function sets annotations, overwrites selectors, and associates the Disruption with its owner. It returns the constructed Disruption or an error if any step fails.
func GetChildDisruptions ¶
func GetChildDisruptions(ctx context.Context, cl client.Client, log *zap.SugaredLogger, namespace, labelKey, labelVal string) (*chaosv1beta1.DisruptionList, error)
GetChildDisruptions retrieves disruptions associated with a resource by its label. Most of the time, this will return an empty list as disruptions are typically short-lived objects.
func GetMostRecentScheduleTime ¶
func GetMostRecentScheduleTime(log *zap.SugaredLogger, disruptions *chaosv1beta1.DisruptionList) time.Time
GetMostRecentScheduleTime returns the most recent scheduled time from a list of disruptions.
func GetSelectors ¶
func GetSelectors(ctx context.Context, cl client.Client, targetResource *chaosv1beta1.TargetResourceSpec, namespace string) (labels *metav1.LabelSelector, err error)
GetSelectors retrieves the labels of the specified target resource (Deployment or StatefulSet). Returns a set of labels to be used as Disruption selectors and an error if retrieval fails.
func GetTargetResource ¶
func GetTargetResource(ctx context.Context, cl client.Client, targetResource *chaosv1beta1.TargetResourceSpec, namespace string) (client.Object, error)
GetTargetResource retrieves the specified target resource (Deployment or StatefulSet). It returns the target resource object and any error encountered during retrieval.
Types ¶
type CtxTuple ¶
type CtxTuple struct { Ctx context.Context CancelFunc context.CancelFunc DisruptionNamespacedName types.NamespacedName }
type DisruptionCronReconciler ¶
type DisruptionCronReconciler struct { Client client.Client Scheme *runtime.Scheme BaseLog *zap.SugaredLogger MetricsSink metrics.Sink FinalizerDeletionDelay time.Duration // contains filtered or unexported fields }
func (*DisruptionCronReconciler) SetupWithManager ¶
func (r *DisruptionCronReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager setups the current reconciler with the given manager
type DisruptionReconciler ¶
type DisruptionReconciler struct { Client client.Client BaseLog *zap.SugaredLogger Scheme *runtime.Scheme Recorder record.EventRecorder MetricsSink metrics.Sink TracerSink tracer.Sink TargetSelector targetselector.TargetSelector SafetyNets []safemode.Safemode ExpiredDisruptionGCDelay *time.Duration CacheContextStore map[string]CtxTuple DisruptionsWatchersManager watchers.DisruptionsWatchersManager ChaosPodService services.ChaosPodService CloudService cloudservice.CloudServicesProvidersManager DisruptionsDeletionTimeout time.Duration DeleteOnly bool FinalizerDeletionDelay time.Duration // contains filtered or unexported fields }
DisruptionReconciler reconciles a Disruption object
func (*DisruptionReconciler) ReportMetrics ¶
func (r *DisruptionReconciler) ReportMetrics(ctx context.Context)
ReportMetrics reports some controller metrics every minute: - stuck on removal disruptions count - ongoing disruptions count
func (*DisruptionReconciler) SetupWithManager ¶
func (r *DisruptionReconciler) SetupWithManager(mgr ctrl.Manager, kubeInformerFactory kubeinformers.SharedInformerFactory) (controller.Controller, error)
SetupWithManager setups the current reconciler with the given manager
type DisruptionRolloutReconciler ¶
type DisruptionRolloutReconciler struct { Client client.Client Scheme *runtime.Scheme BaseLog *zap.SugaredLogger MetricsSink metrics.Sink // contains filtered or unexported fields }
func (*DisruptionRolloutReconciler) SetupWithManager ¶
func (r *DisruptionRolloutReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager setups the current reconciler with the given manager