...

Source file src/github.com/openshift/api/imageregistry/v1/types_imagepruner.go

Documentation: github.com/openshift/api/imageregistry/v1

     1  package v1
     2  
     3  import (
     4  	"time"
     5  
     6  	corev1 "k8s.io/api/core/v1"
     7  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     8  
     9  	operatorv1 "github.com/openshift/api/operator/v1"
    10  )
    11  
    12  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    13  
    14  // ImagePrunerList is a slice of ImagePruner objects.
    15  //
    16  // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
    17  // +openshift:compatibility-gen:level=1
    18  type ImagePrunerList struct {
    19  	metav1.TypeMeta `json:",inline"`
    20  
    21  	// metadata is the standard list's metadata.
    22  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    23  	metav1.ListMeta `json:"metadata"`
    24  	Items           []ImagePruner `json:"items"`
    25  }
    26  
    27  // +genclient
    28  // +genclient:nonNamespaced
    29  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    30  
    31  // ImagePruner is the configuration object for an image registry pruner
    32  // managed by the registry operator.
    33  //
    34  // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
    35  // +openshift:compatibility-gen:level=1
    36  type ImagePruner struct {
    37  	metav1.TypeMeta `json:",inline"`
    38  
    39  	// metadata is the standard object's metadata.
    40  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    41  	metav1.ObjectMeta `json:"metadata"`
    42  
    43  	Spec ImagePrunerSpec `json:"spec"`
    44  	// +optional
    45  	Status ImagePrunerStatus `json:"status"`
    46  }
    47  
    48  // ImagePrunerSpec defines the specs for the running image pruner.
    49  type ImagePrunerSpec struct {
    50  	// schedule specifies when to execute the job using standard cronjob syntax: https://wikipedia.org/wiki/Cron.
    51  	// Defaults to `0 0 * * *`.
    52  	// +optional
    53  	Schedule string `json:"schedule"`
    54  	// suspend specifies whether or not to suspend subsequent executions of this cronjob.
    55  	// Defaults to false.
    56  	// +optional
    57  	Suspend *bool `json:"suspend,omitempty"`
    58  	// keepTagRevisions specifies the number of image revisions for a tag in an image stream that will be preserved.
    59  	// Defaults to 3.
    60  	// +optional
    61  	KeepTagRevisions *int `json:"keepTagRevisions,omitempty"`
    62  	// keepYoungerThan specifies the minimum age in nanoseconds of an image and its referrers for it to be considered a candidate for pruning.
    63  	// DEPRECATED: This field is deprecated in favor of keepYoungerThanDuration. If both are set, this field is ignored and keepYoungerThanDuration takes precedence.
    64  	// +optional
    65  	KeepYoungerThan *time.Duration `json:"keepYoungerThan,omitempty"`
    66  	// keepYoungerThanDuration specifies the minimum age of an image and its referrers for it to be considered a candidate for pruning.
    67  	// Defaults to 60m (60 minutes).
    68  	// +optional
    69  	// +kubebuilder:validation:Format=duration
    70  	KeepYoungerThanDuration *metav1.Duration `json:"keepYoungerThanDuration,omitempty"`
    71  	// resources defines the resource requests and limits for the image pruner pod.
    72  	// +optional
    73  	Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
    74  	// affinity is a group of node affinity scheduling rules for the image pruner pod.
    75  	// +optional
    76  	Affinity *corev1.Affinity `json:"affinity,omitempty"`
    77  	// nodeSelector defines the node selection constraints for the image pruner pod.
    78  	// +optional
    79  	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
    80  	// tolerations defines the node tolerations for the image pruner pod.
    81  	// +optional
    82  	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
    83  	// successfulJobsHistoryLimit specifies how many successful image pruner jobs to retain.
    84  	// Defaults to 3 if not set.
    85  	// +optional
    86  	SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty"`
    87  	// failedJobsHistoryLimit specifies how many failed image pruner jobs to retain.
    88  	// Defaults to 3 if not set.
    89  	// +optional
    90  	FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty"`
    91  	// ignoreInvalidImageReferences indicates whether the pruner can ignore
    92  	// errors while parsing image references.
    93  	// +optional
    94  	IgnoreInvalidImageReferences bool `json:"ignoreInvalidImageReferences,omitempty"`
    95  	// logLevel sets the level of log output for the pruner job.
    96  	//
    97  	// Valid values are: "Normal", "Debug", "Trace", "TraceAll".
    98  	// Defaults to "Normal".
    99  	// +optional
   100  	// +kubebuilder:default=Normal
   101  	LogLevel operatorv1.LogLevel `json:"logLevel,omitempty"`
   102  }
   103  
   104  // ImagePrunerStatus reports image pruner operational status.
   105  type ImagePrunerStatus struct {
   106  	// observedGeneration is the last generation change that has been applied.
   107  	// +optional
   108  	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
   109  	// conditions is a list of conditions and their status.
   110  	// +optional
   111  	Conditions []operatorv1.OperatorCondition `json:"conditions,omitempty"`
   112  }
   113  

View as plain text