Skip to content

Commit

Permalink
Use managedBy field instead of managed-by label
Browse files Browse the repository at this point in the history
  • Loading branch information
mimowo committed Mar 1, 2024
1 parent 2517568 commit 1bff570
Show file tree
Hide file tree
Showing 34 changed files with 548 additions and 419 deletions.
22 changes: 13 additions & 9 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions api/openapi-spec/v3/apis__batch__v1_openapi.json
Expand Up @@ -344,6 +344,10 @@
"format": "int32",
"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 `job-controller.k8s.io`, but skips reconciling Jobs with a custom value for this field. The value must be a valid DNS subdomain name.\n\nThis field is alpha-level. The job controller accepts setting the field when the feature gate JobManagedBy is enabled (disabled by default).",
"type": "string"
},
"manualSelector": {
"description": "manualSelector controls generation of pod labels and pod selectors. Leave `manualSelector` unset unless you are certain what you are doing. When false or unset, the system pick labels unique to this job and appends those labels to the pod template. When true, the user is responsible for picking unique labels and specifying the selector. Failure to pick a unique label may cause this and other jobs to not function correctly. However, You may see `manualSelector=true` in jobs that were created with the old `extensions/v1beta1` API. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#specifying-your-own-pod-selector",
"type": "boolean"
Expand Down Expand Up @@ -406,7 +410,7 @@
"description": "JobStatus represents the current state of a Job.",
"properties": {
"active": {
"description": "The number of pending and running pods which are not terminating (without a deletionTimestamp).",
"description": "The number of pending and running pods which are not terminating (without a deletionTimestamp). The value is zero for finished jobs.",
"format": "int32",
"type": "integer"
},
Expand All @@ -420,10 +424,10 @@
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
}
],
"description": "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. The completion time is only set when the job finishes successfully."
"description": "Represents time when the job was completed. It is not guaranteed to be set in happens-before order across separate operations. It is represented in RFC3339 form and is in UTC. The completion time is set when the job finishes successfully, and only then. The value cannot be updated or removed. The value is equal or later than startTime."
},
"conditions": {
"description": "The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true. More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/",
"description": "The latest available observations of an object's current state. When a Job fails, one of the conditions will have type \"Failed\" and status true. When a Job is suspended, one of the conditions will have type \"Suspended\" and status true; when the Job is resumed, the status of this condition will become false. When a Job is completed, one of the conditions will have type \"Complete\" and status true.\n\nA job is considered finished when it is either in the \"Complete\" or \"Failed\" condition. Job cannot be in the \"Complete\" condition together we neither \"Failed\" nor \"FailureTarget\" condition. The \"Complete\", \"Failed\" and \"FailureTarget\" conditions cannot be disabled.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/",
"items": {
"allOf": [
{
Expand All @@ -438,7 +442,7 @@
"x-kubernetes-patch-strategy": "merge"
},
"failed": {
"description": "The number of pods which reached phase Failed.",
"description": "The number of pods which reached phase Failed. The value increases monotonically.",
"format": "int32",
"type": "integer"
},
Expand All @@ -447,7 +451,7 @@
"type": "string"
},
"ready": {
"description": "The number of pods which have a Ready condition.",
"description": "The number of pods which have a Ready condition. The value is zero (or nil) for finished jobs.",
"format": "int32",
"type": "integer"
},
Expand All @@ -457,15 +461,15 @@
"$ref": "#/components/schemas/io.k8s.apimachinery.pkg.apis.meta.v1.Time"
}
],
"description": "Represents time when the job controller started processing a job. When a Job is created in the suspended state, this field is not set until the first time it is resumed. This field is reset every time a Job is resumed from suspension. It is represented in RFC3339 form and is in UTC."
"description": "Represents time when the job controller started processing a job. When a Job is created in the suspended state, this field is not set until the first time it is resumed. This field is reset every time a Job is resumed from suspension. It is represented in RFC3339 form and is in UTC.\n\nOnce set, the field can only be removed when the job is suspended. The field cannot be modified while the job is unsuspended or finished."
},
"succeeded": {
"description": "The number of pods which reached phase Succeeded.",
"description": "The number of pods which reached phase Succeeded. The value increases monotonically, with the exception of elastic indexed jobs (with completions = parallelism), which can be scaled down.",
"format": "int32",
"type": "integer"
},
"terminating": {
"description": "The number of pods which are terminating (in phase Pending or Running and have a deletionTimestamp).\n\nThis field is beta-level. The job controller populates the field when the feature gate JobPodReplacementPolicy is enabled (enabled by default).",
"description": "The number of pods which are terminating (in phase Pending or Running and have a deletionTimestamp). The value is zero (or nil) for finished jobs.\n\nThis field is beta-level. The job controller populates the field when the feature gate JobPodReplacementPolicy is enabled (enabled by default).",
"format": "int32",
"type": "integer"
},
Expand All @@ -475,7 +479,7 @@
"$ref": "#/components/schemas/io.k8s.api.batch.v1.UncountedTerminatedPods"
}
],
"description": "uncountedTerminatedPods holds the UIDs of Pods that have terminated but the job controller hasn't yet accounted for in the status counters.\n\nThe job controller creates pods with a finalizer. When a pod terminates (succeeded or failed), the controller does three steps to account for it in the job status:\n\n1. Add the pod UID to the arrays in this field. 2. Remove the pod finalizer. 3. Remove the pod UID from the arrays while increasing the corresponding\n counter.\n\nOld jobs might not be tracked using this field, in which case the field remains null."
"description": "uncountedTerminatedPods holds the UIDs of Pods that have terminated but the job controller hasn't yet accounted for in the status counters.\n\nThe job controller creates pods with a finalizer. When a pod terminates (succeeded or failed), the controller does three steps to account for it in the job status:\n\n1. Add the pod UID to the arrays in this field. 2. Remove the pod finalizer. 3. Remove the pod UID from the arrays while increasing the corresponding\n counter.\n\nOld jobs might not be tracked using this field, in which case the field remains null. The structure is empty for finished jobs."
}
},
"type": "object"
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/batch/fuzzer/fuzzer.go
Expand Up @@ -64,6 +64,9 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
podReplacementPolicy = batch.Failed
}
j.PodReplacementPolicy = &podReplacementPolicy
if c.RandBool() {
j.ManagedBy = pointer.String(batch.JobControllerName)
}
},
func(sj *batch.CronJobSpec, c fuzz.Continue) {
c.FuzzNoCustom(sj)
Expand Down

0 comments on commit 1bff570

Please sign in to comment.