pod autoremoval feature added
All checks were successful
Lint / Run on Ubuntu (push) Successful in 22s
Tests / Run on Ubuntu (push) Successful in 28s
Lint / Run on Ubuntu (pull_request) Successful in 17s
Tests / Run on Ubuntu (pull_request) Successful in 25s

This commit is contained in:
2025-05-05 00:57:24 +05:00
parent 8192f888f7
commit 823a3a0a4d
7 changed files with 260 additions and 1 deletions

View File

@@ -63,6 +63,26 @@ type ImageUpdatePolicy struct {
RestartAnnotation string `json:"restartAnnotation,omitempty"`
}
// CrashLoopPolicy defines the policy for handling pods in CrashLoopBackOff.
type CrashLoopPolicy struct {
// Enabled toggles the CrashLoopBackOff handling feature.
// +optional
Enabled bool `json:"enabled,omitempty"`
// MonitoredDeployments is a list of Deployments (in "namespace/name" format)
// whose pods should be monitored for CrashLoopBackOff.
// +optional
MonitoredDeployments []string `json:"monitoredDeployments,omitempty"`
// RestartThreshold is the number of container restarts after which
// a pod in CrashLoopBackOff will be deleted to attempt rescheduling.
// Minimum recommended value: 3 or 5.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=5
// +optional
RestartThreshold int32 `json:"restartThreshold,omitempty"`
}
// NodeTainterConfigSpec defines the desired state of NodeTainterConfig.
type NodeTainterConfigSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
@@ -95,6 +115,9 @@ type NodeTainterConfigSpec struct {
// +optional
ImageUpdatePolicy *ImageUpdatePolicy `json:"imageUpdatePolicy,omitempty"`
// +optional
CrashLoopPolicy *CrashLoopPolicy `json:"crashLoopPolicy,omitempty"`
}
// NodeTainterConfigStatus defines the observed state of NodeTainterConfig.

View File

@@ -25,6 +25,26 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CrashLoopPolicy) DeepCopyInto(out *CrashLoopPolicy) {
*out = *in
if in.MonitoredDeployments != nil {
in, out := &in.MonitoredDeployments, &out.MonitoredDeployments
*out = make([]string, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrashLoopPolicy.
func (in *CrashLoopPolicy) DeepCopy() *CrashLoopPolicy {
if in == nil {
return nil
}
out := new(CrashLoopPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageUpdatePolicy) DeepCopyInto(out *ImageUpdatePolicy) {
*out = *in
@@ -144,6 +164,11 @@ func (in *NodeTainterConfigSpec) DeepCopyInto(out *NodeTainterConfigSpec) {
*out = new(ImageUpdatePolicy)
(*in).DeepCopyInto(*out)
}
if in.CrashLoopPolicy != nil {
in, out := &in.CrashLoopPolicy, &out.CrashLoopPolicy
*out = new(CrashLoopPolicy)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeTainterConfigSpec.