Invalid value error when updating the CommonService CR by using the
setup_tenant.sh script
An error occurs when you run the
setup_tenant.sh script to update the CommonService
custom resource (CR) with an invalid value.
Symptom
The following error message is displayed when you run the
setup_tenant.sh script:
The commonservices "common-service" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update
Cause
The issue occurs when you use oc apply to manually
update the CommonService CR without removing
.metadata.resourceVersion. Because of that
.metadata.resourceVersion was included in annotation
kubectl.kubernetes.io/last-applied-configuration as
well.
When the script is trying to update the CommonService CR, script
removes .metadata.resourceVersion from CommonService
CR. However, due to the .metadata.resourceVersion in
annotation
kubectl.kubernetes.io/last-applied-configuration, such
action is rejected.
Resolving the problem
To resolve the issue, remove the existing annotation
kubectl.kubernetes.io/last-applied-configuration in
CommonService CR. This also effectively removes
.metadata.resourceVersion in annotation
kubectl.kubernetes.io/last-applied-configuration which
is causing the issue.
Use the following command to correct the annotation:
oc annotate commonservice common-service kubectl.kubernetes.io/last-applied-configuration-