Kubernetes job to create BPM Enterprise database schema fails with "field is immutable" error

Kubernetes job to create BPM Enterprise database schema fails with "field is immutable" error

book

Article ID: KB0071642

calendar_today

Updated On:

Products Versions
TIBCO BPM Enterprise (formerly TIBCO ActiveMatrix BPM) 5.0.0, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.3.0

Description

BPM Enterprise (BPME) database schema is created by running the utility image. This can be executed either via a Docker command or a Kubernetes job. 

While creating the BPME database schema via a Kubernetes job, the following error might be seen - 

==================
The Job "utility" is invalid: spec.template: Invalid value: core.PodTemplateSpec{ObjectMeta:v1.ObjectMeta{Name:"", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), DeletionTimestamp:<nil>, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"controller-uid":"f0f5397a-1891-4049-abe7-f163db061a2f", "job-name":"utility"}, Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ManagedFields:[]v1.ManagedFieldsEntry(nil)}, Spec:core.PodSpec{Volumes:[]core.Volume(nil), InitContainers:[]core.Container(nil), Containers:[]core.Container{core.Container{Name:"utility", Image:"tibco/bpm/utility:5.3.0", Command:[]string{"utility"}, Args:[]string{"-dbConfig", "url=jdbc:oracle:thin:@//localhost:1521/bpm", "username=bpm", "password=bpm", "-setupDatabase", "execute", "--verbose"}, WorkingDir:"", Ports:[]core.ContainerPort(nil), EnvFrom:[]core.EnvFromSource(nil), Env:[]core.EnvVar(nil), Resources:core.ResourceRequirements{Limits:core.ResourceList(nil), Requests:core.ResourceList(nil), Claims:[]core.ResourceClaim(nil)}, VolumeMounts:[]core.VolumeMount(nil), VolumeDevices:[]core.VolumeDevice(nil), LivenessProbe:(*core.Probe)(nil), ReadinessProbe:(*core.Probe)(nil), StartupProbe:(*core.Probe)(nil), Lifecycle:(*core.Lifecycle)(nil), TerminationMessagePath:"/dev/termination-log", TerminationMessagePolicy:"File", ImagePullPolicy:"IfNotPresent", SecurityContext:(*core.SecurityContext)(nil), Stdin:false, StdinOnce:false, TTY:false}}, EphemeralContainers:[]core.EphemeralContainer(nil), RestartPolicy:"Never", TerminationGracePeriodSeconds:(*int64)(0xc0117eda98), ActiveDeadlineSeconds:(*int64)(nil), DNSPolicy:"ClusterFirst", NodeSelector:map[string]string(nil), ServiceAccountName:"", AutomountServiceAccountToken:(*bool)(nil), NodeName:"", SecurityContext:(*core.PodSecurityContext)(0xc0114a9290), ImagePullSecrets:[]core.LocalObjectReference(nil), Hostname:"", Subdomain:"", SetHostnameAsFQDN:(*bool)(nil), Affinity:(*core.Affinity)(nil), SchedulerName:"default-scheduler", Tolerations:[]core.Toleration(nil), HostAliases:[]core.HostAlias(nil), PriorityClassName:"", Priority:(*int32)(nil), PreemptionPolicy:(*core.PreemptionPolicy)(nil), DNSConfig:(*core.PodDNSConfig)(nil), ReadinessGates:[]core.PodReadinessGate(nil), RuntimeClassName:(*string)(nil), Overhead:core.ResourceList(nil), EnableServiceLinks:(*bool)(nil), TopologySpreadConstraints:[]core.TopologySpreadConstraint(nil), OS:(*core.PodOS)(nil), SchedulingGates:[]core.PodSchedulingGate(nil), ResourceClaims:[]core.PodResourceClaim(nil)}}: field is immutable
==================

Symptoms: 
BPM database schema is not generated

Cause: 
This is typically seen when the Kubernetes job template is being updated. A change of job template is not allowed by Kubernetes. It implies there was a previous attempt to generate the schema which might have been unsuccessful. 

Issue/Introduction

This article lists a solution to resolve a "field is immutable" error while running a Kubernetes job, which we use to create a BPM enterprise database schema

Environment

All supported Kubernetes platforms

Resolution

It is required to delete the Kubernetes job before re-attempting the creation of a BPME database schema. 

-- To get all Kubernetes jobs
kubectl get jobs -A

-- To delete any existing BPME utility job. This will delete the pod used to execute the job. 
kubectl delete job utility -n <namespace>

Workaround: 
Create a Kubernetes job with a unique name

Additional Information

Creating the TIBCO BPM Enterprise Schema - v5.3.0 - https://docs.tibco.com/pub/bpme/5.3.0/doc/html/Default.htm#installation/create-the-tibco-bpm-enterprise-schema.htm?TocPath=Installation%257CInstalling%2520TIBCO%2520BPM%2520Enterprise%2520on%2520Kubernetes%257CCreating%2520the%2520TIBCO%2520BPM%2520Enterprise%2520Database%257C_____5

Kubernetes discussion - https://github.com/kubernetes/kubernetes/issues/89657