automatic image updates from public repos with selected tags feature added
All checks were successful
Lint / Run on Ubuntu (push) Successful in 1m30s
Tests / Run on Ubuntu (push) Successful in 1m38s

This commit is contained in:
2025-05-04 19:24:31 +05:00
parent 8029529f89
commit 8d581652a4
9 changed files with 397 additions and 13 deletions

View File

@@ -39,6 +39,30 @@ type ResourceDefaults struct {
MemoryLimit string `json:"memoryLimit,omitempty"`
}
// ImageUpdatePolicy defines the policy for automatic image updates.
type ImageUpdatePolicy struct {
// Enabled toggles the image update feature.
// +optional
Enabled bool `json:"enabled,omitempty"`
// CheckInterval specifies how often to check for image updates (e.g., "5m", "1h", "15m").
// Minimum interval recommended: 5m to avoid rate limiting.
// +kubebuilder:validation:Pattern=`^([0-9]+(s|m|h))+$`
// +kubebuilder:default="1h"
// +optional
CheckInterval string `json:"checkInterval,omitempty"`
// MonitoredTags is a list of keywords found in image tags that trigger update checks.
// Example: ["latest", "master", "dev"]
// +optional
MonitoredTags []string `json:"monitoredTags,omitempty"`
// RestartAnnotation is the annotation key used to trigger deployment restarts.
// If empty, a default will be used (e.g., "image-updater.my-operator.com/restartedAt").
// +optional
RestartAnnotation string `json:"restartAnnotation,omitempty"`
}
// NodeTainterConfigSpec defines the desired state of NodeTainterConfig.
type NodeTainterConfigSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
@@ -68,6 +92,9 @@ type NodeTainterConfigSpec struct {
// Example: "my-operator.example.com/skip-resource-defaults"
// +optional
OptOutLabelKey string `json:"optOutLabelKey,omitempty"`
// +optional
ImageUpdatePolicy *ImageUpdatePolicy `json:"imageUpdatePolicy,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 *ImageUpdatePolicy) DeepCopyInto(out *ImageUpdatePolicy) {
*out = *in
if in.MonitoredTags != nil {
in, out := &in.MonitoredTags, &out.MonitoredTags
*out = make([]string, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageUpdatePolicy.
func (in *ImageUpdatePolicy) DeepCopy() *ImageUpdatePolicy {
if in == nil {
return nil
}
out := new(ImageUpdatePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeTaintInfo) DeepCopyInto(out *NodeTaintInfo) {
*out = *in
@@ -119,6 +139,11 @@ func (in *NodeTainterConfigSpec) DeepCopyInto(out *NodeTainterConfigSpec) {
*out = new(ResourceDefaults)
**out = **in
}
if in.ImageUpdatePolicy != nil {
in, out := &in.ImageUpdatePolicy, &out.ImageUpdatePolicy
*out = new(ImageUpdatePolicy)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeTainterConfigSpec.