From 311f40245f85e946211c3aa25e0c95e8836d711c Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Fri, 2 Feb 2024 22:48:19 +0100 Subject: [PATCH] added image minimum and maximum gc age Signed-off-by: Tobias Trabelsi --- k8s/crds/kops.k8s.io_clusters.yaml | 22 +++++++++++++++++++ k8s/crds/kops.k8s.io_instancegroups.yaml | 11 ++++++++++ pkg/apis/kops/componentconfig.go | 6 +++++ pkg/apis/kops/v1alpha2/componentconfig.go | 6 +++++ .../kops/v1alpha2/zz_generated.conversion.go | 4 ++++ .../kops/v1alpha2/zz_generated.deepcopy.go | 10 +++++++++ pkg/apis/kops/v1alpha3/componentconfig.go | 6 +++++ .../kops/v1alpha3/zz_generated.conversion.go | 4 ++++ .../kops/v1alpha3/zz_generated.deepcopy.go | 10 +++++++++ pkg/apis/kops/zz_generated.deepcopy.go | 10 +++++++++ 10 files changed, 89 insertions(+) diff --git a/k8s/crds/kops.k8s.io_clusters.yaml b/k8s/crds/kops.k8s.io_clusters.yaml index fb80b405e8..a4c2e4b677 100644 --- a/k8s/crds/kops.k8s.io_clusters.yaml +++ b/k8s/crds/kops.k8s.io_clusters.yaml @@ -4073,6 +4073,17 @@ spec: disk usage to garbage collect to. format: int32 type: integer + imageMaximumGCAge: + description: 'imageMaximumGCAge is the maximum age an image can + be unused before it is garbage collected. The default of this + field is "0s", which disables this field--meaning images won''t + be garbage collected based on being unused for too long. Default: + "0s" (disabled)' + type: string + imageMinimumGCAge: + description: 'imageMinimumGCAge is the minimum age for an unused + image before it is garbage collected. Default: "2m"' + type: string imagePullProgressDeadline: description: ImagePullProgressDeadline is the timeout for image pulls If no pulling progress is made before this deadline, the @@ -4511,6 +4522,17 @@ spec: disk usage to garbage collect to. format: int32 type: integer + imageMaximumGCAge: + description: 'imageMaximumGCAge is the maximum age an image can + be unused before it is garbage collected. The default of this + field is "0s", which disables this field--meaning images won''t + be garbage collected based on being unused for too long. Default: + "0s" (disabled)' + type: string + imageMinimumGCAge: + description: 'imageMinimumGCAge is the minimum age for an unused + image before it is garbage collected. Default: "2m"' + type: string imagePullProgressDeadline: description: ImagePullProgressDeadline is the timeout for image pulls If no pulling progress is made before this deadline, the diff --git a/k8s/crds/kops.k8s.io_instancegroups.yaml b/k8s/crds/kops.k8s.io_instancegroups.yaml index ffca491ab2..39d27c5154 100644 --- a/k8s/crds/kops.k8s.io_instancegroups.yaml +++ b/k8s/crds/kops.k8s.io_instancegroups.yaml @@ -606,6 +606,17 @@ spec: disk usage to garbage collect to. format: int32 type: integer + imageMaximumGCAge: + description: 'imageMaximumGCAge is the maximum age an image can + be unused before it is garbage collected. The default of this + field is "0s", which disables this field--meaning images won''t + be garbage collected based on being unused for too long. Default: + "0s" (disabled)' + type: string + imageMinimumGCAge: + description: 'imageMinimumGCAge is the minimum age for an unused + image before it is garbage collected. Default: "2m"' + type: string imagePullProgressDeadline: description: ImagePullProgressDeadline is the timeout for image pulls If no pulling progress is made before this deadline, the diff --git a/pkg/apis/kops/componentconfig.go b/pkg/apis/kops/componentconfig.go index 8f9bd4d297..ff97458548 100644 --- a/pkg/apis/kops/componentconfig.go +++ b/pkg/apis/kops/componentconfig.go @@ -130,6 +130,12 @@ type KubeletConfigSpec struct { // and overrides the default MTU for cases where it cannot be automatically // computed (such as IPSEC). NetworkPluginMTU *int32 `json:"networkPluginMTU,omitempty" flag:"network-plugin-mtu"` + // imageMinimumGCAge is the minimum age for an unused image before it is garbage collected. Default: "2m" + ImageMinimumGCAge *string `json:"imageMinimumGCAge,omitempty" flag:"image-minimum-gc-age"` + // imageMaximumGCAge is the maximum age an image can be unused before it is garbage collected. + // The default of this field is "0s", which disables this field--meaning images won't be garbage + // collected based on being unused for too long. Default: "0s" (disabled) + ImageMaximumGCAge *string `json:"imageMaximumGCAge,omitempty" flag:"image-maximum-gc-age"` // ImageGCHighThresholdPercent is the percent of disk usage after which // image garbage collection is always run. ImageGCHighThresholdPercent *int32 `json:"imageGCHighThresholdPercent,omitempty" flag:"image-gc-high-threshold"` diff --git a/pkg/apis/kops/v1alpha2/componentconfig.go b/pkg/apis/kops/v1alpha2/componentconfig.go index d06eda7edd..a45c752620 100644 --- a/pkg/apis/kops/v1alpha2/componentconfig.go +++ b/pkg/apis/kops/v1alpha2/componentconfig.go @@ -130,6 +130,12 @@ type KubeletConfigSpec struct { // and overrides the default MTU for cases where it cannot be automatically // computed (such as IPSEC). NetworkPluginMTU *int32 `json:"networkPluginMTU,omitempty" flag:"network-plugin-mtu"` + // imageMinimumGCAge is the minimum age for an unused image before it is garbage collected. Default: "2m" + ImageMinimumGCAge *string `json:"imageMinimumGCAge,omitempty" flag:"image-minimum-gc-age"` + // imageMaximumGCAge is the maximum age an image can be unused before it is garbage collected. + // The default of this field is "0s", which disables this field--meaning images won't be garbage + // collected based on being unused for too long. Default: "0s" (disabled) + ImageMaximumGCAge *string `json:"imageMaximumGCAge,omitempty" flag:"image-maximum-gc-age"` // ImageGCHighThresholdPercent is the percent of disk usage after which // image garbage collection is always run. ImageGCHighThresholdPercent *int32 `json:"imageGCHighThresholdPercent,omitempty" flag:"image-gc-high-threshold"` diff --git a/pkg/apis/kops/v1alpha2/zz_generated.conversion.go b/pkg/apis/kops/v1alpha2/zz_generated.conversion.go index 60199892e7..51450a025a 100644 --- a/pkg/apis/kops/v1alpha2/zz_generated.conversion.go +++ b/pkg/apis/kops/v1alpha2/zz_generated.conversion.go @@ -5478,6 +5478,8 @@ func autoConvert_v1alpha2_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele out.NonMasqueradeCIDR = in.NonMasqueradeCIDR out.EnableCustomMetrics = in.EnableCustomMetrics out.NetworkPluginMTU = in.NetworkPluginMTU + out.ImageMinimumGCAge = in.ImageMinimumGCAge + out.ImageMaximumGCAge = in.ImageMaximumGCAge out.ImageGCHighThresholdPercent = in.ImageGCHighThresholdPercent out.ImageGCLowThresholdPercent = in.ImageGCLowThresholdPercent out.ImagePullProgressDeadline = in.ImagePullProgressDeadline @@ -5580,6 +5582,8 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha2_KubeletConfigSpec(in *kops.K out.NonMasqueradeCIDR = in.NonMasqueradeCIDR out.EnableCustomMetrics = in.EnableCustomMetrics out.NetworkPluginMTU = in.NetworkPluginMTU + out.ImageMinimumGCAge = in.ImageMinimumGCAge + out.ImageMaximumGCAge = in.ImageMaximumGCAge out.ImageGCHighThresholdPercent = in.ImageGCHighThresholdPercent out.ImageGCLowThresholdPercent = in.ImageGCLowThresholdPercent out.ImagePullProgressDeadline = in.ImagePullProgressDeadline diff --git a/pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go index bf22be2236..f9a2b2b275 100644 --- a/pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/kops/v1alpha2/zz_generated.deepcopy.go @@ -3993,6 +3993,16 @@ func (in *KubeletConfigSpec) DeepCopyInto(out *KubeletConfigSpec) { *out = new(int32) **out = **in } + if in.ImageMinimumGCAge != nil { + in, out := &in.ImageMinimumGCAge, &out.ImageMinimumGCAge + *out = new(string) + **out = **in + } + if in.ImageMaximumGCAge != nil { + in, out := &in.ImageMaximumGCAge, &out.ImageMaximumGCAge + *out = new(string) + **out = **in + } if in.ImageGCHighThresholdPercent != nil { in, out := &in.ImageGCHighThresholdPercent, &out.ImageGCHighThresholdPercent *out = new(int32) diff --git a/pkg/apis/kops/v1alpha3/componentconfig.go b/pkg/apis/kops/v1alpha3/componentconfig.go index d336b4ead3..a434f2cbda 100644 --- a/pkg/apis/kops/v1alpha3/componentconfig.go +++ b/pkg/apis/kops/v1alpha3/componentconfig.go @@ -129,6 +129,12 @@ type KubeletConfigSpec struct { // and overrides the default MTU for cases where it cannot be automatically // computed (such as IPSEC). NetworkPluginMTU *int32 `json:"networkPluginMTU,omitempty" flag:"network-plugin-mtu"` + // imageMinimumGCAge is the minimum age for an unused image before it is garbage collected. Default: "2m" + ImageMinimumGCAge *string `json:"imageMinimumGCAge,omitempty" flag:"image-minimum-gc-age"` + // imageMaximumGCAge is the maximum age an image can be unused before it is garbage collected. + // The default of this field is "0s", which disables this field--meaning images won't be garbage + // collected based on being unused for too long. Default: "0s" (disabled) + ImageMaximumGCAge *string `json:"imageMaximumGCAge,omitempty" flag:"image-maximum-gc-age"` // ImageGCHighThresholdPercent is the percent of disk usage after which // image garbage collection is always run. ImageGCHighThresholdPercent *int32 `json:"imageGCHighThresholdPercent,omitempty" flag:"image-gc-high-threshold"` diff --git a/pkg/apis/kops/v1alpha3/zz_generated.conversion.go b/pkg/apis/kops/v1alpha3/zz_generated.conversion.go index 5aba9f361e..81af024cb2 100644 --- a/pkg/apis/kops/v1alpha3/zz_generated.conversion.go +++ b/pkg/apis/kops/v1alpha3/zz_generated.conversion.go @@ -5871,6 +5871,8 @@ func autoConvert_v1alpha3_KubeletConfigSpec_To_kops_KubeletConfigSpec(in *Kubele out.NonMasqueradeCIDR = in.NonMasqueradeCIDR out.EnableCustomMetrics = in.EnableCustomMetrics out.NetworkPluginMTU = in.NetworkPluginMTU + out.ImageMinimumGCAge = in.ImageMinimumGCAge + out.ImageMaximumGCAge = in.ImageMaximumGCAge out.ImageGCHighThresholdPercent = in.ImageGCHighThresholdPercent out.ImageGCLowThresholdPercent = in.ImageGCLowThresholdPercent out.ImagePullProgressDeadline = in.ImagePullProgressDeadline @@ -5973,6 +5975,8 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha3_KubeletConfigSpec(in *kops.K out.NonMasqueradeCIDR = in.NonMasqueradeCIDR out.EnableCustomMetrics = in.EnableCustomMetrics out.NetworkPluginMTU = in.NetworkPluginMTU + out.ImageMinimumGCAge = in.ImageMinimumGCAge + out.ImageMaximumGCAge = in.ImageMaximumGCAge out.ImageGCHighThresholdPercent = in.ImageGCHighThresholdPercent out.ImageGCLowThresholdPercent = in.ImageGCLowThresholdPercent out.ImagePullProgressDeadline = in.ImagePullProgressDeadline diff --git a/pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go index 7aa4bf0e07..9d24085e66 100644 --- a/pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go +++ b/pkg/apis/kops/v1alpha3/zz_generated.deepcopy.go @@ -3967,6 +3967,16 @@ func (in *KubeletConfigSpec) DeepCopyInto(out *KubeletConfigSpec) { *out = new(int32) **out = **in } + if in.ImageMinimumGCAge != nil { + in, out := &in.ImageMinimumGCAge, &out.ImageMinimumGCAge + *out = new(string) + **out = **in + } + if in.ImageMaximumGCAge != nil { + in, out := &in.ImageMaximumGCAge, &out.ImageMaximumGCAge + *out = new(string) + **out = **in + } if in.ImageGCHighThresholdPercent != nil { in, out := &in.ImageGCHighThresholdPercent, &out.ImageGCHighThresholdPercent *out = new(int32) diff --git a/pkg/apis/kops/zz_generated.deepcopy.go b/pkg/apis/kops/zz_generated.deepcopy.go index ecadcf9a3e..2f2b658e16 100644 --- a/pkg/apis/kops/zz_generated.deepcopy.go +++ b/pkg/apis/kops/zz_generated.deepcopy.go @@ -4070,6 +4070,16 @@ func (in *KubeletConfigSpec) DeepCopyInto(out *KubeletConfigSpec) { *out = new(int32) **out = **in } + if in.ImageMinimumGCAge != nil { + in, out := &in.ImageMinimumGCAge, &out.ImageMinimumGCAge + *out = new(string) + **out = **in + } + if in.ImageMaximumGCAge != nil { + in, out := &in.ImageMaximumGCAge, &out.ImageMaximumGCAge + *out = new(string) + **out = **in + } if in.ImageGCHighThresholdPercent != nil { in, out := &in.ImageGCHighThresholdPercent, &out.ImageGCHighThresholdPercent *out = new(int32)