mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-02-18 18:28:18 -05:00
Merge pull request #135080 from dejanzele/feat/promote-job-managedby-to-ga
KEP-4368: Job Managed By; Promote to GA
This commit is contained in:
commit
97cb47a913
12 changed files with 30 additions and 16 deletions
2
api/openapi-spec/swagger.json
generated
2
api/openapi-spec/swagger.json
generated
|
|
@ -4587,7 +4587,7 @@
|
|||
"type": "integer"
|
||||
},
|
||||
"managedBy": {
|
||||
"description": "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.\n\nThis field is beta-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (enabled by default).",
|
||||
"description": "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.",
|
||||
"type": "string"
|
||||
},
|
||||
"manualSelector": {
|
||||
|
|
|
|||
2
api/openapi-spec/v3/apis__batch__v1_openapi.json
generated
2
api/openapi-spec/v3/apis__batch__v1_openapi.json
generated
|
|
@ -345,7 +345,7 @@
|
|||
"type": "integer"
|
||||
},
|
||||
"managedBy": {
|
||||
"description": "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.\n\nThis field is beta-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (enabled by default).",
|
||||
"description": "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.",
|
||||
"type": "string"
|
||||
},
|
||||
"manualSelector": {
|
||||
|
|
|
|||
|
|
@ -467,9 +467,6 @@ type JobSpec struct {
|
|||
// by RFC 1123. All characters trailing the first "/" must be valid HTTP Path
|
||||
// characters as defined by RFC 3986. The value cannot exceed 63 characters.
|
||||
// This field is immutable.
|
||||
//
|
||||
// This field is beta-level. The job controller accepts setting the field
|
||||
// when the feature gate JobManagedBy is enabled (enabled by default).
|
||||
// +optional
|
||||
ManagedBy *string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2690,6 +2690,9 @@ func TestSyncJobPastDeadline(t *testing.T) {
|
|||
if !tc.enableJobPodReplacementPolicy {
|
||||
// TODO: this will be removed in 1.37.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.33"))
|
||||
} else if !tc.enableJobManagedBy {
|
||||
// TODO: this will be removed in 1.38.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.34"))
|
||||
}
|
||||
featuregatetesting.SetFeatureGatesDuringTest(t, feature.DefaultFeatureGate, featuregatetesting.FeatureOverrides{
|
||||
features.JobManagedBy: tc.enableJobManagedBy,
|
||||
|
|
@ -3022,6 +3025,8 @@ func TestSyncJobWhenManagedBy(t *testing.T) {
|
|||
}
|
||||
for name, tc := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
// TODO: this will be removed in 1.38.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.34"))
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.JobManagedBy, tc.enableJobManagedBy)
|
||||
|
||||
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: "", ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
|
||||
|
|
@ -5184,6 +5189,9 @@ func TestSyncJobWithJobSuccessPolicy(t *testing.T) {
|
|||
if !tc.enableBackoffLimitPerIndex || !tc.enableJobSuccessPolicy {
|
||||
// TODO: this will be removed in 1.36
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.32"))
|
||||
} else if !tc.enableJobManagedBy {
|
||||
// TODO: this will be remove in 1.38
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.34"))
|
||||
}
|
||||
featuregatetesting.SetFeatureGatesDuringTest(t, feature.DefaultFeatureGate, featuregatetesting.FeatureOverrides{
|
||||
features.JobBackoffLimitPerIndex: tc.enableBackoffLimitPerIndex,
|
||||
|
|
@ -5871,6 +5879,9 @@ func TestSyncJobWithJobBackoffLimitPerIndex(t *testing.T) {
|
|||
} else if !tc.enableJobPodReplacementPolicy {
|
||||
// TODO: this will be removed in 1.37.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.33"))
|
||||
} else if !tc.enableJobManagedBy {
|
||||
// TODO: this will be removed in 1.38.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.34"))
|
||||
}
|
||||
featuregatetesting.SetFeatureGatesDuringTest(t, feature.DefaultFeatureGate, featuregatetesting.FeatureOverrides{
|
||||
features.JobBackoffLimitPerIndex: tc.enableJobBackoffLimitPerIndex,
|
||||
|
|
@ -7378,6 +7389,9 @@ func TestJobBackoffForOnFailure(t *testing.T) {
|
|||
if !tc.enableJobPodReplacementPolicy {
|
||||
// TODO: this will be removed in 1.37.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.33"))
|
||||
} else if !tc.enableJobManagedBy {
|
||||
// TODO: this will be removed in 1.38.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.34"))
|
||||
}
|
||||
featuregatetesting.SetFeatureGatesDuringTest(t, feature.DefaultFeatureGate, featuregatetesting.FeatureOverrides{
|
||||
features.JobPodReplacementPolicy: tc.enableJobPodReplacementPolicy,
|
||||
|
|
|
|||
|
|
@ -1301,6 +1301,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
|
|||
JobManagedBy: {
|
||||
{Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta},
|
||||
{Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.38
|
||||
},
|
||||
|
||||
JobPodReplacementPolicy: {
|
||||
|
|
|
|||
2
pkg/generated/openapi/zz_generated.openapi.go
generated
2
pkg/generated/openapi/zz_generated.openapi.go
generated
|
|
@ -18412,7 +18412,7 @@ func schema_k8sio_api_batch_v1_JobSpec(ref common.ReferenceCallback) common.Open
|
|||
},
|
||||
"managedBy": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.\n\nThis field is beta-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (enabled by default).",
|
||||
Description: "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -342,9 +342,6 @@ message JobSpec {
|
|||
// by RFC 1123. All characters trailing the first "/" must be valid HTTP Path
|
||||
// characters as defined by RFC 3986. The value cannot exceed 63 characters.
|
||||
// This field is immutable.
|
||||
//
|
||||
// This field is beta-level. The job controller accepts setting the field
|
||||
// when the feature gate JobManagedBy is enabled (enabled by default).
|
||||
// +optional
|
||||
optional string managedBy = 15;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -469,9 +469,6 @@ type JobSpec struct {
|
|||
// by RFC 1123. All characters trailing the first "/" must be valid HTTP Path
|
||||
// characters as defined by RFC 3986. The value cannot exceed 63 characters.
|
||||
// This field is immutable.
|
||||
//
|
||||
// This field is beta-level. The job controller accepts setting the field
|
||||
// when the feature gate JobManagedBy is enabled (enabled by default).
|
||||
// +optional
|
||||
ManagedBy *string `json:"managedBy,omitempty" protobuf:"bytes,15,opt,name=managedBy"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ var map_JobSpec = map[string]string{
|
|||
"completionMode": "completionMode specifies how Pod completions are tracked. It can be `NonIndexed` (default) or `Indexed`.\n\n`NonIndexed` means that the Job is considered complete when there have been .spec.completions successfully completed Pods. Each Pod completion is homologous to each other.\n\n`Indexed` means that the Pods of a Job get an associated completion index from 0 to (.spec.completions - 1), available in the annotation batch.kubernetes.io/job-completion-index. The Job is considered complete when there is one successfully completed Pod for each index. When value is `Indexed`, .spec.completions must be specified and `.spec.parallelism` must be less than or equal to 10^5. In addition, The Pod name takes the form `$(job-name)-$(index)-$(random-string)`, the Pod hostname takes the form `$(job-name)-$(index)`.\n\nMore completion modes can be added in the future. If the Job controller observes a mode that it doesn't recognize, which is possible during upgrades due to version skew, the controller skips updates for the Job.",
|
||||
"suspend": "suspend specifies whether the Job controller should create Pods or not. If a Job is created with suspend set to true, no Pods are created by the Job controller. If a Job is suspended after creation (i.e. the flag goes from false to true), the Job controller will delete all active Pods associated with this Job. Users must design their workload to gracefully handle this. Suspending a Job will reset the StartTime field of the Job, effectively resetting the ActiveDeadlineSeconds timer too. Defaults to false.",
|
||||
"podReplacementPolicy": "podReplacementPolicy specifies when to create replacement Pods. Possible values are: - TerminatingOrFailed means that we recreate pods\n when they are terminating (has a metadata.deletionTimestamp) or failed.\n- Failed means to wait until a previously created Pod is fully terminated (has phase\n Failed or Succeeded) before creating a replacement Pod.\n\nWhen using podFailurePolicy, Failed is the the only allowed value. TerminatingOrFailed and Failed are allowed values when podFailurePolicy is not in use.",
|
||||
"managedBy": "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.\n\nThis field is beta-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (enabled by default).",
|
||||
"managedBy": "ManagedBy field indicates the controller that manages a Job. The k8s Job controller reconciles jobs which don't have this field at all or the field value is the reserved string `kubernetes.io/job-controller`, but skips reconciling Jobs with a custom value for this field. The value must be a valid domain-prefixed path (e.g. acme.io/foo) - all characters before the first \"/\" must be a valid subdomain as defined by RFC 1123. All characters trailing the first \"/\" must be valid HTTP Path characters as defined by RFC 3986. The value cannot exceed 63 characters. This field is immutable.",
|
||||
}
|
||||
|
||||
func (JobSpec) SwaggerDoc() map[string]string {
|
||||
|
|
|
|||
|
|
@ -159,9 +159,6 @@ type JobSpecApplyConfiguration struct {
|
|||
// by RFC 1123. All characters trailing the first "/" must be valid HTTP Path
|
||||
// characters as defined by RFC 3986. The value cannot exceed 63 characters.
|
||||
// This field is immutable.
|
||||
//
|
||||
// This field is beta-level. The job controller accepts setting the field
|
||||
// when the feature gate JobManagedBy is enabled (enabled by default).
|
||||
ManagedBy *string `json:"managedBy,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -725,6 +725,10 @@
|
|||
lockToDefault: false
|
||||
preRelease: Beta
|
||||
version: "1.32"
|
||||
- default: true
|
||||
lockToDefault: true
|
||||
preRelease: GA
|
||||
version: "1.35"
|
||||
- name: JobPodReplacementPolicy
|
||||
versionedSpecs:
|
||||
- default: false
|
||||
|
|
|
|||
|
|
@ -1593,6 +1593,9 @@ func TestDelayTerminalPhaseCondition(t *testing.T) {
|
|||
} else if !test.enableJobPodReplacementPolicy {
|
||||
// TODO: this will be removed in 1.37.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.33"))
|
||||
} else if !test.enableJobManagedBy {
|
||||
// TODO: this will be removed in 1.38.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.34"))
|
||||
}
|
||||
featuregatetesting.SetFeatureGatesDuringTest(t, feature.DefaultFeatureGate, featuregatetesting.FeatureOverrides{
|
||||
features.JobPodReplacementPolicy: test.enableJobPodReplacementPolicy,
|
||||
|
|
@ -2150,6 +2153,8 @@ func TestManagedBy(t *testing.T) {
|
|||
for name, test := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
resetMetrics()
|
||||
// TODO: this will be removed in 1.38.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.34"))
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.JobManagedBy, test.enableJobManagedBy)
|
||||
|
||||
ctx, cancel := startJobControllerAndWaitForCaches(t, restConfig)
|
||||
|
|
@ -2197,6 +2202,8 @@ func TestManagedBy(t *testing.T) {
|
|||
// and is disabled again with re-enabling of the feature gate.
|
||||
func TestManagedBy_Reenabling(t *testing.T) {
|
||||
customControllerName := "example.com/custom-job-controller"
|
||||
// TODO: this will be removed in 1.38.
|
||||
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, feature.DefaultFeatureGate, utilversion.MustParse("1.34"))
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.JobManagedBy, true)
|
||||
|
||||
closeFn, restConfig, clientSet, ns := setup(t, "managed-by-reenabling")
|
||||
|
|
|
|||
Loading…
Reference in a new issue