From d1672351e4c0f0e0eb9d9ef616d8176b3ecf51ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wo=C5=BAniak?= Date: Tue, 5 Mar 2024 18:25:15 +0100 Subject: [PATCH] Support for the Job managedBy field (alpha) (#123273) * support for the managed-by label in Job * Use managedBy field instead of managed-by label * Additional review remarks * Review remarks 2 * review remarks 3 * Skip cleanup of finalizers for job with custom managedBy * Drop the performance optimization * imrpove logs Kubernetes-commit: e568a77a931a1cf4239a4a5fa43e2b05bad3abdf --- applyconfigurations/batch/v1/jobspec.go | 9 +++++++++ applyconfigurations/internal/internal.go | 3 +++ go.mod | 4 ++-- go.sum | 4 ++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/applyconfigurations/batch/v1/jobspec.go b/applyconfigurations/batch/v1/jobspec.go index 3d46a3ec..491b3361 100644 --- a/applyconfigurations/batch/v1/jobspec.go +++ b/applyconfigurations/batch/v1/jobspec.go @@ -41,6 +41,7 @@ type JobSpecApplyConfiguration struct { CompletionMode *batchv1.CompletionMode `json:"completionMode,omitempty"` Suspend *bool `json:"suspend,omitempty"` PodReplacementPolicy *batchv1.PodReplacementPolicy `json:"podReplacementPolicy,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` } // JobSpecApplyConfiguration constructs an declarative configuration of the JobSpec type for use with @@ -160,3 +161,11 @@ func (b *JobSpecApplyConfiguration) WithPodReplacementPolicy(value batchv1.PodRe b.PodReplacementPolicy = &value return b } + +// WithManagedBy sets the ManagedBy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ManagedBy field is set to the value of the last call. +func (b *JobSpecApplyConfiguration) WithManagedBy(value string) *JobSpecApplyConfiguration { + b.ManagedBy = &value + return b +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 37589e6b..99c14e94 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -3599,6 +3599,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: completions type: scalar: numeric + - name: managedBy + type: + scalar: string - name: manualSelector type: scalar: boolean diff --git a/go.mod b/go.mod index 39271274..93b4e51b 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( golang.org/x/term v0.17.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.31.0 - k8s.io/api v0.0.0-20240305044759-dd2e75089b33 + k8s.io/api v0.0.0-20240305172515-3bd4693ef0c1 k8s.io/apimachinery v0.0.0-20240305011844-67cb3a878cd3 k8s.io/klog/v2 v2.120.1 k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 @@ -61,6 +61,6 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20240305044759-dd2e75089b33 + k8s.io/api => k8s.io/api v0.0.0-20240305172515-3bd4693ef0c1 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20240305011844-67cb3a878cd3 ) diff --git a/go.sum b/go.sum index 29bff8ed..532a4c1d 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.0.0-20240305044759-dd2e75089b33 h1:t4rX/ZVL/5i5E/Z+kQFnCkqRn4Ni6vf+y7M399XPmSM= -k8s.io/api v0.0.0-20240305044759-dd2e75089b33/go.mod h1:vubRQCvGk3ZRs8VJewbBCTFfaSYNGtDSO4rI+Ur8d0M= +k8s.io/api v0.0.0-20240305172515-3bd4693ef0c1 h1:Bk1KMpe+FJvuKidoJIbw5wInLRq1xqp/wa/vU4AMCdg= +k8s.io/api v0.0.0-20240305172515-3bd4693ef0c1/go.mod h1:vubRQCvGk3ZRs8VJewbBCTFfaSYNGtDSO4rI+Ur8d0M= k8s.io/apimachinery v0.0.0-20240305011844-67cb3a878cd3 h1:OQnlxechgbZid21Q0KyffHDuHHZz+G7RTGDA3SIkC+o= k8s.io/apimachinery v0.0.0-20240305011844-67cb3a878cd3/go.mod h1:qPsrq6INURDMMgqxK78MEuC8GzI1f2oHvfHzg5ZOa6s= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=