Bug 1473429 - Unable to patch out finalizers on job
Unable to patch out finalizers on job
Product: OpenShift Container Platform
Classification: Red Hat
Component: Pod (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: David Eads
DeShuai Ma
Depends On:
  Show dependency treegraph
Reported: 2017-07-20 15:47 EDT by Eric Paris
Modified: 2017-07-28 05:41 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Eric Paris 2017-07-20 15:47:55 EDT
oc v3.6.126.1

oc patch -n "${ns}" "${job}" --type=json --patch='[ { "op":"remove", "path": "/metadata/finalizers" }]'

resulted in

The Job "scheduled-job-test-1497220260" is invalid: spec.template: Invalid value: api.PodTemplateSpec{ObjectMeta:v1.ObjectMeta{Name:"", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"controller-uid":"a744ad73-4ef5-11e7-b1dd-122631632f42", "job-name":"scheduled-job-test-1497220260"}, Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:api.PodSpec{Volumes:[]api.Volume(nil), InitContainers:[]api.Container(nil), Containers:[]api.Container{api.Container{Name:"test-job-container", Image:"", Command:[]string{"python", "./test_job.py"}, Args:[]string(nil), WorkingDir:"", Ports:[]api.ContainerPort(nil), EnvFrom:[]api.EnvFromSource(nil), Env:[]api.EnvVar(nil), Resources:api.ResourceRequirements{Limits:api.ResourceList(nil), Requests:api.ResourceList(nil)}, VolumeMounts:[]api.VolumeMount(nil), LivenessProbe:(*api.Probe)(nil), ReadinessProbe:(*api.Probe)(nil), Lifecycle:(*api.Lifecycle)(nil), TerminationMessagePath:"/dev/termination-log", TerminationMessagePolicy:"File", ImagePullPolicy:"Always", SecurityContext:(*api.SecurityContext)(nil), Stdin:false, StdinOnce:false, TTY:false}}, RestartPolicy:"Never", TerminationGracePeriodSeconds:(*int64)(0xc6e36da660), ActiveDeadlineSeconds:(*int64)(nil), DNSPolicy:"ClusterFirst", NodeSelector:map[string]string(nil), ServiceAccountName:"", AutomountServiceAccountToken:(*bool)(nil), NodeName:"", SecurityContext:(*api.PodSecurityContext)(0xc637c25d00), ImagePullSecrets:[]api.LocalObjectReference(nil), Hostname:"", Subdomain:"", Affinity:(*api.Affinity)(nil), SchedulerName:"default-scheduler", Tolerations:[]api.Toleration(nil)}}: field is immutable
Comment 2 David Eads 2017-07-20 16:26:27 EDT
Thanks for the details.  tracking it down, we are hitting this: https://github.com/openshift/origin/pull/15118
Comment 3 Jordan Liggitt 2017-07-21 09:14:10 EDT
Fixed in v3.6.141-1

Comment 4 Weihua Meng 2017-07-25 05:34:35 EDT
I cannot reproduce it.
Eric, could you show more detailed info to reproduce it? Thanks.
Comment 5 Weihua Meng 2017-07-27 09:59:30 EDT
David, could you provide detailed reproduce steps? Thanks.
Comment 6 David Eads 2017-07-27 10:02:30 EDT
You can 
 1. turn off the image policy admission plugin
 2. create a job that would be updated
 3. turn on the image policy admission plugin and have it set to mutate the job
 4. delete the job with an orphaning policy
 5. on the old code, the job should be stuck since patch would fail.  on the new code, the job should be deleted.
Comment 7 DeShuai Ma 2017-07-28 05:25:51 EDT
Verified on openshift v3.
kubernetes v1.6.1+5115d708d7
etcd 3.2.1

Note You need to log in before you can comment on or make changes to this bug.