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
This commit is contained in:
Michał Woźniak 2024-03-05 18:25:15 +01:00 committed by Kubernetes Publisher
parent 64334495a6
commit d1672351e4
4 changed files with 16 additions and 4 deletions

View File

@ -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
}

View File

@ -3599,6 +3599,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: completions
type:
scalar: numeric
- name: managedBy
type:
scalar: string
- name: manualSelector
type:
scalar: boolean

4
go.mod
View File

@ -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
)

4
go.sum
View File

@ -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=